Comparing version 12.0.2 to 12.0.3
{ | ||
"name": "yjs", | ||
"version": "12.0.2", | ||
"version": "12.0.3", | ||
"homepage": "y-js.org", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -41,1 +41,13 @@ /* global Y, Quill */ | ||
Y({ | ||
db: { | ||
name: 'indexeddb' | ||
}, | ||
connector: { | ||
name: 'websockets-client', | ||
room: 'test42' | ||
}, | ||
share: { | ||
state : 'Map' | ||
} | ||
}).then((y) => { window.y = y }) |
@@ -74,2 +74,15 @@ | ||
### ES6 Syntax | ||
``` | ||
import Y from 'yjs' | ||
import yArray from 'y-array' | ||
import yWebsocketsClient from 'y-webrtc' | ||
import yMemory from 'y-memory' | ||
import yArray from 'y-array' | ||
import yMap from 'y-map' | ||
import yText from 'y-text' | ||
// .. | ||
Y.extend(yArray, yWebsocketsClient, yMemory, yArray, yMap, yText /*, .. */) | ||
``` | ||
# Text editing example | ||
@@ -76,0 +89,0 @@ Install dependencies |
{ | ||
"name": "yjs", | ||
"version": "12.0.2", | ||
"version": "12.0.3", | ||
"description": "A framework for real-time p2p shared editing on any data", | ||
@@ -5,0 +5,0 @@ "main": "./src/y.js", |
@@ -74,2 +74,15 @@ | ||
### ES6 Syntax | ||
``` | ||
import Y from 'yjs' | ||
import yArray from 'y-array' | ||
import yWebsocketsClient from 'y-webrtc' | ||
import yMemory from 'y-memory' | ||
import yArray from 'y-array' | ||
import yMap from 'y-map' | ||
import yText from 'y-text' | ||
// .. | ||
Y.extend(yArray, yWebsocketsClient, yMemory, yArray, yMap, yText /*, .. */) | ||
``` | ||
# Text editing example | ||
@@ -76,0 +89,0 @@ Install dependencies |
25
src/y.js
@@ -17,11 +17,22 @@ /* @flow */ | ||
Y.extend = function (name, value) { | ||
if (value instanceof Y.utils.CustomTypeDefinition) { | ||
Y[name] = value.parseArguments | ||
if (arguments.length === 2 && typeof name === 'string') { | ||
if (value instanceof Y.utils.CustomTypeDefinition) { | ||
Y[name] = value.parseArguments | ||
} else { | ||
Y[name] = value | ||
} | ||
if (requiringModules[name] != null) { | ||
requiringModules[name].resolve() | ||
delete requiringModules[name] | ||
} | ||
} else { | ||
Y[name] = value | ||
for (var i = 0; i < arguments.length; i++) { | ||
var f = arguments[i] | ||
if (typeof f === 'function') { | ||
f(Y) | ||
} else { | ||
throw new Error('Expected function!') | ||
} | ||
} | ||
} | ||
if (requiringModules[name] != null) { | ||
requiringModules[name].resolve() | ||
delete requiringModules[name] | ||
} | ||
} | ||
@@ -28,0 +39,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
822483
5249
265