@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 2.1 kB
JavaScript
module.exports=function(r){var n={};function o(t){if(n[t])return n[t].exports;var e=n[t]={exports:{},id:t,loaded:!1};return r[t].call(e.exports,e,e.exports,o),e.loaded=!0,e.exports}return o.m=r,o.c=n,o.p="",o(0)}({0:function(t,e,r){t.exports=r(1130)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},1063:function(t,e){t.exports=require("./kendo.data")},1130:function(t,e,r){var n;r(3),r=[r(1063)],void 0===(e="function"==typeof(n=function(){var t={id:"data.signalr",name:"SignalR",category:"framework",depends:["data"],hidden:true},a=window.kendo.jQuery,u=window.kendo,e=u.isFunction;function d(t){return t&&e(t.done)&&e(t.fail)}function p(t){return t&&e(t.then)&&e(t.catch)}var r=u.data.RemoteTransport.extend({init:function(t){var e=t&&t.signalr?t.signalr:{};var r=e.promise;if(!r)throw new Error('The "promise" option must be set.');if(!d(r)&&!p(r))throw new Error('The "promise" option must be a Promise.');this.promise=r;var n=e.hub;if(!n)throw new Error('The "hub" option must be set.');if(typeof n.on!="function"||typeof n.invoke!="function")throw new Error('The "hub" option is not a valid SignalR hub proxy.');this.hub=n;u.data.RemoteTransport.fn.init.call(this,t)},push:function(t){var e=this.options.signalr.client||{};if(e.create)this.hub.on(e.create,t.pushCreate);if(e.update)this.hub.on(e.update,t.pushUpdate);if(e.destroy)this.hub.on(e.destroy,t.pushDestroy)},_crud:function(t,e){var r=this.hub;var n=this.promise;var o=this.options.signalr.server;if(!o||!o[e])throw new Error(u.format('The "server.{0}" option must be set.',e));var i=[o[e]];var s=this.parameterMap(t.data,e);if(!a.isEmptyObject(s))i.push(s);if(d(n))n.done(function(){r.invoke.apply(r,i).done(t.success).fail(t.error)});else if(p(n))n.then(function(){r.invoke.apply(r,i).then(t.success).catch(t.error)})},read:function(t){this._crud(t,"read")},create:function(t){this._crud(t,"create")},update:function(t){this._crud(t,"update")},destroy:function(t){this._crud(t,"destroy")}});return a.extend(true,u.data,{transports:{signalr:r}}),window.kendo})?n.apply(e,r):n)||(t.exports=e)}});