-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVirtualWidget.js
More file actions
38 lines (28 loc) · 824 Bytes
/
VirtualWidget.js
File metadata and controls
38 lines (28 loc) · 824 Bytes
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
var h = require('./helpers.js');
var VirtualWidget = function (ownerVWidget, originalVNode, Component) {
this.name = Component.prototype.name;
this.id = originalVNode && originalVNode.key;
this.ownerVWidget = ownerVWidget;
this.originalVNode = originalVNode;
this.Component = Component;
this.properties = {};
};
VirtualWidget.prototype = {
type: 'Widget',
init: function (isRoot) {
var com = this.com = new this.Component(this);
com.__mount();
return com.node;
},
update: function (prevWidget, node) {
var com = this.com = prevWidget.com;
com.node = node;
com.__vWidget = this;
com.__update();
return node;
},
destroy: function () {
this.com.unmount();
}
};
module.exports = VirtualWidget;