Skip to content

Commit

Permalink
fix: update packages, add uuid, add data-parse to demos
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Jun 6, 2021
1 parent edb1b68 commit e718869
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 40 deletions.
7 changes: 3 additions & 4 deletions package.json
Expand Up @@ -17,9 +17,9 @@
"dependencies": {
"@cocreate/crud-client": "^1.0.3",
"@cocreate/cursors": "^1.1.8",
"y-indexeddb": "^9.0.5",
"y-indexeddb": "^9.0.6",
"y-webrtc": "^10.1.5",
"y-websocket": "^1.2.5",
"y-websocket": "^1.3.15",
"yjs": "^13.5.9"
},
"funding": {
Expand All @@ -43,7 +43,6 @@
"typescript": "^4.1.5",
"webpack": "^5.24.4",
"webpack-cli": "^4.5.0",
"webpack-log": "^3.0.1",
"y-protocols": "^1.0.4"
"webpack-log": "^3.0.1"
}
}
2 changes: 1 addition & 1 deletion src/core.js
Expand Up @@ -4,7 +4,7 @@ import { fetchUpdates, storeState, IndexeddbPersistence } from 'y-indexeddb'
import crud from '@cocreate/crud-client';
import CoCreateCursors from '@cocreate/cursors'

const debug = true;
const debug = false;

class CoCreateYSocket {
constructor(org, ydoc) {
Expand Down
30 changes: 4 additions & 26 deletions src/utils/cursor/userCursor_class.js
Expand Up @@ -2,6 +2,7 @@
/* eslint-env browser */
// @ts-ignore

import uuid from '@cocreate/uuid'
import { userColor } from './usercolor.js'

export class UserCursor {
Expand All @@ -20,8 +21,8 @@ export class UserCursor {
console.log(" INIT cursor_user = ",cursor_user)
var user_id = localStorage.getItem('user_id')
if (cursor_user == null){
var uuid = this.generateUUID(4)
let cursor_user = 'User : ' + uuid;
var randomid = uuid.generate(4)
let cursor_user = 'User : ' + randomid;
localStorage.setItem('cursor_user',cursor_user)
if(this.debug)
console.log("update name From __init__USERCURSORQUILL "+cursor_user)
Expand Down Expand Up @@ -60,27 +61,4 @@ export class UserCursor {
}
}

generateUUID(length=null) {
var d = new Date().getTime();
var d2 = (performance && performance.now && (performance.now()*1000)) || 0;//Time in microseconds since page-load or 0 if unsupported
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16;
if(d > 0){
var r = (d + r)%16 | 0;
d = Math.floor(d/16);
} else {
var r = (d2 + r)%16 | 0;
d2 = Math.floor(d2/16);
}
return (c=='x' ? r : (r&0x7|0x8)).toString(16);
});
if(length!=null){
uuid = uuid.substr(0,length)
}
return uuid;
}
}//en class




}
25 changes: 16 additions & 9 deletions yarn.lock
Expand Up @@ -2849,7 +2849,7 @@ lib0@^0.2.31, lib0@^0.2.34, lib0@^0.2.35:
dependencies:
isomorphic.js "^0.2.4"

lib0@^0.2.41:
lib0@^0.2.41, lib0@^0.2.42:
version "0.2.42"
resolved "https://registry.yarnpkg.com/lib0/-/lib0-0.2.42.tgz#6d8bf1fb8205dec37a953c521c5ee403fd8769b0"
integrity sha512-8BNM4MiokEKzMvSxTOC3gnCBisJH+jL67CnSnqzHv3jli3pUvGC8wz+0DQ2YvGr4wVQdb2R2uNNPw9LEpVvJ4Q==
Expand Down Expand Up @@ -4367,7 +4367,7 @@ xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0:
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==

y-indexeddb@^9.0.5:
y-indexeddb@^9.0.6:
version "9.0.6"
resolved "https://registry.yarnpkg.com/y-indexeddb/-/y-indexeddb-9.0.6.tgz#49aecac11bc229571fb134e0ec0717c0330b731f"
integrity sha512-8mdCYdzZDWS2lGiB9Reaz67ZqvnV6EXH/F7L+TmBC+3mWjIBrPw4UcI79nOhEOh+y9lHXzNpSda4YJ06M13F1A==
Expand All @@ -4382,13 +4382,20 @@ y-leveldb@^0.1.0:
level "^6.0.1"
lib0 "^0.2.31"

y-protocols@^1.0.1, y-protocols@^1.0.3, y-protocols@^1.0.4:
y-protocols@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/y-protocols/-/y-protocols-1.0.4.tgz#810978c6172474be87457c3bcd669e529c5ba3a1"
integrity sha512-5/Hd6DJ5Y2SlbqLIKq86BictdOS0iAcWJZCVop8MKqx0XWwA+BbMn4538n4Z0CGjFMUGnG1kGzagk3BKGz5SvQ==
dependencies:
lib0 "^0.2.35"

y-protocols@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/y-protocols/-/y-protocols-1.0.5.tgz#91d574250060b29fcac8f8eb5e276fbad594245e"
integrity sha512-Wil92b7cGk712lRHDqS4T90IczF6RkcvCwAD0A2OPg+adKmOe+nOiT/N2hvpQIWS3zfjmtL4CPaH5sIW1Hkm/A==
dependencies:
lib0 "^0.2.42"

y-webrtc@^10.1.5:
version "10.1.8"
resolved "https://registry.yarnpkg.com/y-webrtc/-/y-webrtc-10.1.8.tgz#b35d8cb2a96462f134ea9b16a1179c970ad20b48"
Expand All @@ -4400,14 +4407,14 @@ y-webrtc@^10.1.5:
optionalDependencies:
ws "^7.2.0"

y-websocket@^1.2.5:
version "1.3.11"
resolved "https://registry.yarnpkg.com/y-websocket/-/y-websocket-1.3.11.tgz#b6e1357a2f63fe8d74ab8999991f85af88ed4221"
integrity sha512-Cvf85SE1mwFxrMRCokr4Rj16febCtfJziQWGn/F74h2W37SGPPpPNQjYZR9PFG7ryMAskoMF3ge7ZR1IEnL5CQ==
y-websocket@^1.3.15:
version "1.3.15"
resolved "https://registry.yarnpkg.com/y-websocket/-/y-websocket-1.3.15.tgz#f88d099e74d68ec6eb3e032106acf70837ed654f"
integrity sha512-ZASGk9jCeUM6GOMxhFZSAZoP4ItSCmGchItAMG7GSiPY3hr1X19fCflRtnw2Z/y4/d1WoRTnwyuQb8g0l285jQ==
dependencies:
lib0 "^0.2.35"
lib0 "^0.2.42"
lodash.debounce "^4.0.8"
y-protocols "^1.0.3"
y-protocols "^1.0.5"
optionalDependencies:
ws "^6.2.1"
y-leveldb "^0.1.0"
Expand Down

0 comments on commit e718869

Please sign in to comment.