comparison core/src/js/messaging/Destination.js @ 34:27e8e9e38e07 default tip

Слияние
author nickolay
date Wed, 05 Jun 2019 20:44:15 +0300
parents acdcdf1a8d21
children
comparison
equal deleted inserted replaced
33:8af8e840dd49 34:27e8e9e38e07
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 });