Debian Codegraph @

dojox/mobile/dh/PatternFileTypeMap.js

raw symbols SCIP
1 define([
2 "dojo/_base/lang"
3 ], function(lang){
4
5 // module:
6 // dojox/mobile/dh/PatternFileTypeMap
7
8 var o = {
9 // summary:
10 // A component that provides a map for determining content-type from
11 // the pattern of the URL.
12 };
13 lang.setObject("dojox.mobile.dh.PatternFileTypeMap", 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 for(var key in this.map){
30 if((new RegExp(key)).test(fileName)){
31 return this.map[key];
32 }
33 }
34 return null;
35 };
36
37 return o;
38 });