-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakeDeferredProvider.min.js
1 lines (1 loc) · 1.08 KB
/
makeDeferredProvider.min.js
1
function makeDeferredProvider(e){e=e?e:"SObjectModel";makeDeferredGlobal[e].deferredObject=function(e,t){var n={};n.remoteObject=new this[e](t);n.set=function(e,t){this.remoteObject.set(e,t)};n.get=function(e){return this.remoteObject.get(e)};n.retrieve=function(e){var t=$.Deferred();this.remoteObject.retrieve(e,function(e,n){if(e){t.reject(e)}else{t.resolve(n)}});return t.promise()};n.create=function(e){var t=$.Deferred();e=e?e:this.remoteObject._props;this.remoteObject.create(e,function(e,n,r){if(e){t.reject(e)}else{t.resolve(n,r)}});return t.promise()};n.update=function(e,t){var n=$.Deferred();if(!(e instanceof Array)){t=e;e=null}e=e?e:[this.remoteObject._props.Id];t=t?t:this.remoteObject._props;console.log(this.remoteObject._props);console.log(e);this.remoteObject.update(e,t,function(e,t){if(e){n.reject(e)}else{n.resolve(t)}});return n.promise()};n.del=function(e){var t=$.Deferred();e=e?e:[this.remoteObject._props.Id];this.remoteObject.del(e,function(e,n){if(e){t.reject(e)}else{t.resolve(n)}});return t.promise()};return n}}var makeDeferredGlobal=function(){return this||(1,eval)("this")}()