comparison core/src/js/messaging/Destination.js @ 29:acdcdf1a8d21

repository reorganized
author cin
date Tue, 26 Jun 2018 19:35:44 +0300
parents src/implab/messaging/Destination.js@fc2517695ee1
children
comparison
equal deleted inserted replaced
28:d796bbbe558c 29:acdcdf1a8d21
1 define([ "dojo/_base/declare", "./Listener" ],
2
3 function(declare, Listener) {
4 return declare(null, {
5 _session : null,
6 _destination : null,
7 _listenerClass : null,
8
9 constructor : function(session, destination, options) {
10 if (!session)
11 throw new Error("A session is required");
12 if (!destination)
13 throw new Error("A destination is required");
14
15 this._session = session;
16 this._destination = destination;
17 if (options) {
18 if (options.listenerClass)
19 this._listenerClass = options.listenerClass;
20 }
21 },
22
23 listen : function(callback) {
24 var factory = this._listenerClass || Listener;
25 var listener = new factory(this._session, this._destination, {
26 listener : callback
27 });
28 listener.start();
29
30 return listener;
31 }
32
33 });
34 });