mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-11 12:35:08 +00:00
29 lines
568 B
JavaScript
29 lines
568 B
JavaScript
'use strict';
|
|
|
|
define(['_dataio'], function(dataio) {
|
|
return function(socket) {
|
|
var connect = dataio(socket);
|
|
|
|
/*
|
|
* Extend Resource
|
|
*/
|
|
var resource = connect.resource('__someResource__'),
|
|
resourcePrototype = Object.getPrototypeOf(resource);
|
|
|
|
resourcePrototype.disconnect = function() {
|
|
this.socket.disconnect();
|
|
this.socket.removeAllListeners();
|
|
};
|
|
|
|
resourcePrototype.connect = function() {
|
|
this.socket.connect();
|
|
};
|
|
|
|
resourcePrototype.reconnect = function() {
|
|
this.disconnect();
|
|
this.connect();
|
|
};
|
|
|
|
return connect;
|
|
};
|
|
}); |