Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-process-lib
Project
Project
Details
Activity
Releases
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
劳工
zeroing-process-lib
Commits
37f1295c
Commit
37f1295c
authored
Nov 19, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮询判断过程
parent
9c2e8a8c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
13 deletions
+92
-13
compare.json
dist/base/compare.json
+3
-3
http-polling-judge.json
dist/net/http-polling-judge.json
+28
-0
context.d.ts
libs/context.d.ts
+11
-3
index.ts
src/base/compare/index.ts
+4
-6
meta.json
src/base/compare/meta.json
+1
-1
index.ts
src/net/http-polling-judge/index.ts
+20
-0
meta.json
src/net/http-polling-judge/meta.json
+25
-0
No files found.
dist/base/compare.json
View file @
37f1295c
...
...
@@ -32,11 +32,11 @@
}
},
"output"
:
[
"
equal
"
,
"
unequal
"
"
true
"
,
"
false
"
],
"id"
:
"compare"
,
"script"
:
"var
leftValue = typeof props.left === 'object' ? args[props.left.path] : props.left;
\n
var rightValue = typeof props.right === 'object' ? args[props.right.path] : props.right;
\n
var operator = args ? args.operator : props.operator;
\n
if (operator.length === 2 && operator[operator.length - 1] === '=') {
\n
operator += '=';
\n
}
\n
var func = new Function('return ' + leftValue + operator + rightValue);
\n
var result = func();
\n
next(result ? 'equal' : 'unequal
');
\n
"
,
"script"
:
"var
operator = (args ? args.operator : props.operator) || '==';
\n
if (operator === '==' || operator === '!=') {
\n
operator += '=';
\n
}
\n
var func = new Function('return ' + props.left + operator + props.right);
\n
var result = func();
\n
next(result ? 'true' : 'false
');
\n
"
,
"group"
:
"base"
,
"type"
:
"builtin"
}
dist/net/http-polling-judge.json
0 → 100644
View file @
37f1295c
{
"script"
:
"var count = props.count, field = props.field, successValues = props.successValues;
\n
var key = 'counting-' + vm.id;
\n
var counting = global[key] || 0;
\n
counting++;
\n
var successArr = successValues.split(',');
\n
if (successArr.indexOf(args[field]) >= 0) {
\n
delete global[key];
\n
next('success');
\n
}
\n
else if (counting < count) {
\n
global[key] = counting;
\n
next('continue');
\n
}
\n
else {
\n
delete global[key];
\n
next('timeout');
\n
}
\n
"
,
"props"
:
{
"count"
:
{
"type"
:
"number"
,
"default"
:
5
,
"alias"
:
"次数"
},
"field"
:
{
"type"
:
"string"
,
"alias"
:
"字段名"
,
"default"
:
"status"
},
"successArr"
:
{
"type"
:
"string"
,
"alias"
:
"成功值"
}
},
"name"
:
"轮询判断"
,
"output"
:
[
"success"
,
"continue"
,
"timeout"
],
"id"
:
"http-polling-judge"
,
"group"
:
"net"
,
"type"
:
"builtin"
}
libs/context.d.ts
View file @
37f1295c
...
...
@@ -3,6 +3,7 @@ declare const args: any;
declare
const
props
:
any
;
declare
const
target
:
engine
.
Container
;
declare
const
global
:
any
;
declare
const
vm
:
engine
.
VM
;
declare
function
next
(
type
:
string
,
payload
?:
any
);
...
...
@@ -2068,17 +2069,20 @@ export class Process {
}
>
;
getProcessMeta
(
id
:
any
):
any
;
getProps
(
key
?:
any
):
any
;
updateProps
():
void
;
updateProps
(
args
:
any
):
void
;
resolveLinkedProp
(
data
:
any
,
key
:
any
):
any
;
}
export
class
VM
{
_processMetaLibs
:
any
;
_globalContext
:
any
;
_target
:
any
;
_id
:
any
;
setup
(
context
:
any
):
void
;
executeProcess
(
sequence
:
any
,
id
:
any
,
parentProcess
:
any
,
args
:
any
):
Promise
<
any
>
;
executeProcess
(
sequence
:
any
,
p
id
:
any
,
parentProcess
:
any
,
args
:
any
):
Promise
<
any
>
;
getMeta
(
id
:
any
):
any
;
getGlobalContext
():
any
;
readonly
id
:
any
;
}
export
function
fieldChanged
(
onModify
:
any
):
(
target
:
any
,
key
:
string
)
=>
void
;
...
...
@@ -2131,6 +2135,7 @@ export class DataCenter extends EventDispatcher {
unregisterGroup
(
name
:
any
):
void
;
getGroup
(
name
:
any
):
any
;
getDataByPath
(
path
:
any
,
throwException
?:
any
):
any
;
getDataByName
(
name
:
any
,
throwException
?:
any
):
any
;
formatString
(
str
:
any
,
escapes
:
any
):
any
;
mutate
(
name
:
any
,
data
?:
any
,
path
?:
any
,
dispatch
?:
boolean
):
void
;
watch
(
name
:
any
,
path
:
any
):
void
;
...
...
@@ -2203,7 +2208,8 @@ export class Circle extends ShapeBase {
export
{};
export
class
StackContainer
extends
Container
{
constructor
();
private
_mutex
;
constructor
(
mutex
?:
boolean
);
push
(
view
:
DisplayObject
,
options
?:
any
,
dispatch
?:
boolean
):
void
;
replace
(
view
:
DisplayObject
,
options
?:
any
):
void
;
pop
():
boolean
;
...
...
@@ -2233,4 +2239,6 @@ export function arrayFind(arr: any, callback: any): any;
export
function
objClone
(
obj
:
any
):
any
;
export
function
propertyParse
(
key
:
any
,
node
:
any
,
properties
:
any
):
void
;
export
function
getDataByPath
(
scope
:
any
,
path
:
any
,
throwException
?:
any
):
any
;
}
src/base/compare/index.ts
View file @
37f1295c
...
...
@@ -2,12 +2,10 @@
* Created by rockyl on 2019-11-16.
*/
let
leftValue
=
typeof
props
.
left
===
'object'
?
args
[
props
.
left
.
path
]
:
props
.
left
;
let
rightValue
=
typeof
props
.
right
===
'object'
?
args
[
props
.
right
.
path
]
:
props
.
right
;
let
operator
=
args
?
args
.
operator
:
props
.
operator
;
if
(
operator
.
length
===
2
&&
operator
[
operator
.
length
-
1
]
===
'='
){
let
operator
=
(
args
?
args
.
operator
:
props
.
operator
)
||
'=='
;
if
(
operator
===
'=='
||
operator
===
'!='
){
operator
+=
'='
;
}
let
func
=
new
Function
(
'return '
+
leftValue
+
operator
+
rightValue
);
let
func
=
new
Function
(
'return '
+
props
.
left
+
operator
+
props
.
right
);
let
result
=
func
();
next
(
result
?
'
equal'
:
'unequal
'
);
next
(
result
?
'
true'
:
'false
'
);
src/base/compare/meta.json
View file @
37f1295c
...
...
@@ -10,6 +10,6 @@
"default"
:
"=="
}
},
"output"
:
[
"
equal"
,
"unequal
"
"
true"
,
"false
"
]
}
\ No newline at end of file
src/net/http-polling-judge/index.ts
0 → 100644
View file @
37f1295c
/**
* Created by rockyl on 2019-11-16.
*/
const
{
count
,
field
,
successValues
}
=
props
;
const
key
=
'counting-'
+
vm
.
id
;
let
counting
=
global
[
key
]
||
0
;
counting
++
;
let
successArr
=
successValues
.
split
(
','
);
if
(
successArr
.
indexOf
(
args
[
field
])
>=
0
)
{
delete
global
[
key
];
next
(
'success'
);
}
else
if
(
counting
<
count
)
{
global
[
key
]
=
counting
;
next
(
'continue'
);
}
else
{
delete
global
[
key
];
next
(
'timeout'
);
}
src/net/http-polling-judge/meta.json
0 → 100644
View file @
37f1295c
{
"script"
:
""
,
"props"
:
{
"count"
:
{
"type"
:
"number"
,
"default"
:
5
,
"alias"
:
"次数"
},
"field"
:
{
"type"
:
"string"
,
"alias"
:
"字段名"
,
"default"
:
"status"
},
"successArr"
:
{
"type"
:
"string"
,
"alias"
:
"成功值"
}
},
"name"
:
"轮询判断"
,
"output"
:
[
"success"
,
"continue"
,
"timeout"
]
}
\ No newline at end of file
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