mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-11 01:45:08 +00:00
add unsubscribe method to client resource
This commit is contained in:
parent
12d56926e5
commit
004b482a06
@ -36,6 +36,7 @@ define([
|
||||
$('#build-console').prev('h2').html('Build #' + buildId + ' console');
|
||||
$('#build-console').html('');
|
||||
|
||||
connect.resource(resourceName).unsubscribeAll();
|
||||
connect.resource(resourceName).subscribe(function(data) {
|
||||
$('#build-console').append('<div>' + data + '</div>');
|
||||
});
|
||||
|
19
static/js/dataio.js
Normal file
19
static/js/dataio.js
Normal file
@ -0,0 +1,19 @@
|
||||
'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.unsubscribeAll = function() {
|
||||
this.socket.removeAllListeners();
|
||||
};
|
||||
|
||||
return connect;
|
||||
};
|
||||
});
|
@ -5,7 +5,7 @@ require.config({
|
||||
paths: {
|
||||
underscore: 'libs/underscore/underscore',
|
||||
react: 'libs/react/react-with-addons',
|
||||
dataio: '/data.io',
|
||||
_dataio: '/data.io',
|
||||
socketio: '/socket.io/socket.io.js',
|
||||
jquery: 'libs/jquery/jquery'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user