proto._onmanifest = function (err, manifest) {
  if (err) return console.error(err);
  var self = this;

  this._db = multilevel.client(manifest);
  reconnect(function (con) { 
    con.pipe(self._db.createRpcStream()).pipe(con) 
  })
  .connect(self._endpoint)

  self._events.emit('db-inited', self._db, manifest)

  var editors = { indexes: this.indexesViewer, editor: this.editor };
  var setup = setupViewNeditor(this._db, this._events, this._opts, editors, this._containers);

  this._refreshIndexes = indexesRefresher(this._db.sublevels, this.indexesViewer, this._opts);
  this._refreshData = setup.refreshData;
}
Example #2
0
domready(function() {

  var match = paramify(document.location.pathname);

  var con = reconnect(function(stream) {
    linestream(stream); // split the stream on new lines and emit json

    if (match('/home') || match('/'))
      return require('home/client')(stream);

    if (match('/project/:id'))
      return require('project/client')(stream);

  });

  con.connect('/server');

  //
  // TODO
  // handle UI events for disconnect/reconnect here.
  //

});