How to use the sharedb.Backend function in sharedb

To help you get started, we’ve selected a few sharedb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github derbyjs / racer / lib / Backend.js View on Github external
var path = require('path');
var Backend = require('sharedb').Backend;
var Model = require('./Model');
var util = require('./util');

module.exports = RacerBackend;

function RacerBackend(racer, options) {
  Backend.call(this, options);
  this.racer = racer;
  this.modelOptions = options && options.modelOptions;
  this.on('bundle', function(browserify) {
    var racerPath = path.join(__dirname, 'index.js');
    browserify.require(racerPath, {expose: 'racer'});
  });
}
RacerBackend.prototype = Object.create(Backend.prototype);