aoye 0.0.1 → 0.0.2
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 +40 -76
- package/dist/aoye.cjs.js +854 -696
- package/dist/aoye.esm.js +854 -697
- package/dist/aoye.umd.js +491 -331
- package/dist/shared/event.d.ts +72 -0
- package/dist/signal/src/global.d.ts +4 -0
- package/dist/signal/src/index.d.ts +1 -0
- package/dist/signal/src/schedule.d.ts +1 -1
- package/dist/signal/src/scope.d.ts +3 -1
- package/dist/signal/src/util.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type Func = (...args: any[]) => any;
|
|
2
|
+
export declare const timestamp: any;
|
|
3
|
+
export declare enum EventMode {
|
|
4
|
+
Immediate = 0,
|
|
5
|
+
Queue = 1
|
|
6
|
+
}
|
|
7
|
+
export declare enum ProcessStatus {
|
|
8
|
+
None = 0,
|
|
9
|
+
Processing = 1,
|
|
10
|
+
Paused = 2
|
|
11
|
+
}
|
|
12
|
+
declare const DefaultEventOpt: {
|
|
13
|
+
mode: EventMode;
|
|
14
|
+
};
|
|
15
|
+
export type IEventOpt = Partial<typeof DefaultEventOpt>;
|
|
16
|
+
export type IScheduler = (doCall: Func, ...args: any[]) => void;
|
|
17
|
+
export type IGlobalScheduler = (goOn: () => void) => void;
|
|
18
|
+
export type ISetScheduler = {
|
|
19
|
+
(type: string, scheduler: IScheduler): void;
|
|
20
|
+
(scheduler: IGlobalScheduler): void;
|
|
21
|
+
};
|
|
22
|
+
export type IEventItem = {
|
|
23
|
+
type: string;
|
|
24
|
+
args: any[];
|
|
25
|
+
time: number;
|
|
26
|
+
};
|
|
27
|
+
export declare class BaseEvent {
|
|
28
|
+
private opt;
|
|
29
|
+
static a: number;
|
|
30
|
+
constructor(opt?: IEventOpt);
|
|
31
|
+
scheduler?: IGlobalScheduler;
|
|
32
|
+
eventQueue: IEventItem[];
|
|
33
|
+
status: ProcessStatus;
|
|
34
|
+
subMap: Map<string, Set<Func>>;
|
|
35
|
+
on: (type: string | undefined, fn: Func) => void;
|
|
36
|
+
off: (type: string | undefined, fn: Func) => void;
|
|
37
|
+
once: (type: string | undefined, fn: Func) => void;
|
|
38
|
+
promiseOnce: (type: string | undefined) => Promise<unknown>;
|
|
39
|
+
setScheduler: ISetScheduler;
|
|
40
|
+
callSub(it: Func, fns: any, args: any): void;
|
|
41
|
+
emit: (type: string, ...args: any[]) => void;
|
|
42
|
+
emitImmediate(type: string, ...args: any[]): void;
|
|
43
|
+
emitQueue(type: string, ...args: any[]): void;
|
|
44
|
+
pause: () => ProcessStatus;
|
|
45
|
+
unPause: () => ProcessStatus;
|
|
46
|
+
start: () => void;
|
|
47
|
+
process: () => void;
|
|
48
|
+
recallScheduler: () => void;
|
|
49
|
+
processQueue: () => void;
|
|
50
|
+
dispatchEvent: (iList: number[]) => void;
|
|
51
|
+
clear: () => void;
|
|
52
|
+
}
|
|
53
|
+
export declare class EventNode extends BaseEvent {
|
|
54
|
+
constructor();
|
|
55
|
+
pipe: (type: string, ...fns: (Func | PipeNode)[]) => PipeNode;
|
|
56
|
+
buildPip: (fns: (Func | PipeNode)[]) => {
|
|
57
|
+
firstNode: PipeNode;
|
|
58
|
+
lastNode: PipeNode;
|
|
59
|
+
};
|
|
60
|
+
preProcessMap: Map<string, [PipeNode, PipeNode]>;
|
|
61
|
+
preProcess: (type: string, ...fns: (Func | PipeNode)[]) => void;
|
|
62
|
+
emit: (type: string, ...args: any[]) => void;
|
|
63
|
+
from(type: string, promise?: Promise<any>): (...args: any[]) => void;
|
|
64
|
+
}
|
|
65
|
+
export declare class PipeNode extends BaseEvent {
|
|
66
|
+
pipList: Func[];
|
|
67
|
+
onFinish: (fn: Func) => void;
|
|
68
|
+
isLastNode: boolean;
|
|
69
|
+
markLast: () => boolean;
|
|
70
|
+
constructor();
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { SortMap } from '../../shared/util';
|
|
2
2
|
import type { Signal } from './signal';
|
|
3
|
+
import { BaseEvent as Event } from '../../shared/event';
|
|
4
|
+
export declare const evt: Event;
|
|
3
5
|
export declare const G: {
|
|
4
6
|
/** 原子 signal 更新次数 */
|
|
5
7
|
version: number;
|
|
@@ -11,6 +13,7 @@ export declare const dirtyLeafs: SortMap<Signal<any>>;
|
|
|
11
13
|
export declare enum State {
|
|
12
14
|
Clean = 0,
|
|
13
15
|
/** 仅用于 scope 节点是否 abort */
|
|
16
|
+
ScopeAborted = 64,
|
|
14
17
|
ScopeAbort = 32,
|
|
15
18
|
OutLink = 16,
|
|
16
19
|
Unknown = 8,
|
|
@@ -19,3 +22,4 @@ export declare enum State {
|
|
|
19
22
|
ScopeReady = 1
|
|
20
23
|
}
|
|
21
24
|
export declare const DirtyState: number;
|
|
25
|
+
export declare const ScopeExecuted: number;
|
|
@@ -2,6 +2,7 @@ import { Scheduler } from './schedule';
|
|
|
2
2
|
import { Signal } from './signal';
|
|
3
3
|
import { Getter, Mix } from './type';
|
|
4
4
|
export { Scheduler, scheduler } from './schedule';
|
|
5
|
+
export { TaskQueue } from './task';
|
|
5
6
|
export * from './type';
|
|
6
7
|
declare const DefaultCustomSignalOpt: {
|
|
7
8
|
scheduler: Scheduler;
|
|
@@ -5,9 +5,11 @@ import { TaskQueue } from './task';
|
|
|
5
5
|
export declare const unTrackIsland: (signal: Signal) => void;
|
|
6
6
|
/** scope 释放,被重新连接的孤岛 */
|
|
7
7
|
export declare const trackIsland: (signal: Signal) => void;
|
|
8
|
+
/** 子 scope 释放,把其 only 被其持有的 signal 挂回其属于的 scope */
|
|
9
|
+
export declare const trackByOtherScopeDispose: (signal: Signal) => void;
|
|
8
10
|
export declare const markOutLink: (signal: Signal, downstream: Signal) => void;
|
|
9
11
|
export declare const ideScheduler: TaskQueue<import("./type").Task & {
|
|
10
12
|
index: number;
|
|
11
13
|
}>;
|
|
12
|
-
export declare function handleOneTask(
|
|
14
|
+
export declare function handleOneTask(scope: Signal, breakStack: Line[]): boolean;
|
|
13
15
|
export declare function unlinkRecWithScope(line: Line): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aoye",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"main": "dist/aoye.cjs.js",
|
|
5
5
|
"module": "dist/aoye.esm.js",
|
|
6
6
|
"browser": "dist/aoye.umd.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"pub": "node scripts/publish.js",
|
|
13
13
|
"dev": "rollup -c -w",
|
|
14
14
|
"t": "jest",
|
|
15
|
-
"tw": "jest --coverage --watch
|
|
15
|
+
"tw": "jest --coverage --watch"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|