alemonjs 2.0.8 → 2.0.9
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/README.md +16 -16
- package/lib/app/code.d.ts +9 -9
- package/lib/app/code.js +14 -14
- package/lib/app/event-middleware.js +1 -1
- package/lib/app/event-processor-cycle.js +1 -1
- package/lib/code.d.ts +1 -1
- package/package.json +1 -1
- package/tsconfig.json +0 -7
package/README.md
CHANGED
|
@@ -8,26 +8,26 @@ yarn add alemonjs @alemonjs/gui -W
|
|
|
8
8
|
|
|
9
9
|
- 启动
|
|
10
10
|
|
|
11
|
-
> src/index.
|
|
11
|
+
> src/index.js
|
|
12
12
|
|
|
13
|
-
```
|
|
13
|
+
```js
|
|
14
14
|
import { start } from 'alemonjs'
|
|
15
|
-
start('src/index.
|
|
15
|
+
start('src/index.js')
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
- 响应
|
|
19
19
|
|
|
20
|
-
> src/
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
import { Text, useSend } from 'alemonjs'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
> src/response/res.js
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { createSelects, onResponse, Text, useSend } from 'alemonjs'
|
|
24
|
+
// 创建事件类型
|
|
25
|
+
export const selects = createSelects(['message.create'])
|
|
26
|
+
// 导出响应
|
|
27
|
+
export default onResponse(selects, event => {
|
|
28
|
+
// 使用发送函数
|
|
29
|
+
const send = useSend(event)
|
|
30
|
+
// 发送文本
|
|
31
|
+
send(Text('Hello Word!'))
|
|
32
|
+
})
|
|
31
33
|
```
|
|
32
|
-
|
|
33
|
-
[配置编辑器](./bin/README.md)
|
package/lib/app/code.d.ts
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* - 4002: 权限不足
|
|
11
11
|
*/
|
|
12
12
|
declare const ResultCode: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
type ResultCode = typeof ResultCode[keyof typeof ResultCode]
|
|
13
|
+
readonly Ok: 2000
|
|
14
|
+
readonly Fail: 4000
|
|
15
|
+
readonly FailParams: 4001
|
|
16
|
+
readonly Warn: 2100
|
|
17
|
+
readonly FailAuth: 4002
|
|
18
|
+
readonly FailInternal: 5000
|
|
19
|
+
}
|
|
20
|
+
type ResultCode = (typeof ResultCode)[keyof typeof ResultCode]
|
|
21
21
|
|
|
22
|
-
export { ResultCode }
|
|
22
|
+
export { ResultCode }
|
package/lib/app/code.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* 结果反馈码
|
|
3
3
|
*/
|
|
4
4
|
// 成功码
|
|
5
|
-
const Ok = 2000
|
|
5
|
+
const Ok = 2000 // 成功
|
|
6
6
|
// 警惕码
|
|
7
|
-
const Warn = 2100
|
|
7
|
+
const Warn = 2100 // 任意警告
|
|
8
8
|
// 失败码
|
|
9
|
-
const Fail = 4000
|
|
10
|
-
const FailParams = 4001
|
|
9
|
+
const Fail = 4000 // 未知错误
|
|
10
|
+
const FailParams = 4001 // 参数错误
|
|
11
11
|
// 权限错误
|
|
12
|
-
const FailAuth = 4002
|
|
12
|
+
const FailAuth = 4002 // 权限不足
|
|
13
13
|
// 内部错误
|
|
14
|
-
const FailInternal = 5000
|
|
14
|
+
const FailInternal = 5000 // 内部错误
|
|
15
15
|
/**
|
|
16
16
|
* 结果反馈码
|
|
17
17
|
* @description
|
|
@@ -21,12 +21,12 @@ const FailInternal = 5000; // 内部错误
|
|
|
21
21
|
* - 4002: 权限不足
|
|
22
22
|
*/
|
|
23
23
|
const ResultCode = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
24
|
+
Ok,
|
|
25
|
+
Fail,
|
|
26
|
+
FailParams,
|
|
27
|
+
Warn,
|
|
28
|
+
FailAuth,
|
|
29
|
+
FailInternal
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
export { ResultCode }
|
|
32
|
+
export { ResultCode }
|
|
@@ -39,7 +39,7 @@ const OnMiddleware = (callback, select) => {
|
|
|
39
39
|
message: 'OnMiddleware is deprecated, please use onMiddleware',
|
|
40
40
|
data: null
|
|
41
41
|
});
|
|
42
|
-
return
|
|
42
|
+
return { select, current: callback };
|
|
43
43
|
};
|
|
44
44
|
global.OnMiddleware = OnMiddleware;
|
|
45
45
|
|
|
@@ -10,7 +10,7 @@ import { expendSubscribeCreate, expendSubscribeMount, expendSubscribeUnmount } f
|
|
|
10
10
|
*/
|
|
11
11
|
const showLog = (event, select) => {
|
|
12
12
|
const log = {
|
|
13
|
-
|
|
13
|
+
Name: select
|
|
14
14
|
};
|
|
15
15
|
if (typeof event['ChannelId'] == 'string' && event['ChannelId'] != '') {
|
|
16
16
|
log['ChannelId'] = event['ChannelId'];
|
package/lib/code.d.ts
CHANGED
package/package.json
CHANGED