nci/static/js/dataio.js

29 lines
568 B
JavaScript
Raw Normal View History

'use strict';
define(['_dataio'], function(dataio) {
return function(socket) {
var connect = dataio(socket);
/*
2015-05-05 23:11:28 +00:00
* Extend Resource
*/
var resource = connect.resource('__someResource__'),
resourcePrototype = Object.getPrototypeOf(resource);
2015-05-14 20:37:44 +00:00
resourcePrototype.disconnect = function() {
this.socket.disconnect();
this.socket.removeAllListeners();
};
2015-05-14 20:37:44 +00:00
resourcePrototype.connect = function() {
this.socket.connect();
};
resourcePrototype.reconnect = function() {
this.disconnect();
this.connect();
};
return connect;
};
});