Skip to content

Custom class wrapper

Alexandre Courpron edited this page Dec 26, 2016 · 1 revision
class Model() {}

class ModelCollection() {
  constructor() {
    this._arr = [];
  }

  push(element) {
    this._arr.push(element);
  }
}

const treem = new Treem({
  wrap: {
    single: () => new Model(),
    collection: () => new ModelCollection()
  }
});
Clone this wiki locally