| 1 |
define("udx.utility.process",["udx.utility","async","jquery"],function(){function a(c){return console.debug("udx.utility.process","new Process"),this.settings=b.defaults(c,{id:null,ajax:null,args:{},poll:5e3,timeout:1e4,protocol:"ajax",format:"json",headers:{},onStart:function(){},onComplete:function(){},onError:function(){},onTimeout:function(){}}),this._start=(new Date).getTime(),a.instances[c.id]=this}console.debug("udx.utility.process","loaded");var b=(require("async").auto,require("async").series,require("udx.utility"));return Object.defineProperties(a.prototype,{start:{value:function(){console.debug("udx.utility.process","startProcess");var a=this;return jQuery.ajax({url:a.settings.ajax,timeout:a.settings.timeout,async:!0,cache:!1,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:a.settings.format||"json",headers:a.settings.headers||{},data:b.extend({event:"start-process",id:a.settings.id,type:a.settings.type},a.settings.args),beforeSend:function(){},error:function c(c){console.debug("udx.utility.process","error",arguments),a.settings.onStart(new Error("Process Start Error: "+c))},complete:function(b,c){console.debug("udx.utility.process","complete",c),b.responseJSON&&a.settings.onStart(null,b.responseJSON)},success:function(a){console.debug("udx.utility.process","success"),a.ok}}),this},enumerable:!0,configurable:!0,writable:!0},poll:{value:function(){return console.debug("udx.utility.process","pollProcess"),this},enumerable:!0,configurable:!0,writable:!0},recover:{value:function(){return console.debug("udx.utility.process","recoverProcess"),this},enumerable:!0,configurable:!0,writable:!0}}),Object.defineProperties(a,{create:{value:function(){return new a(arguments[0])},enumerable:!0,configurable:!0,writable:!0},instances:{value:{},enumerable:!1,configurable:!0,writable:!0}}),a}); |