UNPKG

caldb-dl

Version:

library to connect to the caldb-d server

46 lines (45 loc) 1.57 kB
// Generated by LiveScript 1.3.1 (function(){ var ioclient, create, CALDBDL, out$ = typeof exports != 'undefined' && exports || this; ioclient = require('socket.io-client'); out$.create = create = function(){ return (function(func, args, ctor) { ctor.prototype = func.prototype; var child = new ctor, result = func.apply(child, args), t; return (t = typeof result) == "object" || t == "function" ? result || child : child; })(CALDBDL, arguments, function(){}); }; CALDBDL = (function(){ CALDBDL.displayName = 'CALDBDL'; var prototype = CALDBDL.prototype, constructor = CALDBDL; function CALDBDL(url){ this.url = url; this.client = ioclient(url, { reconnection: true, reconnectionAttempts: Infinity, reconnectionDelay: 500, reconnectionDelayMax: 2000, autoConnect: false }); } prototype.connect = function(){ return bind$(this.client, 'connect').apply(this, arguments); }; prototype.on = function(){ return bind$(this.client, 'on').apply(this, arguments); }; prototype.off = function(){ return bind$(this.client, 'off').apply(this, arguments); }; prototype.close = function(){ return bind$(this.client, 'close').apply(this, arguments); }; prototype.emit = function(){ return bind$(this.client, 'emit').apply(this, arguments); }; return CALDBDL; }()); function bind$(obj, key, target){ return function(){ return (target || obj)[key].apply(obj, arguments) }; } }).call(this);