UNPKG

1.38 kBJavaScriptView Raw
1const K = require('kcore');
2require('./KBSCNateAbstract')
3
4// -----------------------------------------------------------------------------
5// Prototypes
6// -----------------------------------------------------------------------------
7
8K.NateAbstractProto = Object.assign({}, K.BSC.NateAbstractProto,
9{
10 init(parent, namespace)
11 {
12 K.BSC.NateAbstractProto.init.call(this, parent, namespace);
13 },
14
15 delete()
16 {
17 K.BSC.NateAbstractProto.delete.call(this);
18 },
19
20 push(child)
21 {
22 this._confirmIsNateChildAllowed();
23 this.children.push(child);
24 },
25
26 deleteAllChildren()
27 {
28 this.children.forEach((node) => {
29 node.delete()
30 })
31 this.children = [];
32 this.isNateChildAllowed = true;
33 },
34
35 render()
36 {
37 let txt = '';
38
39 for (let id in this.children)
40 {
41 txt += this.children[id].render();
42 }
43
44 return txt;
45 }
46})
47
48// -----------------------------------------------------------------------------
49// Factory functions
50// -----------------------------------------------------------------------------
51
52K.NateAbstract = function(parent, namespace)
53{
54 const thiz = Object.create(K.NateAbstractProto);
55
56 K.BSC.NateAbstractProto.init.call(thiz, parent, namespace)
57
58 thiz.init(parent);
59
60 return thiz;
61}