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