| 1 | define([ |
| 2 | "dojo/_base/lang" |
| 3 | ], function(lang){ |
| 4 | |
| 5 | // module: |
| 6 | // dojox/mobile/dh/SuffixFileTypeMap |
| 7 | |
| 8 | var o = { |
| 9 | // summary: |
| 10 | // A component that provides a map for determining content-type from |
| 11 | // the suffix of the URL. |
| 12 | }; |
| 13 | lang.setObject("dojox.mobile.dh.SuffixFileTypeMap", o); |
| 14 | |
| 15 | o.map = { |
| 16 | "html": "html", |
| 17 | "json": "json" |
| 18 | }; |
| 19 | |
| 20 | o.add = function(/*String*/ key, /*String*/ contentType){ |
| 21 | // summary: |
| 22 | // Adds a handler class for the given content type. |
| 23 | this.map[key] = contentType; |
| 24 | }; |
| 25 | |
| 26 | o.getContentType = function(/*String*/ fileName){ |
| 27 | // summary: |
| 28 | // Returns the handler class for the given content type. |
| 29 | var fileType = (fileName || "").replace(/.*\./, ""); |
| 30 | return this.map[fileType]; |
| 31 | }; |
| 32 | |
| 33 | return o; |
| 34 | }); |