Fix load state error

This commit is contained in:
YNH Webdev
2013-09-28 09:44:39 +02:00
parent cb1a4825d2
commit 1100328fee
16 changed files with 47 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
// Generated by CoffeeScript 1.6.1
var Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_PAGE_CONTROL, WSF_PAGINATION_CONTROL, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_REPEATER_CONTROL, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, build_control, cache, controls, lazy_load, show_alert, start_modal, template, tmpl,
var Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_PAGE_CONTROL, WSF_PAGINATION_CONTROL, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_REPEATER_CONTROL, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, build_control, cache, controls, lazy_load, loaded, show_alert, start_modal, template, tmpl,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
@@ -49,12 +49,15 @@ Mini = {
}
};
loaded = {};
lazy_load = function(requirements, fn, that) {
if (that == null) {
that = window;
}
return function() {
var args, counter, done, r, self, _i, _len;
var a, args, counter, done, r, self, _i, _len;
a = arguments;
if (typeof args === "undefined" || args === null) {
args = [];
}
@@ -63,12 +66,19 @@ lazy_load = function(requirements, fn, that) {
done = function() {
counter = counter - 1;
if (counter === 0) {
fn.apply(that, arguments);
fn.apply(that, a);
}
};
for (_i = 0, _len = requirements.length; _i < _len; _i++) {
r = requirements[_i];
$.cachedScript(r).done(done);
if (loaded[r] != null) {
done();
} else {
$.cachedScript(r).done(function() {
done();
return loaded[r] = true;
});
}
}
return done();
};