mutoo
4/18/2015 - 2:52 AM

convenience of use of cocos2d-js

convenience of use of cocos2d-js

storage = {
    getItem: function (key) {
        try {
            return JSON.parse(cc.sys.localStorage.getItem(key));
        } catch (e) {
            return null;
        }
    },
    setItem: function (key, value) {
        cc.sys.localStorage.setItem(key, JSON.stringify(value));
    }
};
uiReader = ccs.uiReader.widgetFromJsonFile.bind(ccs.uiReader);
getWidget = ccui.helper.seekWidgetByName.bind(ccui.helper);

on = cc.eventManager.addCustomListener.bind(cc.eventManager);
off = cc.eventManager.removeCustomListeners.bind(cc.eventManager);
send = cc.eventManager.dispatchCustomEvent.bind(cc.eventManager);