Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/src/js/jgame.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 91 by tsugehara, Mon Apr 22 14:42:34 2013 UTC revision 98 by tsugehara, Mon Apr 29 14:51:03 2013 UTC
# Line 1013  var jg; Line 1013  var jg;
1013              this.handlers = [];              this.handlers = [];
1014          }          }
1015          Trigger.prototype.handleInsert = function (index, owner, handler) {          Trigger.prototype.handleInsert = function (index, owner, handler) {
1016              this.handlers.splice(index, 0, {              if(!handler) {
1017                  owner: owner,                  this.handlers.splice(index, 0, {
1018                  handler: handler                      owner: window,
1019              });                      handler: owner
1020                    });
1021                } else {
1022                    this.handlers.splice(index, 0, {
1023                        owner: owner,
1024                        handler: handler
1025                    });
1026                }
1027          };          };
1028          Trigger.prototype.handle = function (owner, handler) {          Trigger.prototype.handle = function (owner, handler) {
1029              if(!handler) {              if(!handler) {
# Line 1210  var jg; Line 1217  var jg;
1217          }          }
1218          ScriptResourceLoader.prototype.load = function (url, identifier) {          ScriptResourceLoader.prototype.load = function (url, identifier) {
1219              var _this = this;              var _this = this;
             var script = document.createElement("script");  
             var heads = document.getElementsByTagName("head");  
             if(heads.length == 0) {  
                 throw "can not find head tag";  
             }  
             script.src = url + "?" + (new Date()).getTime();  
1220              var callback = this.completed;              var callback = this.completed;
1221              script.onload = function () {              var waitLoader = function () {
1222                  callback.call(_this, identifier, script, true);                  if(ScriptResourceLoader.loading) {
1223              };                      window.setTimeout(waitLoader, 100);
1224              script.onerror = function () {                      return;
1225                  callback.call(_this, identifier, script, false);                  }
1226                    ScriptResourceLoader.loading = true;
1227                    var script = document.createElement("script");
1228                    var heads = document.getElementsByTagName("head");
1229                    if(heads.length == 0) {
1230                        throw "can not find head tag";
1231                    }
1232                    script.src = url + "?" + (new Date()).getTime();
1233                    script.onload = function () {
1234                        callback.call(_this, identifier, script, true);
1235                        ScriptResourceLoader.loading = false;
1236                    };
1237                    script.onerror = function () {
1238                        callback.call(_this, identifier, script, false);
1239                        ScriptResourceLoader.loading = false;
1240                    };
1241                    heads[0].appendChild(script);
1242              };              };
1243              heads[0].appendChild(script);              waitLoader();
1244          };          };
1245          ScriptResourceLoader.prototype.completed = function (name, script, is_success) {          ScriptResourceLoader.prototype.completed = function (name, script, is_success) {
1246              if(!is_success) {              if(!is_success) {

Legend:
Removed from v.91  
changed lines
  Added in v.98

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26