Skip to main content
Version: 3.3

BindEvent 元素绑定事件

1. 结构声明

class BindEvent extends BaseNode {
name: string = '';
logics: Array<Logic>;
calleeNamespace?: string;
calleeName?: string;
arguments?: Array<Argument>;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "BindEvent",
"name": "click",
"logics": [
{
"concept": "Logic",
"name": "click",
"params": [],
"returns": [],
"variables": [],
"body": [
{
"concept": "Start",
"label": "开始"
},
{
"uuid": "bc414eb6611e417c92a25ca5c125a2ed",
"concept": "CallLogic",
"label": "调用逻辑",
"calleeNamespace": "elements.modal_1.logics",
"calleeName": "close",
"arguments": []
},
{
"concept": "End",
"label": "结束"
}
],
"playground": []
}
],
"arguments": []
}

(2) 绑定多个事件逻辑

AST 如下:

{
"concept": "BindEvent",
"name": "click",
"logics": [
{
"concept": "Logic",
"name": "click",
"params": [],
"returns": [],
"variables": [],
"body": [
{
"concept": "Start",
"label": "开始"
},
{
"uuid": "0550e0f6863a4d849ee643d16336e420",
"concept": "CallLogic",
"label": "弹出消息",
"calleeNamespace": "nasl.ui",
"calleeName": "showMessage",
"shortcut": true,
"arguments": [
{
"concept": "Argument",
"keyword": "text",
"expression": {
"concept": "StringLiteral",
"value": "点击了“创 建”按钮"
}
}
]
},
{
"concept": "End",
"label": "结束"
}
],
"playground": []
},
{
"concept": "Logic",
"name": "create",
"params": [],
"returns": [],
"variables": [],
"body": [
{
"concept": "Start",
"label": "开始"
},
{
"concept": "Assignment",
"label": "赋值",
"left": {
"concept": "Identifier",
"namespace": "",
"name": "input"
},
"right": {
"concept": "CallFunction",
"label": "调用逻辑",
"calleeNamespace": "nasl.util",
"calleeName": "Clone",
"arguments": [
{
"concept": "Argument",
"keyword": "obj",
"expression": {
"concept": "Identifier",
"namespace": "",
"name": "student"
}
}
]
}
},
{
"uuid": "43a14fc183ed4b1bab03a839ea7fce9f",
"concept": "CallLogic",
"label": "调用逻辑",
"calleeNamespace": "elements.saveModal_1.logics",
"calleeName": "open",
"arguments": []
},
{
"concept": "End",
"label": "结束"
}
],
"playground": []
}
]
}