fix compiling issues

This commit is contained in:
Kevin Jahns
2017-10-14 23:03:24 +02:00
parent 82015d5a37
commit 0e426f8928
36 changed files with 192 additions and 309 deletions

View File

@@ -1,7 +1,7 @@
import StructManager from './StructManager'
import { getReference } from './structReferences.js'
export class ID {
export default class ID {
constructor (user, clock) {
this.user = user
this.clock = clock
@@ -16,17 +16,3 @@ export class ID {
return this.user < id.user || (this.user === id.user && this.clock < id.clock)
}
}
export class RootID {
constructor (name, typeConstructor) {
this.user = -1
this.name = name
this.type = StructManager.getReference(typeConstructor)
}
equals (id) {
return id !== null && id.user === this.user && id.name === this.name && id.type === this.type
}
lessThan (id) {
return this.user < id.user || (this.user === id.user && (this.name < id.name || (this.name === id.name && this.type < id.type)))
}
}

14
src/Util/RootID.js Normal file
View File

@@ -0,0 +1,14 @@
export default class RootID {
constructor (name, typeConstructor) {
this.user = -1
this.name = name
this.type = StructManager.getReference(typeConstructor)
}
equals (id) {
return id !== null && id.user === this.user && id.name === this.name && id.type === this.type
}
lessThan (id) {
return this.user < id.user || (this.user === id.user && (this.name < id.name || (this.name === id.name && this.type < id.type)))
}
}

View File

@@ -1,7 +1,7 @@
import Delete from '../Struct/Delete'
import ID from './ID'
export default function deleteItemRange (y, user, clock, length) {
export function deleteItemRange (y, user, clock, length) {
let del = new Delete()
del._target = new ID(user, clock)
del._length = length

View File

@@ -1,6 +1,6 @@
/* global crypto */
export default function generateUserID () {
export function generateUserID () {
if (typeof crypto !== 'undefined' && crypto.getRandomValue != null) {
// browser
let arr = new Uint32Array(1)

View File

@@ -1,10 +1,10 @@
import YArray from '../Type/YArray'
import YMap from '../Type/YMap'
import YText from '../Type/YText'
import YXml from '../Type/YXml'
import YArray from '../Type/YArray.js'
import YMap from '../Type/YMap.js'
import YText from '../Type/YText.js'
import YXml from '../Type/YXml.js'
import ItemJSON from '../Struct/ItemJSON'
import ItemString from '../Struct/ItemString'
import ItemJSON from '../Struct/ItemJSON.js'
import ItemString from '../Struct/ItemString.js'
const structs = new Map()
const references = new Map()