-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathnotification.js
More file actions
64 lines (58 loc) · 2.19 KB
/
notification.js
File metadata and controls
64 lines (58 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Types of change events
* @enum {number}
*/
var events = {
NODE_INSERTED: 0,
VALUE_MODIFIED: 1,
NODE_REMOVED: 2,
THIS_REMOVED: 3,
ADAPTER_HANDLE_CHANGED: 4,
ADAPTER_VALUE_CHANGED: 5
};
//-----------------------------------------------------------------------------
//Class Notification
//-----------------------------------------------------------------------------
events.Notification = function(type) {
this.type = type;
};
events.Notification.prototype.toString = function() {
return "Notification (type:" + this.type + ")";
};
//-----------------------------------------------------------------------------
events.NotificationWrapper = function(mutation, type, affectedNode) {
this.mutation = mutation;
this.type = type;
this.affectedNode = affectedNode;
};
XML3D.createClass(events.NotificationWrapper, events.Notification);
events.NotificationWrapper.prototype.toString = function() {
return "NotificationWrapper (type:" + this.type + ", wrapped: "+ this.mutation +")";
};
//-----------------------------------------------------------------------------
/**
* @param {AdapterHandle} handle
* @param {int} type
* @constructor
*/
events.AdapterHandleNotification = function (handle, type) {
this.adapterHandle = handle;
this.type = type;
};
XML3D.createClass(events.AdapterHandleNotification, events.Notification);
events.AdapterHandleNotification.prototype.toString = function () {
return "AdapterHandleNotification (type:" + this.type + ")";
};
//-----------------------------------------------------------------------------
events.ConnectedAdapterNotification = function(adapterHandleNotification, key) {
this.adapter = adapterHandleNotification.adapterHandle.getAdapter();
this.key = key;
this.url = adapterHandleNotification.adapterHandle.url;
this.type = adapterHandleNotification.type;
this.handleStatus = adapterHandleNotification.adapterHandle.status;
};
XML3D.createClass(events.ConnectedAdapterNotification, events.Notification);
events.ConnectedAdapterNotification.prototype.toString = function() {
return "ConnectedAdapterNotification (type:" + this.type + ", key: " + this.key + ")";
};
module.exports = events;