From 791f6c12f00c80070d13d99d52e4b09c8ab85a25 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Sat, 7 Oct 2017 00:40:17 +0200 Subject: [PATCH] add indexeddb example --- examples/indexeddb/index.html | 21 +++++++++++++++++++++ examples/indexeddb/index.js | 24 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 examples/indexeddb/index.html create mode 100644 examples/indexeddb/index.js diff --git a/examples/indexeddb/index.html b/examples/indexeddb/index.html new file mode 100644 index 00000000..e2218850 --- /dev/null +++ b/examples/indexeddb/index.html @@ -0,0 +1,21 @@ + + + + + +
+ + + + + + + diff --git a/examples/indexeddb/index.js b/examples/indexeddb/index.js new file mode 100644 index 00000000..b307579b --- /dev/null +++ b/examples/indexeddb/index.js @@ -0,0 +1,24 @@ +/* global Y, CodeMirror */ + +// initialize a shared object. This function call returns a promise! +Y({ + db: { + name: 'memory' + }, + connector: { + name: 'websockets-client', + room: 'codemirror-example' + }, + sourceDir: '/bower_components', + share: { + codemirror: 'Text' // y.share.codemirror is of type Y.Text + } +}).then(function (y) { + window.yCodeMirror = y + + var editor = CodeMirror(document.querySelector('#codeMirrorContainer'), { + mode: 'javascript', + lineNumbers: true + }) + y.share.codemirror.bindCodeMirror(editor) +})