clickgo 3.0.0-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +75 -0
- package/dist/app/demo/config.json +106 -0
- package/dist/app/demo/form/control/block/block.css +1 -0
- package/dist/app/demo/form/control/block/block.scss +17 -0
- package/dist/app/demo/form/control/block/block.xml +7 -0
- package/dist/app/demo/form/control/button/button.css +1 -0
- package/dist/app/demo/form/control/button/button.js +27 -0
- package/dist/app/demo/form/control/button/button.scss +18 -0
- package/dist/app/demo/form/control/button/button.xml +126 -0
- package/dist/app/demo/form/control/check/check.js +12 -0
- package/dist/app/demo/form/control/check/check.xml +13 -0
- package/dist/app/demo/form/control/dialog/dialog.js +8 -0
- package/dist/app/demo/form/control/dialog/dialog.xml +26 -0
- package/dist/app/demo/form/control/file/file.js +23 -0
- package/dist/app/demo/form/control/file/file.xml +25 -0
- package/dist/app/demo/form/control/form/form.css +1 -0
- package/dist/app/demo/form/control/form/form.js +38 -0
- package/dist/app/demo/form/control/form/form.scss +9 -0
- package/dist/app/demo/form/control/form/form.xml +28 -0
- package/dist/app/demo/form/control/greatview/greatview.css +1 -0
- package/dist/app/demo/form/control/greatview/greatview.js +92 -0
- package/dist/app/demo/form/control/greatview/greatview.scss +22 -0
- package/dist/app/demo/form/control/greatview/greatview.xml +89 -0
- package/dist/app/demo/form/control/img/img.xml +16 -0
- package/dist/app/demo/form/control/label/label.xml +11 -0
- package/dist/app/demo/form/control/list/list.css +1 -0
- package/dist/app/demo/form/control/list/list.js +194 -0
- package/dist/app/demo/form/control/list/list.scss +7 -0
- package/dist/app/demo/form/control/list/list.xml +91 -0
- package/dist/app/demo/form/control/loading/loading.xml +8 -0
- package/dist/app/demo/form/control/marquee/marquee.js +30 -0
- package/dist/app/demo/form/control/marquee/marquee.xml +36 -0
- package/dist/app/demo/form/control/menu/menu.js +8 -0
- package/dist/app/demo/form/control/menu/menu.xml +122 -0
- package/dist/app/demo/form/control/monaco/monaco.js +113 -0
- package/dist/app/demo/form/control/monaco/monaco.xml +27 -0
- package/dist/app/demo/form/control/overflow/overflow.css +1 -0
- package/dist/app/demo/form/control/overflow/overflow.js +70 -0
- package/dist/app/demo/form/control/overflow/overflow.scss +18 -0
- package/dist/app/demo/form/control/overflow/overflow.xml +98 -0
- package/dist/app/demo/form/control/property/property.js +129 -0
- package/dist/app/demo/form/control/property/property.xml +6 -0
- package/dist/app/demo/form/control/radio/radio.js +7 -0
- package/dist/app/demo/form/control/radio/radio.xml +12 -0
- package/dist/app/demo/form/control/scroll/scroll.js +14 -0
- package/dist/app/demo/form/control/scroll/scroll.xml +35 -0
- package/dist/app/demo/form/control/select/select.js +91 -0
- package/dist/app/demo/form/control/select/select.xml +74 -0
- package/dist/app/demo/form/control/tab/tab.js +75 -0
- package/dist/app/demo/form/control/tab/tab.xml +22 -0
- package/dist/app/demo/form/control/text/text.js +53 -0
- package/dist/app/demo/form/control/text/text.xml +37 -0
- package/dist/app/demo/form/control/view/view.css +1 -0
- package/dist/app/demo/form/control/view/view.js +73 -0
- package/dist/app/demo/form/control/view/view.scss +18 -0
- package/dist/app/demo/form/control/view/view.xml +94 -0
- package/dist/app/demo/form/event/form/form.css +1 -0
- package/dist/app/demo/form/event/form/form.js +129 -0
- package/dist/app/demo/form/event/form/form.scss +24 -0
- package/dist/app/demo/form/event/form/form.xml +16 -0
- package/dist/app/demo/form/event/screen/screen.js +51 -0
- package/dist/app/demo/form/event/screen/screen.xml +9 -0
- package/dist/app/demo/form/event/task/task.js +78 -0
- package/dist/app/demo/form/event/task/task.xml +20 -0
- package/dist/app/demo/form/main.css +1 -0
- package/dist/app/demo/form/main.js +25 -0
- package/dist/app/demo/form/main.scss +9 -0
- package/dist/app/demo/form/main.xml +49 -0
- package/dist/app/demo/form/method/core/core.js +25 -0
- package/dist/app/demo/form/method/core/core.xml +7 -0
- package/dist/app/demo/form/method/dom/dom.css +1 -0
- package/dist/app/demo/form/method/dom/dom.js +163 -0
- package/dist/app/demo/form/method/dom/dom.scss +10 -0
- package/dist/app/demo/form/method/dom/dom.xml +55 -0
- package/dist/app/demo/form/method/form/form.css +1 -0
- package/dist/app/demo/form/method/form/form.js +217 -0
- package/dist/app/demo/form/method/form/form.scss +3 -0
- package/dist/app/demo/form/method/form/form.xml +56 -0
- package/dist/app/demo/form/method/form/test.xml +5 -0
- package/dist/app/demo/form/method/fs/fs.js +88 -0
- package/dist/app/demo/form/method/fs/fs.xml +8 -0
- package/dist/app/demo/form/method/fs/text.js +15 -0
- package/dist/app/demo/form/method/fs/text.xml +3 -0
- package/dist/app/demo/form/method/task/locale1.json +3 -0
- package/dist/app/demo/form/method/task/locale2.json +3 -0
- package/dist/app/demo/form/method/task/task.js +153 -0
- package/dist/app/demo/form/method/task/task.xml +57 -0
- package/dist/app/demo/form/method/theme/theme.js +74 -0
- package/dist/app/demo/form/method/theme/theme.xml +9 -0
- package/dist/app/demo/form/method/tool/tool.js +64 -0
- package/dist/app/demo/form/method/tool/tool.xml +26 -0
- package/dist/app/demo/form/method/zip/zip.js +99 -0
- package/dist/app/demo/form/method/zip/zip.xml +12 -0
- package/dist/app/demo/global.css +3 -0
- package/dist/app/demo/res/icon.svg +1 -0
- package/dist/app/demo/res/img.jpg +0 -0
- package/dist/app/demo/res/r-1.svg +1 -0
- package/dist/app/demo/res/r-2.svg +1 -0
- package/dist/app/demo/res/sql.svg +1 -0
- package/dist/app/demo/res/txt.svg +1 -0
- package/dist/app/demo/res/zip.svg +1 -0
- package/dist/app/task/config.json +29 -0
- package/dist/app/task/form/bar/bar.js +299 -0
- package/dist/app/task/form/bar/bar.xml +47 -0
- package/dist/app/task/form/desktop/desktop.xml +1 -0
- package/dist/app/task/locale/en.json +11 -0
- package/dist/app/task/locale/ja.json +11 -0
- package/dist/app/task/locale/sc.json +11 -0
- package/dist/app/task/locale/tc.json +11 -0
- package/dist/clickgo.js +41 -0
- package/dist/clickgo.ts +51 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -0
- package/dist/icon.png +0 -0
- package/dist/index.js +88 -0
- package/dist/index.ts +92 -0
- package/dist/lib/control.js +365 -0
- package/dist/lib/control.ts +428 -0
- package/dist/lib/core.js +668 -0
- package/dist/lib/core.ts +732 -0
- package/dist/lib/dom.js +1471 -0
- package/dist/lib/dom.ts +1785 -0
- package/dist/lib/form.js +2101 -0
- package/dist/lib/form.ts +2496 -0
- package/dist/lib/fs.js +849 -0
- package/dist/lib/fs.ts +995 -0
- package/dist/lib/native.js +138 -0
- package/dist/lib/native.ts +219 -0
- package/dist/lib/task.js +686 -0
- package/dist/lib/task.ts +842 -0
- package/dist/lib/theme.js +159 -0
- package/dist/lib/theme.ts +196 -0
- package/dist/lib/tool.js +501 -0
- package/dist/lib/tool.ts +620 -0
- package/dist/lib/zip.js +352 -0
- package/dist/lib/zip.ts +434 -0
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +27 -0
- package/types/dev.d.ts +30 -0
- package/types/index.d.ts +673 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cgInnerReceive = exports.cgInnerGetSends = exports.clearListener = exports.off = exports.once = exports.on = exports.send = exports.getListeners = void 0;
|
|
4
|
+
const clickgo = require("../clickgo");
|
|
5
|
+
let sendId = 0;
|
|
6
|
+
let sendList = [];
|
|
7
|
+
const listeners = {};
|
|
8
|
+
function getListeners() {
|
|
9
|
+
const list = [];
|
|
10
|
+
for (const name in listeners) {
|
|
11
|
+
for (const item of listeners[name]) {
|
|
12
|
+
list.push({
|
|
13
|
+
'id': item.id,
|
|
14
|
+
'name': name,
|
|
15
|
+
'once': item.once,
|
|
16
|
+
'taskId': item.taskId
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return list;
|
|
21
|
+
}
|
|
22
|
+
exports.getListeners = getListeners;
|
|
23
|
+
function send(name, param, handler, taskId) {
|
|
24
|
+
if (!clickgo.getNative()) {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
const id = ++sendId;
|
|
28
|
+
sendList.push({
|
|
29
|
+
'id': id,
|
|
30
|
+
'name': name,
|
|
31
|
+
'param': param
|
|
32
|
+
});
|
|
33
|
+
if (handler) {
|
|
34
|
+
on(name, handler, id, true, taskId);
|
|
35
|
+
}
|
|
36
|
+
return id;
|
|
37
|
+
}
|
|
38
|
+
exports.send = send;
|
|
39
|
+
function on(name, handler, id, once = false, taskId) {
|
|
40
|
+
if (!clickgo.getNative()) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!listeners[name]) {
|
|
44
|
+
listeners[name] = [];
|
|
45
|
+
}
|
|
46
|
+
listeners[name].push({
|
|
47
|
+
'id': id !== null && id !== void 0 ? id : 0,
|
|
48
|
+
'once': once,
|
|
49
|
+
'taskId': taskId,
|
|
50
|
+
'handler': handler
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.on = on;
|
|
54
|
+
function once(name, handler, id, taskId) {
|
|
55
|
+
on(name, handler, id, true, taskId);
|
|
56
|
+
}
|
|
57
|
+
exports.once = once;
|
|
58
|
+
function off(name, handler, taskId) {
|
|
59
|
+
if (!listeners[name]) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
for (let i = 0; i < listeners[name].length; ++i) {
|
|
63
|
+
if (listeners[name][i].handler !== handler) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (taskId && (listeners[name][i].taskId !== taskId)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
listeners[name].splice(i, 1);
|
|
70
|
+
if (listeners[name].length === 0) {
|
|
71
|
+
delete listeners[name];
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
--i;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.off = off;
|
|
78
|
+
function clearListener(taskId) {
|
|
79
|
+
if (!taskId) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
for (const name in listeners) {
|
|
83
|
+
for (let i = 0; i < listeners[name].length; ++i) {
|
|
84
|
+
if (listeners[name][i].taskId !== taskId) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
listeners[name].splice(i, 1);
|
|
88
|
+
if (listeners[name].length === 0) {
|
|
89
|
+
delete listeners[name];
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.clearListener = clearListener;
|
|
96
|
+
function cgInnerGetSends() {
|
|
97
|
+
const json = JSON.stringify(sendList);
|
|
98
|
+
sendList = [];
|
|
99
|
+
return json;
|
|
100
|
+
}
|
|
101
|
+
exports.cgInnerGetSends = cgInnerGetSends;
|
|
102
|
+
function cgInnerReceive(id, name, result) {
|
|
103
|
+
if (!listeners[name]) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
for (let i = 0; i < listeners[name].length; ++i) {
|
|
107
|
+
const item = listeners[name][i];
|
|
108
|
+
if (item.id > 0) {
|
|
109
|
+
if (item.id !== id) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const r = item.handler(result);
|
|
113
|
+
if (r instanceof Promise) {
|
|
114
|
+
r.catch(function (e) {
|
|
115
|
+
console.log(e);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const r = item.handler(result);
|
|
121
|
+
if (r instanceof Promise) {
|
|
122
|
+
r.catch(function (e) {
|
|
123
|
+
console.log(e);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (item.once) {
|
|
128
|
+
listeners[name].splice(i, 1);
|
|
129
|
+
--i;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.cgInnerReceive = cgInnerReceive;
|
|
134
|
+
window.clickGoNative = {
|
|
135
|
+
isReady: true,
|
|
136
|
+
cgInnerGetSends: cgInnerGetSends,
|
|
137
|
+
cgInnerReceive: cgInnerReceive
|
|
138
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2022 Han Guoshuai <zohegs@gmail.com>
|
|
3
|
+
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as clickgo from '../clickgo';
|
|
17
|
+
|
|
18
|
+
let sendId = 0;
|
|
19
|
+
// --- sendList 一定会被清理 ---
|
|
20
|
+
let sendList: Array<{
|
|
21
|
+
'id': number;
|
|
22
|
+
'name': string;
|
|
23
|
+
'param': string | undefined;
|
|
24
|
+
}> = [];
|
|
25
|
+
|
|
26
|
+
/** --- 监听的 listener,需要调用者手动清理(或者 task 结束后自动会被清理,未设置 taskId 的则不会自动清理) --- */
|
|
27
|
+
const listeners: Record<string, Array<{
|
|
28
|
+
'id': number;
|
|
29
|
+
'once': boolean;
|
|
30
|
+
'taskId'?: number;
|
|
31
|
+
'handler': (param?: string) => void | Promise<void>;
|
|
32
|
+
}>> = {};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* --- 获取已经创建的监听列表 ---
|
|
36
|
+
*/
|
|
37
|
+
export function getListeners(): Array<{ 'id': number; 'name': string; 'once': boolean; 'taskId'?: number; }> {
|
|
38
|
+
const list = [];
|
|
39
|
+
for (const name in listeners) {
|
|
40
|
+
for (const item of listeners[name]) {
|
|
41
|
+
list.push({
|
|
42
|
+
'id': item.id,
|
|
43
|
+
'name': name,
|
|
44
|
+
'once': item.once,
|
|
45
|
+
'taskId': item.taskId
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return list;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* --- 向 native 发送指令 ---
|
|
54
|
+
* @param name 指令名
|
|
55
|
+
* @param param 参数
|
|
56
|
+
* @param handler 回调
|
|
57
|
+
* @param taskId 仅在任务活跃时可监听,App 模式下无效
|
|
58
|
+
*/
|
|
59
|
+
export function send(
|
|
60
|
+
name: string,
|
|
61
|
+
param?: string,
|
|
62
|
+
handler?: (param?: string) => void | Promise<void>,
|
|
63
|
+
taskId?: number
|
|
64
|
+
): number {
|
|
65
|
+
if (!clickgo.getNative()) {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
const id = ++sendId;
|
|
69
|
+
sendList.push({
|
|
70
|
+
'id': id,
|
|
71
|
+
'name': name,
|
|
72
|
+
'param': param
|
|
73
|
+
});
|
|
74
|
+
if (handler) {
|
|
75
|
+
on(name, handler, id, true, taskId);
|
|
76
|
+
}
|
|
77
|
+
return id;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* --- 监听 native 传递的指令 ---
|
|
82
|
+
* @param name 指令名
|
|
83
|
+
* @param handler 指令接收回调
|
|
84
|
+
* @param id 可选,监听特定 id 的指令
|
|
85
|
+
* @param once 可选,默认为非一次性监听
|
|
86
|
+
* @param taskId 仅在任务活跃时可监听,App 模式下无效
|
|
87
|
+
*/
|
|
88
|
+
export function on(
|
|
89
|
+
name: string,
|
|
90
|
+
handler: (param?: string) => void | Promise<void>,
|
|
91
|
+
id?: number,
|
|
92
|
+
once: boolean = false,
|
|
93
|
+
taskId?: number
|
|
94
|
+
): void {
|
|
95
|
+
if (!clickgo.getNative()) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (!listeners[name]) {
|
|
99
|
+
listeners[name] = [];
|
|
100
|
+
}
|
|
101
|
+
listeners[name].push({
|
|
102
|
+
'id': id ?? 0,
|
|
103
|
+
'once': once,
|
|
104
|
+
'taskId': taskId,
|
|
105
|
+
'handler': handler
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* --- 监听一次 native 传递的指令 ---
|
|
111
|
+
* @param name 指令名
|
|
112
|
+
* @param handler 指令接收回调
|
|
113
|
+
* @param id 可选,监听特定 id 的指令
|
|
114
|
+
* @param taskId 仅在任务活跃时可监听,App 模式下无效
|
|
115
|
+
*/
|
|
116
|
+
export function once(
|
|
117
|
+
name: string,
|
|
118
|
+
handler: (param?: string) => void | Promise<void>,
|
|
119
|
+
id?: number,
|
|
120
|
+
taskId?: number
|
|
121
|
+
): void {
|
|
122
|
+
on(name, handler, id, true, taskId);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* --- 取消监听 native 指令
|
|
127
|
+
* @param name 指令名
|
|
128
|
+
* @param handler 绑定监听时的回调函数
|
|
129
|
+
* @param taskId 校验 taskId,为空则不校验,但 App 模式下无效
|
|
130
|
+
*/
|
|
131
|
+
export function off(name: string, handler: (param?: string) => void | Promise<void>, taskId?: number): void {
|
|
132
|
+
if (!listeners[name]) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
for (let i = 0; i < listeners[name].length; ++i) {
|
|
136
|
+
if (listeners[name][i].handler !== handler) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (taskId && (listeners[name][i].taskId !== taskId)) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
listeners[name].splice(i, 1);
|
|
143
|
+
if (listeners[name].length === 0) {
|
|
144
|
+
delete listeners[name];
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
--i;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* --- 清除某个 task 当中的全部本地监听 ---
|
|
153
|
+
* @param taskId 要清除的 task id,App 模式下无效
|
|
154
|
+
*/
|
|
155
|
+
export function clearListener(taskId?: number): void {
|
|
156
|
+
if (!taskId) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
for (const name in listeners) {
|
|
160
|
+
for (let i = 0; i < listeners[name].length; ++i) {
|
|
161
|
+
if (listeners[name][i].taskId !== taskId) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
listeners[name].splice(i, 1);
|
|
165
|
+
if (listeners[name].length === 0) {
|
|
166
|
+
delete listeners[name];
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// --- 以下为供 native 调用的内部函数 ---
|
|
174
|
+
|
|
175
|
+
// --- 将 send 值全部提交给 native ---
|
|
176
|
+
export function cgInnerGetSends(): string {
|
|
177
|
+
const json = JSON.stringify(sendList);
|
|
178
|
+
sendList = [];
|
|
179
|
+
return json;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// --- 供 native 调用的回调数据(执行结果) ---
|
|
183
|
+
export function cgInnerReceive(id: number, name: string, result?: string): void {
|
|
184
|
+
if (!listeners[name]) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
for (let i = 0; i < listeners[name].length; ++i) {
|
|
188
|
+
const item = listeners[name][i];
|
|
189
|
+
if (item.id > 0) {
|
|
190
|
+
if (item.id !== id) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const r = item.handler(result);
|
|
194
|
+
if (r instanceof Promise) {
|
|
195
|
+
r.catch(function(e) {
|
|
196
|
+
console.log(e);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
const r = item.handler(result);
|
|
202
|
+
if (r instanceof Promise) {
|
|
203
|
+
r.catch(function(e) {
|
|
204
|
+
console.log(e);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (item.once) {
|
|
209
|
+
listeners[name].splice(i, 1);
|
|
210
|
+
--i;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
(window as any).clickGoNative = {
|
|
216
|
+
isReady: true,
|
|
217
|
+
cgInnerGetSends: cgInnerGetSends,
|
|
218
|
+
cgInnerReceive: cgInnerReceive
|
|
219
|
+
};
|