Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
usp-js
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebSDK
usp-js
Commits
5bac478c
Commit
5bac478c
authored
2 years ago
by
Marin Karamihalev
Browse files
Options
Downloads
Patches
Plain Diff
fixed isAsync bug on operate command
parent
578d8691
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!5
Rebase with master
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package.json
+1
-1
1 addition, 1 deletion
package.json
src/commands/recipes/operate.ts
+13
-9
13 additions, 9 deletions
src/commands/recipes/operate.ts
with
14 additions
and
10 deletions
package.json
+
1
−
1
View file @
5bac478c
{
{
"name"
:
"usp-js"
,
"name"
:
"usp-js"
,
"version"
:
"0.3.
4
"
,
"version"
:
"0.3.
5
"
,
"description"
:
"Helper library for easy usp communication using mqtt over tcp or ws."
,
"description"
:
"Helper library for easy usp communication using mqtt over tcp or ws."
,
"main"
:
"node/index.js"
,
"main"
:
"node/index.js"
,
"browser"
:
"web/index.js"
,
"browser"
:
"web/index.js"
,
...
...
This diff is collapsed.
Click to expand it.
src/commands/recipes/operate.ts
+
13
−
9
View file @
5bac478c
...
@@ -7,7 +7,8 @@ const make: MakeFn =
...
@@ -7,7 +7,8 @@ const make: MakeFn =
(
call
,
on
):
OperateRecipe
=>
(
call
,
on
):
OperateRecipe
=>
async
(
path
,
opts
)
=>
{
async
(
path
,
opts
)
=>
{
const
Persistent
=
opts
?.
Persistent
===
undefined
?
false
:
opts
.
Persistent
;
const
Persistent
=
opts
?.
Persistent
===
undefined
?
false
:
opts
.
Persistent
;
const
id
=
"
NOTIFY@
"
+
(
opts
?.
ID
||
uniq
(
path
));
const
isAsync
=
!
(
opts
&&
opts
.
isAsync
===
false
);
const
id
=
(
isAsync
?
"
NOTIFY@
"
:
"
OPERATE@
"
)
+
(
opts
?.
ID
||
uniq
(
path
));
const
operateInput
=
{
const
operateInput
=
{
Enable
:
true
,
Enable
:
true
,
ID
:
id
,
ID
:
id
,
...
@@ -18,11 +19,6 @@ const make: MakeFn =
...
@@ -18,11 +19,6 @@ const make: MakeFn =
const
commandKey
=
opts
?.
commandKey
||
""
;
const
commandKey
=
opts
?.
commandKey
||
""
;
const
newSubPath
=
await
call
(
"
ADD
"
,
{
path
:
operateSubscriptionPath
,
value
:
operateInput
,
});
const
command
:
OperateFn
=
(
input
)
=>
{
const
command
:
OperateFn
=
(
input
)
=>
{
return
call
(
return
call
(
"
OPERATE
"
,
"
OPERATE
"
,
...
@@ -33,7 +29,7 @@ const make: MakeFn =
...
@@ -33,7 +29,7 @@ const make: MakeFn =
resp
:
opts
?.
sendResponse
??
true
,
resp
:
opts
?.
sendResponse
??
true
,
commandKey
,
commandKey
,
},
},
opts
&&
opts
.
isAsync
===
false
?
{}
:
{
responseMsgType
:
"
NOTIFY
"
}
isAsync
?
{
responseMsgType
:
"
NOTIFY
"
}
:
{}
);
);
};
};
...
@@ -54,9 +50,17 @@ const make: MakeFn =
...
@@ -54,9 +50,17 @@ const make: MakeFn =
};
};
};
};
const
cleanup
:
OperateClearFn
=
()
=>
call
(
"
DELETE
"
,
{
paths
:
newSubPath
});
if
(
isAsync
)
{
const
newSubPath
=
await
call
(
"
ADD
"
,
{
path
:
operateSubscriptionPath
,
value
:
operateInput
,
});
const
cleanup
:
OperateClearFn
=
()
=>
call
(
"
DELETE
"
,
{
paths
:
newSubPath
});
return
[
command
,
cleanup
];
return
[
command
,
cleanup
];
}
else
return
[
command
,
()
=>
Promise
.
resolve
()];
};
};
export
default
{
export
default
{
...
...
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