Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including y-leveldb with all npm packages installed. Try it out:

require("yjs/package.json"); // yjs is a peer dependency. var yLeveldb = require("y-leveldb")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

y-leveldb v0.0.3

LevelDB database adapter for Yjs

LevelDB database adapter for Yjs

Use the LevelDB database adapter to store your shared data persistently in NodeJs applications. The changes will persist after restart.

Use it!

Install this with bower or npm.

Bower
bower install y-leveldb --save
NPM
npm install y-leveldb --save

Example

Y({
  db: {
    name: 'leveldb',
    namespace: 'textarea-example' (optional - defaults to connector.room),
    dir: './db' // where the database is created,
    cleanStart: false // (if true, overwrite existing content - great for debugging)
  },
  connector: {
    name: 'websockets-client', // use the websockets connector
    room: 'textarea-example'
  },
  share: {
    textarea: 'Text' // y.share.textarea is of type Y.Text
  }
}).then(function (y) {
  // bind the textarea to a shared text element
  y.share.textarea.bind(document.getElementById('textfield'))
}

License

Yjs is licensed under the MIT License.

kevin.jahns@rwth-aachen.de

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free