hedera-web/js/htk/component.js

43 lines
733 B
JavaScript
Raw Normal View History

2016-10-16 14:16:08 +00:00
2022-05-24 21:11:12 +00:00
const Widget = require('./widget');
2016-10-16 14:16:08 +00:00
2022-05-24 21:11:12 +00:00
module.exports = new Class({
2016-10-16 14:16:08 +00:00
Extends: Widget
2022-05-24 21:11:12 +00:00
,scope: null
2016-10-16 14:16:08 +00:00
2022-05-24 21:11:12 +00:00
,builderInit: function(path) {
const builder = new Vn.Builder();
builder.compileFile(path);
this.builderResultInit(builder);
2016-10-16 14:16:08 +00:00
}
2022-05-24 21:11:12 +00:00
,builderInitString: function(xmlString) {
const builder = new Vn.Builder();
builder.compileString(xmlString);
this.builderResultInit(builder);
2016-10-16 14:16:08 +00:00
}
2022-05-24 21:11:12 +00:00
,builderResultInit: function(builder) {
const scope = this.scope = builder.load(this.doc, this);
scope.link();
this._node = scope.$('main');
2016-10-16 14:16:08 +00:00
}
2022-05-24 21:11:12 +00:00
,$: function(id) {
if (this.scope)
return this.scope.getById(id);
2016-10-16 14:16:08 +00:00
return null;
}
2022-05-24 21:11:12 +00:00
,_destroy: function() {
if (this.scope)
this.scope.unref();
2016-10-16 14:16:08 +00:00
2022-05-24 21:11:12 +00:00
this.parent();
2016-10-16 14:16:08 +00:00
}
});