-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStoreOfServer.js
40 lines (35 loc) · 1.01 KB
/
StoreOfServer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Store
* by kingpjchen 20160813
*/
define(function factory(require, exports, module) {
var StoreForGC = require('./StoreForGC')
var cache = require('util/cacheData')
var StoreOfServer = StoreForGC.extend({
__config:{
params: {},
syncData: null
},
//提供给子类覆盖实现
parse: function(json){
},
update: function(){
var self = this
self.fire('beforefetch')
return new Promise(function(resolve, reject){
self.proxy(this.get('params'), function(err, json){
if(err){
resolve(self.__memorydata = self.parse(json))
}else{
reject(json)
}
this.fire('afterfetch', json)
})
})
},
//定义销毁的方法,一些收尾工作都应该在这里
destroy:function(){
}
})
return StoreOfServer
})