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
08bcdfb0
Commit
08bcdfb0
authored
8 years ago
by
Kevin Jahns
Browse files
Options
Downloads
Patches
Plain Diff
implemented es6 import utility function (Y.extend(module) === module(Y))
parent
f93d7b1e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+13
-0
13 additions, 0 deletions
README.md
src/y.js
+18
-7
18 additions, 7 deletions
src/y.js
with
31 additions
and
7 deletions
README.md
+
13
−
0
View file @
08bcdfb0
...
...
@@ -71,6 +71,19 @@ require('y-text')(Y)
// do the same for all modules you want to use
```
### 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
Install dependencies
```
...
...
This diff is collapsed.
Click to expand it.
src/y.js
+
18
−
7
View file @
08bcdfb0
...
...
@@ -14,14 +14,25 @@ module.exports = Y
Y
.
requiringModules
=
requiringModules
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
}
if
(
requiringModules
[
name
]
!=
null
)
{
requiringModules
[
name
].
resolve
()
delete
requiringModules
[
name
]
for
(
var
i
=
0
;
i
<
arguments
.
length
;
i
++
)
{
var
f
=
arguments
[
i
]
if
(
typeof
f
===
'
function
'
)
{
f
(
Y
)
}
else
{
throw
new
Error
(
'
Expected function!
'
)
}
}
}
}
...
...
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