|
525
|
1 |
/* |
|
|
2 |
YUI 3.10.3 (build 2fb5187) |
|
|
3 |
Copyright 2013 Yahoo! Inc. All rights reserved. |
|
|
4 |
Licensed under the BSD License. |
|
|
5 |
http://yuilibrary.com/license/ |
|
|
6 |
*/ |
|
|
7 |
|
|
|
8 |
YUI.add('cache-plugin', function (Y, NAME) { |
|
|
9 |
|
|
|
10 |
/** |
|
|
11 |
* Provides support to use Cache as a Plugin to a Base-based class. |
|
|
12 |
* |
|
|
13 |
* @module cache |
|
|
14 |
* @submodule cache-plugin |
|
|
15 |
*/ |
|
|
16 |
|
|
|
17 |
/** |
|
|
18 |
* Plugin.Cache adds pluginizability to Cache. |
|
|
19 |
* @class Plugin.Cache |
|
|
20 |
* @extends Cache |
|
|
21 |
* @uses Plugin.Base |
|
|
22 |
*/ |
|
|
23 |
function CachePlugin(config) { |
|
|
24 |
var cache = config && config.cache ? config.cache : Y.Cache, |
|
|
25 |
tmpclass = Y.Base.create("dataSourceCache", cache, [Y.Plugin.Base]), |
|
|
26 |
tmpinstance = new tmpclass(config); |
|
|
27 |
tmpclass.NS = "tmpClass"; |
|
|
28 |
return tmpinstance; |
|
|
29 |
} |
|
|
30 |
|
|
|
31 |
Y.mix(CachePlugin, { |
|
|
32 |
/** |
|
|
33 |
* The namespace for the plugin. This will be the property on the host which |
|
|
34 |
* references the plugin instance. |
|
|
35 |
* |
|
|
36 |
* @property NS |
|
|
37 |
* @type String |
|
|
38 |
* @static |
|
|
39 |
* @final |
|
|
40 |
* @value "cache" |
|
|
41 |
*/ |
|
|
42 |
NS: "cache", |
|
|
43 |
|
|
|
44 |
/** |
|
|
45 |
* Class name. |
|
|
46 |
* |
|
|
47 |
* @property NAME |
|
|
48 |
* @type String |
|
|
49 |
* @static |
|
|
50 |
* @final |
|
|
51 |
* @value "dataSourceCache" |
|
|
52 |
*/ |
|
|
53 |
NAME: "cachePlugin" |
|
|
54 |
}); |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
Y.namespace("Plugin").Cache = CachePlugin; |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
}, '3.10.3', {"requires": ["plugin", "cache-base"]}); |