Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
yjs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sweng-group-15
yjs
Commits
e9c40f9a
Commit
e9c40f9a
authored
9 years ago
by
Kevin Jahns
Browse files
Options
Downloads
Patches
Plain Diff
added flow support for Struct.js
parent
da2762ed
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
declarations/Structs.js
+5
-0
5 additions, 0 deletions
declarations/Structs.js
declarations/Y.js
+4
-4
4 additions, 4 deletions
declarations/Y.js
src/Connector.js
+1
-1
1 addition, 1 deletion
src/Connector.js
src/Struct.js
+20
-19
20 additions, 19 deletions
src/Struct.js
with
30 additions
and
24 deletions
declarations/Structs.js
+
5
−
0
View file @
e9c40f9a
...
...
@@ -17,7 +17,12 @@ type Operation = Struct
type
Insertion
=
{
id
:
Id
,
left
:
Id
,
origin
:
Id
,
right
:
Id
,
parent
:
Id
,
parentSub
:
?
Id
,
opContent
:
?
Id
,
content
:
?
any
,
struct
:
'
Insert
'
}
...
...
This diff is collapsed.
Click to expand it.
declarations/Y.js
+
4
−
4
View file @
e9c40f9a
/* @flow */
type
YGlobal
=
{
utils
:
Object
;
Struct
:
Object
;
AbstractDatabase
:
any
;
AbstractConnector
:
any
;
utils
:
Object
,
Struct
:
any
,
AbstractDatabase
:
any
,
AbstractConnector
:
any
}
type
YConfig
=
{
...
...
This diff is collapsed.
Click to expand it.
src/Connector.js
+
1
−
1
View file @
e9c40f9a
...
...
@@ -11,7 +11,7 @@ module.exports = function (Y/* :YGlobal */) {
userEventListeners: Array<Function>;
whenSyncedListeners: Array<Function>;
currentSyncTarget: ?UserId;
syncingClients: Array<
any
>;
syncingClients: Array<
UserId
>;
forwardToSyncingClients: boolean;
debug: boolean;
broadcastedHB: boolean;
...
...
This diff is collapsed.
Click to expand it.
src/Struct.js
+
20
−
19
View file @
e9c40f9a
/* @flow */
'
use strict
'
/*
...
...
@@ -18,7 +19,7 @@
* requiredOps
- Operations that are required to execute this operation.
*/
module
.
exports
=
function
(
Y
)
{
module
.
exports
=
function
(
Y
/* :YGlobal */
)
{
var
Struct
=
{
/* This is the only operation that is actually not a structure, because
it is not stored in the OS. This is why it _does not_ have an id
...
...
@@ -49,10 +50,10 @@ module.exports = function (Y) {
parentSub: string (optional), // child of Map type
}
*/
encode
:
function
(
op
)
{
encode
:
function
(
op
/* :Insertion */
)
/* :Insertion */
{
// TODO: you could not send the "left" property, then you also have to
// "op.left = null" in $execute or $decode
var
e
=
{
var
e
/* :any */
=
{
id
:
op
.
id
,
left
:
op
.
left
,
right
:
op
.
right
,
...
...
@@ -160,7 +161,11 @@ module.exports = function (Y) {
break
}
i
++
o
=
o
.
right
?
yield
*
this
.
getOperation
(
o
.
right
)
:
null
if
(
o
.
right
!=
null
)
{
o
=
yield
*
this
.
getOperation
(
o
.
right
)
}
else
{
o
=
null
}
}
else
{
break
}
...
...
@@ -169,7 +174,9 @@ module.exports = function (Y) {
// reconnect..
var
left
=
null
var
right
=
null
parent
=
parent
||
(
yield
*
this
.
getOperation
(
op
.
parent
))
if
(
parent
==
null
)
{
parent
=
yield
*
this
.
getOperation
(
op
.
parent
)
}
// reconnect left and set right of op
if
(
op
.
left
!=
null
)
{
...
...
@@ -267,7 +274,7 @@ module.exports = function (Y) {
pos
--
}
if
(
pos
>=
0
&&
o
.
right
!=
null
)
{
o
=
(
yield
*
this
.
getOperation
(
o
.
right
)
)
o
=
yield
*
this
.
getOperation
(
o
.
right
)
}
else
{
break
}
...
...
@@ -315,19 +322,13 @@ module.exports = function (Y) {
var
oid
=
op
.
map
[
name
]
if
(
oid
!=
null
)
{
var
res
=
yield
*
this
.
getOperation
(
oid
)
return
(
res
==
null
||
res
.
deleted
)
?
void
0
:
(
res
.
opContent
==
null
?
res
.
content
:
yield
*
this
.
getType
(
res
.
opContent
))
}
},
/*
Delete a property by name
*/
delete
:
function
*
(
op
,
name
)
{
var
v
=
op
.
map
[
name
]
||
null
if
(
v
!=
null
)
{
yield
*
Struct
.
Delete
.
create
.
call
(
this
,
{
target
:
v
})
if
(
res
==
null
||
res
.
deleted
)
{
return
void
0
}
else
if
(
res
.
opContent
==
null
)
{
return
res
.
content
}
else
{
return
yield
*
this
.
getType
(
res
.
opContent
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment