Compare commits
1 Commits
v13.0.0-15
...
v13.0.0-13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1135c5e167 |
@@ -2,6 +2,7 @@
|
||||
|
||||
// eslint-disable-next-line
|
||||
let search = new URLSearchParams(location.search)
|
||||
let url = search.get('url')
|
||||
|
||||
// initialize a shared object. This function call returns a promise!
|
||||
Y({
|
||||
@@ -11,20 +12,17 @@ Y({
|
||||
connector: {
|
||||
name: 'websockets-client',
|
||||
room: 'Textarea-example',
|
||||
url: 'https://yjs-v13.herokuapp.com/'
|
||||
url: url || 'http://127.0.0.1:1234'
|
||||
},
|
||||
sourceDir: '/bower_components',
|
||||
share: {
|
||||
textarea: 'Text', // y.share.textarea is of type Y.Text
|
||||
test: 'Array'
|
||||
},
|
||||
timeout: 5000 // reject if no connection was established within 5 seconds
|
||||
}
|
||||
}).then(function (y) {
|
||||
window.yTextarea = y
|
||||
|
||||
// bind the textarea to a shared text element
|
||||
y.share.textarea.bind(document.getElementById('textfield'))
|
||||
// thats it..
|
||||
}).catch(() => {
|
||||
console.log('Something went wrong while creating the instance..')
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "yjs",
|
||||
"version": "13.0.0-15",
|
||||
"version": "13.0.0-13",
|
||||
"description": "A framework for real-time p2p shared editing on any data",
|
||||
"main": "./y.node.js",
|
||||
"browser": "./y.js",
|
||||
|
||||
12
src/y.js
12
src/y.js
@@ -139,20 +139,10 @@ export default function Y (opts/* :YOptions */) /* :Promise<YConfig> */ {
|
||||
opts.share = Y.utils.copyObject(opts.share)
|
||||
Y.requestModules(modules).then(function () {
|
||||
var yconfig = new YConfig(opts)
|
||||
let resolved = false
|
||||
if (opts.timeout != null && opts.timeout >= 0) {
|
||||
setTimeout(function () {
|
||||
if (!resolved) {
|
||||
reject(new Error('Yjs init timeout'))
|
||||
yconfig.destroy()
|
||||
}
|
||||
}, opts.timeout)
|
||||
}
|
||||
yconfig.db.whenUserIdSet(function () {
|
||||
yconfig.init(function () {
|
||||
resolved = true
|
||||
resolve(yconfig)
|
||||
}, reject)
|
||||
})
|
||||
})
|
||||
}).catch(reject)
|
||||
}
|
||||
|
||||
14
y.node.js
14
y.node.js
@@ -1,7 +1,7 @@
|
||||
|
||||
/**
|
||||
* yjs - A framework for real-time p2p shared editing on any data
|
||||
* @version v13.0.0-15
|
||||
* @version v13.0.0-13
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
@@ -4929,20 +4929,10 @@ function Y (opts/* :YOptions */) /* :Promise<YConfig> */ {
|
||||
opts.share = Y.utils.copyObject(opts.share);
|
||||
Y.requestModules(modules).then(function () {
|
||||
var yconfig = new YConfig(opts);
|
||||
let resolved = false;
|
||||
if (opts.timeout != null && opts.timeout >= 0) {
|
||||
setTimeout(function () {
|
||||
if (!resolved) {
|
||||
reject(new Error('Yjs init timeout'));
|
||||
yconfig.destroy();
|
||||
}
|
||||
}, opts.timeout);
|
||||
}
|
||||
yconfig.db.whenUserIdSet(function () {
|
||||
yconfig.init(function () {
|
||||
resolved = true;
|
||||
resolve(yconfig);
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
}).catch(reject);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
y.test.js.map
Normal file
1
y.test.js.map
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user