Event


RegEvent

Event Register.

注解

Use id or uid for object reference

Parameters
Name Required Default Description
id No   Object id
uid No   Object uid(UserID)
condition No   Trigger condition
event Yes   Trigger event, to avoid conflict, use / to separate callbacks, for instance, AddToSelection/callBack1 see Event List
priority No 50 Event with higher priority will be trigger first
cmds Yes   Callback commands

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
    "cmd": "RegEvent",

    //"_default_" means always trigger
    //"condition": "_default_",

    //register by object id or uid
    //"condition": {"OBJECT":"4"},

    //register by classId
    //"condition": {"CLASSID":3},

    //register by object properties
    //"condition": {"ATTRIBUTE":{"PropertyDict/sex":"male"}},

    //AND operator
    //"condition": {"AND":[{"PropertyDict/sex":"male"}, {"MoniterData/RealTimeData/status":"normal"}]},

    //OR operator
    //"condition": {"OR":[{"PropertyDict/sex":"male"}, {"MoniterData/RealTimeData/status":"normal"}]},

    //NOT operator
    //"condition": {"NOT":{"AND":[{"PropertyDict/sex":"male"}, {"MoniterData/RealTimeData/status":"normal"}]}},

    //////////////////////////
    //condition shortcuts
    //a number,same as {"CLASSID":3}
    //"condition": 3,

    //a string, means id or uid,same as {"OBJECT":"4"}
    //"condition": "4",

    //a key/value pair,means object properties, same as {"ATTRIBUTE":{"PropertyDict/sex":"male"}}
    "condition": {"PropertyDict/sex":"male"},


    "event":"AddToSelection/callBack1",
    "priority":50,
    "cmds":[
        {    "cmd":"GetLastEventObj",  "toBuffer":{"ObjectManager":"RunBuffer/lastEventObj"} } ,
        {    "cmd":"ChangePlacementBundle",  "fromBuffer":{"ObjectManager":"RunBuffer/lastEventObj"} , "bundleId":"F933B1A524B94050BC7A82B15D2057F5"}
    ]
}

UnregEvent

Unregister Event.

Parameters
Name Required Description
id No Object id
uid No Object uid(UserID)
condition No Trigger condition
event Yes

Same as event parameter in RegEvent

注解

if no callback is specified, all callbacks under this event will be unregistered.

Example

1
2
3
4
5
6
7
{
    "cmd": "UnregEvent",
    "condition":{
        "PropertyDict/sex":"male"
    },
    "event":"AddToSelection/callBack1"
}

GetLastEventObj

Get object associated with event and save to buffer.

Parameters
Name Required Description
toBuffer Yes

Target buffer

注解

object is save to {'ObjectManager':'RunBuffer/lastEventObj'} by system automatically

Example

1
2
3
4
5
6
{
    "cmd":"GetLastEventObj",
    "toBuffer":{
        "ObjectManager":"RunBuffer/lastEventObj"
    }
}

RegIgnoreEvent

Suppress events.

Parameters
Name Required Description
condition Yes Same as condition parameter in RegEvent
event Yes

Same as event parameter in RegEvent

注解

if no callback is specified, all callbacks under this event will be suppressed.

Example

1
2
3
4
5
{
    "cmd": "RegIgnoreEvent",
    "condition":"_default_", //suppress all AddToSelection events
    "event":"AddToSelection"
}

UnregIgnoreEvent

Resume suppress events.

Parameters
Name Required Description
condition Yes Same as condition parameter in RegEvent
event Yes

Same as event parameter in RegEvent

注解

if no callback is specified, all callbacks under this event will be suppressed.

Example

1
2
3
4
5
{
    "cmd": "UnregIgnoreEvent",
    "condition":"_default_",
    "event":"AddToSelection"
}