Commit d0d50b16 authored by Tristan Cavelier's avatar Tristan Cavelier

JIO uses promy library now

parent 6eb3443c
......@@ -160,13 +160,11 @@ IODeferred.createFromDeferred = function (method, info, options, deferred) {
// fail(deferred.reject.bind(deferred)).
// progress(deferred.notify.bind(deferred));
// // phantomjs doesn't like 'bind'...
iodeferred.promise().done(function () {
deferred.resolve.apply(deferred, arguments);
}).fail(function () {
deferred.reject.apply(deferred, arguments);
}).progress(function () {
deferred.notify.apply(deferred, arguments);
});
iodeferred.promise.then(
deferred.resolve.bind(deferred),
deferred.reject.bind(deferred),
deferred.notify.bind(deferred)
);
return iodeferred;
};
......
This diff is collapsed.
......@@ -315,7 +315,7 @@ function readBlobAsBinaryString(blob) {
fr.onerror = deferred.reject.bind(deferred);
fr.onprogress = deferred.notify.bind(deferred);
fr.readAsBinaryString(blob);
return deferred.promise();
return deferred.promise;
}
exports.util.readBlobAsBinaryString = readBlobAsBinaryString;
......@@ -325,7 +325,7 @@ function readBlobAsArrayBuffer(blob) {
fr.onerror = deferred.reject.bind(deferred);
fr.onprogress = deferred.notify.bind(deferred);
fr.readAsArrayBuffer(blob);
return deferred.promise();
return deferred.promise;
}
exports.util.readBlobAsArrayBuffer = readBlobAsArrayBuffer;
......@@ -335,7 +335,7 @@ function readBlobAsText(blob) {
fr.onerror = deferred.reject.bind(deferred);
fr.onprogress = deferred.notify.bind(deferred);
fr.readAsText(blob);
return deferred.promise();
return deferred.promise;
}
exports.util.readBlobAsText = readBlobAsText;
......@@ -377,7 +377,7 @@ function ajax(param) {
param.beforeSend(xhr);
}
xhr.send(param.data);
return deferred.promise();
return deferred.promise;
}
exports.util.ajax = ajax;
......
......@@ -20,7 +20,7 @@ function enableJobChecker(jio, shared, options) {
shared.job_rule_actions = {
wait: function (original_job, new_job) {
original_job.deferred.promise().always(function () {
original_job.deferred.promise.always(function () {
shared.emit('job', new_job);
});
new_job.state = 'waiting';
......@@ -35,7 +35,7 @@ function enableJobChecker(jio, shared, options) {
if (!original_job.deferred) {
original_job.deferred = new_job.deferred;
} else {
original_job.deferred.promise().
original_job.deferred.promise.
done(new_job.command.resolve).
fail(new_job.command.reject);
}
......
......@@ -52,7 +52,7 @@ function enableRestAPI(jio, shared) { // (jio, shared, options)
param.options = deepClone(type_dict.object.shift()) || {};
//param.deferred = new IODeferred(method, param.kwargs, param.options);
param.deferred = new Deferred();
promise = param.deferred.promise();
promise = param.deferred.promise;
type_dict['function'] = type_dict['function'] || [];
if (type_dict['function'].length === 1) {
callback = type_dict['function'].shift();
......
......@@ -4,11 +4,11 @@
return define(dependencies, module);
}
if (typeof exports === 'object') {
return module(exports);
return module(exports, require('promy'), require('sha256'));
}
window.jIO = {};
module(window.jIO, {hex_sha256: hex_sha256});
}(['exports', 'sha256'], function (exports, sha256) {
module(window.jIO, promy, {hex_sha256: hex_sha256});
}(['exports', 'promy', 'sha256'], function (exports, promy, sha256) {
"use strict";
var hex_sha256 = sha256.hex_sha256;
var hex_sha256 = sha256.hex_sha256, Deferred = promy.Deferred;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment