removed circular dependency, errors and ys reference

This commit is contained in:
sarahm7 2021-04-02 14:07:40 +08:00
parent fc739a2f27
commit 54086f7b7b
4 changed files with 17 additions and 15 deletions

View File

@ -1,6 +1,6 @@
{
"name": "yjs",
"version": "12.3.3",
"name": "ys-yjs",
"version": "12.5.0",
"description": "A framework for real-time p2p shared editing on any data",
"main": "./src/y.js",
"scripts": {
@ -23,7 +23,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/y-js/yjs.git"
"url": "https://github.com/yousourceinc/yjs.git"
},
"keywords": [
"Yjs",
@ -38,7 +38,7 @@
"email": "kevin.jahns@rwth-aachen.de",
"license": "MIT",
"bugs": {
"url": "https://github.com/y-js/yjs/issues"
"url": "https://github.com/yousourceinc/yjs/issues"
},
"homepage": "http://y-js.org",
"devDependencies": {

View File

@ -506,10 +506,12 @@ module.exports = function (Y/* :any */) {
// ** Now the new implementation starts **
// reset neworigin of all originOf[*]
for (var _i of o.originOf) {
var originsIn = yield* this.getOperation(o.originOf[_i])
if (originsIn != null) {
originsIn.origin = neworigin
yield* this.setOperation(originsIn)
if (_i) {
var originsIn = yield* this.getOperation(_i)
if (originsIn != null) {
originsIn.origin = neworigin
yield* this.setOperation(originsIn)
}
}
}
if (neworigin != null) {

View File

@ -658,7 +658,7 @@ module.exports = function (Y /* : any*/) {
for (i = this.readBuffer.length - 1; i >= 0; i--) {
r = this.readBuffer[i]
// we don't have to use compareids, because id is always defined!
if (r.id[1] === id[1] && r.id[0] === id[0]) {
if (r.id && id && r.id[1] === id[1] && r.id[0] === id[0]) {
// found r
// move r to the end of readBuffer
for (; i < this.readBuffer.length - 1; i++) {
@ -671,7 +671,7 @@ module.exports = function (Y /* : any*/) {
var o
for (i = this.writeBuffer.length - 1; i >= 0; i--) {
r = this.writeBuffer[i]
if (r.id[1] === id[1] && r.id[0] === id[0]) {
if (r.id && id && r.id[1] === id[1] && r.id[0] === id[0]) {
o = r
break
}
@ -694,7 +694,7 @@ module.exports = function (Y /* : any*/) {
var i, r // helper variables
for (i = this.writeBuffer.length - 1; i >= 0; i--) {
r = this.writeBuffer[i]
if (r.id[1] === id[1] && r.id[0] === id[0]) {
if (r.id && id && r.id[1] === id[1] && r.id[0] === id[0]) {
// is already in buffer
// forget r, and move o to the end of writeBuffer
for (; i < this.writeBuffer.length - 1; i++) {
@ -721,7 +721,7 @@ module.exports = function (Y /* : any*/) {
// whether found or not, we'll append o to the readbuffer
for (i = 0; i < this.readBuffer.length - 1; i++) {
r = this.readBuffer[i + 1]
if (r.id[1] === id[1] && r.id[0] === id[0]) {
if (r.id && id && r.id[1] === id[1] && r.id[0] === id[0]) {
this.readBuffer[i] = o
} else {
this.readBuffer[i] = r
@ -733,7 +733,7 @@ module.exports = function (Y /* : any*/) {
var i, r
for (i = 0; i < this.readBuffer.length; i++) {
r = this.readBuffer[i]
if (r.id[1] === id[1] && r.id[0] === id[0]) {
if (r.id && id && r.id[1] === id[1] && r.id[0] === id[0]) {
this.readBuffer[i] = {
id: [null, null]
}

View File

@ -70,8 +70,8 @@ function requestModules (modules) {
})
promises.push(requireModule.promise)
} else {
console.info('YJS: Please do not depend on automatic requiring of modules anymore! Extend modules as follows `require(\'y-modulename\')(Y)`')
require(modulename)(Y)
console.error('YJS: Please do not depend on automatic requiring of modules anymore! Extend modules as follows `require(\'y-modulename\')(Y)`')
// require(modulename)(Y) // causing circular dependency for angular
}
} else {
promises.push(requiringModules[modules[i]].promise)