equal
deleted
inserted
replaced
1 /* data.js - this file deals with how the players gets and sends data */ |
1 /* data.js - this file deals with how the players gets and sends data */ |
|
2 |
|
3 IriSP.DataLoader = function() { |
|
4 this._cache = {}; |
|
5 }; |
|
6 |
|
7 IriSP.DataLoader.prototype.get = function(url, callback) { |
|
8 if (this._cache.hasOwnProperty(url)) { |
|
9 callback(this._cache[url]); |
|
10 } else { |
|
11 /* we need a closure because this gets lost when it's called back */ |
|
12 IriSP.jQuery.get(url, (function(obj) { |
|
13 return function(data) { |
|
14 obj._cache[url] = data; |
|
15 callback(obj._cache[url]); |
|
16 }; |
|
17 })(this)); |
|
18 |
|
19 } |
|
20 } |
|
21 |
|
22 IriSP.Serializer = function(DataLoader) { |
|
23 this.DataLoader = DataLoader; |
|
24 }; |
2 |
25 |
3 IriSP.getMetadata = function() { |
26 IriSP.getMetadata = function() { |
4 |
27 |
5 IriSP.jQuery.ajax({ |
28 IriSP.jQuery.ajax({ |
6 dataType: IriSP.config.metadata.load, |
29 dataType: IriSP.config.metadata.load, |