all files / model/ ContainerAdapter.js

25% Statements 2/8
100% Branches 0/0
0% Functions 0/3
25% Lines 2/8
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                                                     
import Container from './Container'
 
class ContainerAdapter extends Container {
 
  constructor(doc, path) {
    super(doc, { id: String(path) })
    this.document = doc
    this.path = path
 
    // HACK: putting this into a place so that doc.get(this.id) works
    // Hopefully this won't hurt :/
    doc.data.nodes[this.id] = this
  }
 
  getContentPath() {
    return this.path
  }
 
  get nodes() {
    return this.document.get(this.path)
  }
 
}
 
ContainerAdapter.prototype._isDocumentNode = false
ContainerAdapter.prototype._isContainer = false
 
export default ContainerAdapter