mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-22 15:22:34 +01:00
25 lines
524 B
JavaScript
25 lines
524 B
JavaScript
(function() {
|
|
'use strict';
|
|
|
|
/* Creates a mock of socket.io for the browser.
|
|
* Functionality of the service is tested through
|
|
* the chat controller tests.
|
|
*/
|
|
window.io = function() {
|
|
this.cbs = {};
|
|
this.on = function(msg, cb) {
|
|
this.cbs[msg] = cb;
|
|
};
|
|
this.emit = function(msg, data) {
|
|
this.cbs[msg](data);
|
|
};
|
|
this.removeListener = function(msg) {
|
|
delete this.cbs[msg];
|
|
};
|
|
this.connect = function() {
|
|
this.socket = {};
|
|
};
|
|
return this;
|
|
};
|
|
})();
|