Created
December 1, 2017 14:25
-
-
Save jachiang/d38ed1d00a38288557f902ee357e9955 to your computer and use it in GitHub Desktop.
yjsTest > Y promise doesn't return anything?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you need to create and inject a IPFS object | |
const IPFS = require('ipfs') | |
const Y = require('yjs') | |
require('y-ipfs-connector')(Y) | |
// other Yjs deps: | |
require('y-memory')(Y) | |
require('y-array')(Y) | |
require('y-text')(Y) | |
// create IPFS node | |
const ipfsNode = new IPFS({ | |
EXPERIMENTAL: { | |
pubsub: true // need this to work | |
} | |
}) | |
Y({ | |
db: { | |
name: 'memory' | |
}, | |
connector: { | |
name: 'ipfs', // use the IPFS connector | |
ipfs: ipfsNode, // inject the IPFS object | |
room: 'Textarea-example-dev' | |
}, | |
sourceDir: '/node_modules', // location of the y-* modules | |
share: { | |
textarea: 'Text' // y.share.textarea is of type Y.Text | |
} | |
}).then(function(y) { //ok so they use promises ... | |
// bind the textarea to a shared text element | |
return y; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment