js store

/**

  • Created by 49152 on 2017/4/26.
    */
    (function (imeWeb) {
    var StoreMang = function(){
    this.stores = {};
    };
    StoreMang.prototype.get = function(storeId){
    return this.stores[storeId];
    }
    StoreMang.prototype.put = function(store){
    this.stores[store.id] = store;
    }
    var instance;
    var StoreFactory = {
    getStoreManage:function(){
    if(instance === undefined){
    instance = new StoreMang();
    }
    return instance;
    }
    }
    imeWeb.StoreFactory = StoreFactory;
    })(window.imeWeb || (window.imeWeb = {}));

var imeWeb = imeWeb || {};
var storeMg = imeWeb.StoreFactory.getStoreManage();

storeMg.put({id:"taskInfo",data:taskInfo,parentId:"page-content-base"});
storeMg.get("taskInfo").data

你可能感兴趣的:(js store)