Skip to content

Commit e3db708

Browse files
committed
adding context to LoadTag
1 parent 9415211 commit e3db708

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/SDD.Source.json.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,23 @@ P.LoadMeta = function(ctx) {
9595
return p.promise();
9696
};
9797

98-
_P.LoadFileDone = function(jsf, data) {
98+
_P.LoadFileDone = function(ctx, jsf, data) {
9999
if (!data || !data.hasOwnProperty('tables')) {
100-
this.jsonfiles[jsf].p.reject(jsf, 'error', 'invalid data object');
100+
this.jsonfiles[jsf].p.rejectWith(ctx, [jsf, 'error', 'invalid data object']);
101101
}
102102
else if (!data.hasOwnProperty('formatID') || data['formatID'] != '1') {
103-
this.jsonfiles[jsf].p.reject(jsf, 'error', 'unknown data format');
103+
this.jsonfiles[jsf].p.rejectWith(ctx, [jsf, 'error', 'unknown data format']);
104104
}
105105
else {
106106
this.jsonfiles[jsf].loaded = true;
107107
this.jsonfiles[jsf].data = data;
108-
this.jsonfiles[jsf].p.resolve(jsf, data);
108+
this.jsonfiles[jsf].p.resolveWith(ctx, [jsf, data]);
109109
}
110110
};
111-
_P.LoadFileFail = function(jsf, status, error) {
112-
this.jsonfiles[jsf].p.reject(jsf, status, error);
111+
_P.LoadFileFail = function(ctx, jsf, status, error) {
112+
this.jsonfiles[jsf].p.rejectWith(ctx, [jsf, status, error]);
113113
};
114-
P.LoadTag = function(jsf) {
114+
P.LoadTag = function(jsf, ctx) {
115115
var self = this;
116116
if (this.jsonfiles[jsf].loaded) {
117117
return E.deferred().resolveWith(null, [jsf, this.jsonfiles[jsf].data]).promise();
@@ -128,8 +128,8 @@ P.LoadTag = function(jsf) {
128128
'jsonpCallback': 'EVEoj_' + jsf + '_callback',
129129
'url': this.cfg['path'] + '/' + jsf + '.' + this.cfg['datatype']
130130
})
131-
.done(function (data, status, jqxhr) { _P.LoadFileDone.apply(self, [jsf, data]) })
132-
.fail(function (jqxhr, status, error) { _P.LoadFileFail.apply(self, [jsf, status, error]) });
131+
.done(function (data, status, jqxhr) { _P.LoadFileDone.apply(self, [ctx, jsf, data]) })
132+
.fail(function (jqxhr, status, error) { _P.LoadFileFail.apply(self, [ctx, jsf, status, error]) });
133133
return this.jsonfiles[jsf].p.promise();
134134
}
135135
};

0 commit comments

Comments
 (0)