main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
654 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | let Container = require('./container')
|
---|
| 4 |
|
---|
| 5 | let LazyResult, Processor
|
---|
| 6 |
|
---|
| 7 | class Document extends Container {
|
---|
| 8 | constructor(defaults) {
|
---|
| 9 | // type needs to be passed to super, otherwise child roots won't be normalized correctly
|
---|
| 10 | super({ type: 'document', ...defaults })
|
---|
| 11 |
|
---|
| 12 | if (!this.nodes) {
|
---|
| 13 | this.nodes = []
|
---|
| 14 | }
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | toResult(opts = {}) {
|
---|
| 18 | let lazy = new LazyResult(new Processor(), this, opts)
|
---|
| 19 |
|
---|
| 20 | return lazy.stringify()
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | Document.registerLazyResult = dependant => {
|
---|
| 25 | LazyResult = dependant
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | Document.registerProcessor = dependant => {
|
---|
| 29 | Processor = dependant
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | module.exports = Document
|
---|
| 33 | Document.default = Document
|
---|
Note:
See
TracBrowser
for help on using the repository browser.