| Current Path : /home/afacube/www/templates/afacube/javascript/ |
| Current File : /home/afacube/www/templates/afacube/javascript/utils.js |
(function ($) {
"use strict";
function chainProxy (cObject) {
this._done = false;
this._error = false;
this._object = cObject;
}
chainProxy.prototype.done = function (handler) {
this._done = handler;
return this;
};
chainProxy.prototype.error = function (handler) {
this._error = handler;
return this;
};
function remoteImage (src) {
var img = new Image ();
var proxy = new chainProxy(img);
img.onload = function (ev) {
proxy._done.call(proxy._object);
}
img.src = src;
return proxy;
}
var tajal = window.tajal = {
'remoteImage' : remoteImage
};
})(jQuery);