Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
ParaEncode
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ParaEncode
Commits
9ade85b5
Commit
9ade85b5
authored
Apr 21, 2022
by
NzSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update connect and disconnect
parent
ec6b7258
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
WW.js
src/WW.js
+10
-5
No files found.
src/WW.js
View file @
9ade85b5
...
...
@@ -72,20 +72,25 @@ export class WW extends Observable {
* 2.No datas from targetWW will be streamed to current WW.
* 3.If a WW is be connected already then the connection
* between them is remain effective. */
connect
(
targetWW
)
{
connect
(
targetWW
,
install
,
predict
)
{
if
(
targetWW
.
ident
in
this
.
#
connected
)
{
// Already connected no effect
return
;
}
let
sub
=
this
.
subscribe
(
data
=>
{
targetWW
.
postMessage
(
data
);
});
install
(
targetWW
);
let
sub
=
this
.
pipe
(
filter
(
data
=>
predict
(
data
)))
.
subscribe
(
data
=>
{
targetWW
.
postMessage
(
data
);
});
this
.
#
connected
[
targetWW
.
ident
]
=
sub
;
}
disconnect
(
targetWW
)
{
disconnect
(
targetWW
,
uninstall
)
{
uninstall
(
targetWW
);
if
(
targetWW
.
ident
in
this
.
#
connected
)
{
this
.
#
connected
[
targetWW
.
ident
].
unsubscribe
();
delete
this
.
#
connected
[
targetWW
.
ident
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment