@antv/g 5.0.23-alpha.9 → 5.0.23
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/dist/index.umd.min.js +3 -3
- package/es/components/Geometry.d.ts +4 -0
- package/es/css/CSS.js +1 -1
- package/es/css/CSSProperty.d.ts +1 -1
- package/es/css/StyleValueRegistry.d.ts +2 -1
- package/es/css/StyleValueRegistry.js +43 -21
- package/es/css/cssom/CSSNumericValue.js +1 -1
- package/es/css/index.d.ts +1 -0
- package/es/css/index.js +1 -0
- package/es/css/interfaces.d.ts +6 -0
- package/es/css/interfaces.js +2 -0
- package/es/css/properties/CSSPropertyColor.d.ts +1 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/es/display-objects/DisplayObject.d.ts +1 -2
- package/es/display-objects/DisplayObject.js +2 -1
- package/es/dom/Document.js +2 -2
- package/es/global-module.js +4 -7
- package/es/plugins/CullingPlugin.d.ts +1 -0
- package/es/plugins/CullingPlugin.js +8 -3
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/es/plugins/DirtyCheckPlugin.js +7 -2
- package/es/plugins/EventPlugin.d.ts +1 -0
- package/es/plugins/EventPlugin.js +14 -9
- package/es/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/es/plugins/PrepareRendererPlugin.js +10 -5
- package/es/services/EventService.js +4 -8
- package/es/services/RenderingService.d.ts +17 -17
- package/es/services/RenderingService.js +25 -22
- package/es/services/SceneGraphService.js +3 -1
- package/es/types.d.ts +6 -1
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +1 -2
- package/es/utils/interpolation.js +1 -1
- package/lib/components/Geometry.d.ts +4 -0
- package/lib/css/CSS.js +2 -2
- package/lib/css/CSSProperty.d.ts +1 -1
- package/lib/css/StyleValueRegistry.d.ts +2 -1
- package/lib/css/StyleValueRegistry.js +50 -24
- package/lib/css/cssom/CSSNumericValue.js +17 -17
- package/lib/css/index.d.ts +1 -0
- package/lib/css/index.js +13 -0
- package/lib/css/interfaces.d.ts +6 -0
- package/lib/css/interfaces.js +12 -0
- package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
- package/lib/display-objects/DisplayObject.d.ts +1 -2
- package/lib/display-objects/DisplayObject.js +3 -2
- package/lib/dom/Document.js +2 -2
- package/lib/global-module.js +2 -5
- package/lib/plugins/CullingPlugin.d.ts +1 -0
- package/lib/plugins/CullingPlugin.js +7 -3
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -0
- package/lib/plugins/DirtyCheckPlugin.js +6 -2
- package/lib/plugins/EventPlugin.d.ts +1 -0
- package/lib/plugins/EventPlugin.js +13 -9
- package/lib/plugins/PrepareRendererPlugin.d.ts +1 -0
- package/lib/plugins/PrepareRendererPlugin.js +9 -5
- package/lib/services/EventService.js +4 -8
- package/lib/services/RenderingService.d.ts +17 -17
- package/lib/services/RenderingService.js +25 -22
- package/lib/services/SceneGraphService.js +3 -1
- package/lib/types.d.ts +6 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -13
- package/lib/utils/interpolation.js +2 -2
- package/package.json +4 -3
- package/es/utils/hooks.d.ts +0 -280
- package/es/utils/hooks.js +0 -753
- package/lib/utils/hooks.d.ts +0 -280
- package/lib/utils/hooks.js +0 -759
|
@@ -9,9 +9,9 @@ var _tslib = require("tslib");
|
|
|
9
9
|
|
|
10
10
|
var _manaSyringe = require("mana-syringe");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _tapable = require("tapable");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _interfaces = require("../css/interfaces");
|
|
15
15
|
|
|
16
16
|
var _dom = require("../dom");
|
|
17
17
|
|
|
@@ -19,6 +19,7 @@ var _RenderingContext = require("./RenderingContext");
|
|
|
19
19
|
|
|
20
20
|
var _SceneGraphService = require("./SceneGraphService");
|
|
21
21
|
|
|
22
|
+
// import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
|
|
22
23
|
var RenderingPluginContribution = _manaSyringe.Syringe.defineToken('RenderingPluginContribution');
|
|
23
24
|
/**
|
|
24
25
|
* Use frame renderer implemented by `g-canvas/svg/webgl`, in every frame we do followings:
|
|
@@ -59,55 +60,55 @@ function () {
|
|
|
59
60
|
/**
|
|
60
61
|
* called before any frame rendered
|
|
61
62
|
*/
|
|
62
|
-
init: new
|
|
63
|
+
init: new _tapable.AsyncParallelHook(),
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
* only dirty object which has sth changed will be rendered
|
|
66
67
|
*/
|
|
67
|
-
dirtycheck: new
|
|
68
|
+
dirtycheck: new _tapable.SyncWaterfallHook(['object']),
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
71
|
* do culling
|
|
71
72
|
*/
|
|
72
|
-
cull: new
|
|
73
|
+
cull: new _tapable.SyncWaterfallHook(['object']),
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
76
|
* called at beginning of each frame, won't get called if nothing to re-render
|
|
76
77
|
*/
|
|
77
|
-
beginFrame: new
|
|
78
|
+
beginFrame: new _tapable.SyncHook([]),
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
81
|
* called before every dirty object get rendered
|
|
81
82
|
*/
|
|
82
|
-
beforeRender: new
|
|
83
|
+
beforeRender: new _tapable.SyncHook(['objectToRender']),
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
86
|
* called when every dirty object rendering even it's culled
|
|
86
87
|
*/
|
|
87
|
-
render: new
|
|
88
|
+
render: new _tapable.SyncHook(['objectToRender']),
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* called after every dirty object get rendered
|
|
91
92
|
*/
|
|
92
|
-
afterRender: new
|
|
93
|
-
endFrame: new
|
|
94
|
-
destroy: new
|
|
93
|
+
afterRender: new _tapable.SyncHook(['objectToRender']),
|
|
94
|
+
endFrame: new _tapable.SyncHook([]),
|
|
95
|
+
destroy: new _tapable.SyncHook([]),
|
|
95
96
|
|
|
96
97
|
/**
|
|
97
98
|
* use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
|
|
98
99
|
*/
|
|
99
|
-
pick: new
|
|
100
|
+
pick: new _tapable.AsyncSeriesWaterfallHook(['result']),
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* used in event system
|
|
103
104
|
*/
|
|
104
|
-
pointerDown: new
|
|
105
|
-
pointerUp: new
|
|
106
|
-
pointerMove: new
|
|
107
|
-
pointerOut: new
|
|
108
|
-
pointerOver: new
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
pointerDown: new _tapable.SyncHook(['event']),
|
|
106
|
+
pointerUp: new _tapable.SyncHook(['event']),
|
|
107
|
+
pointerMove: new _tapable.SyncHook(['event']),
|
|
108
|
+
pointerOut: new _tapable.SyncHook(['event']),
|
|
109
|
+
pointerOver: new _tapable.SyncHook(['event']),
|
|
110
|
+
pointerWheel: new _tapable.SyncHook(['event']),
|
|
111
|
+
pointerCancel: new _tapable.SyncHook(['event'])
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
|
|
@@ -123,12 +124,14 @@ function () {
|
|
|
123
124
|
cache: false
|
|
124
125
|
}).forEach(function (plugin) {
|
|
125
126
|
plugin.apply(_this);
|
|
126
|
-
});
|
|
127
|
+
}); // await this.hooks.init.callPromise();
|
|
128
|
+
|
|
127
129
|
return [4
|
|
128
130
|
/*yield*/
|
|
129
|
-
, this.hooks.init.
|
|
131
|
+
, this.hooks.init.promise()];
|
|
130
132
|
|
|
131
133
|
case 1:
|
|
134
|
+
// await this.hooks.init.callPromise();
|
|
132
135
|
_a.sent();
|
|
133
136
|
|
|
134
137
|
this.inited = true;
|
|
@@ -233,7 +236,7 @@ function () {
|
|
|
233
236
|
(0, _tslib.__decorate)([(0, _manaSyringe.contrib)(RenderingPluginContribution), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "renderingPluginProvider", void 0);
|
|
234
237
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_RenderingContext.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "renderingContext", void 0);
|
|
235
238
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_SceneGraphService.SceneGraphService), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
|
|
236
|
-
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(
|
|
239
|
+
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_interfaces.StyleValueRegistry), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "styleValueRegistry", void 0);
|
|
237
240
|
RenderingService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], RenderingService);
|
|
238
241
|
return RenderingService;
|
|
239
242
|
}();
|
|
@@ -854,7 +854,9 @@ function () {
|
|
|
854
854
|
};
|
|
855
855
|
|
|
856
856
|
(0, _tslib.__decorate)([(0, _manaSyringe.inject)(_SceneGraphSelector.SceneGraphSelectorFactory), (0, _tslib.__metadata)("design:type", Function)], DefaultSceneGraphService.prototype, "sceneGraphSelectorFactory", void 0);
|
|
857
|
-
DefaultSceneGraphService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)(
|
|
857
|
+
DefaultSceneGraphService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
|
|
858
|
+
token: SceneGraphService
|
|
859
|
+
})], DefaultSceneGraphService);
|
|
858
860
|
return DefaultSceneGraphService;
|
|
859
861
|
}();
|
|
860
862
|
|
package/lib/types.d.ts
CHANGED
|
@@ -120,6 +120,10 @@ export interface BaseStyleProps {
|
|
|
120
120
|
opacity?: number;
|
|
121
121
|
/** 线宽 */
|
|
122
122
|
lineWidth?: string | number;
|
|
123
|
+
/**
|
|
124
|
+
* increased line width when hitting test
|
|
125
|
+
*/
|
|
126
|
+
increasedLineWidthForHitTesting?: string | number;
|
|
123
127
|
/**
|
|
124
128
|
* 交互区域
|
|
125
129
|
*/
|
|
@@ -158,7 +162,7 @@ export interface BaseStyleProps {
|
|
|
158
162
|
*/
|
|
159
163
|
miterLimit?: number;
|
|
160
164
|
}
|
|
161
|
-
export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x' | 'y' | 'z' | 'opacity' | 'strokeOpacity' | 'fillOpacity' | 'fill' | 'stroke' | 'lineWidth' | 'lineJoin' | 'lineCap' | 'lineDash' | 'lineDashOffset' | 'path' | 'points' | 'shadowColor' | 'shadowBlur' | 'shadowOffsetX' | 'shadowOffsetY' | 'visibility' | 'pointerEvents' | 'zIndex' | 'transformOrigin' | 'textTransform'> {
|
|
165
|
+
export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x' | 'y' | 'z' | 'opacity' | 'strokeOpacity' | 'fillOpacity' | 'fill' | 'stroke' | 'lineWidth' | 'increasedLineWidthForHitTesting' | 'lineJoin' | 'lineCap' | 'lineDash' | 'lineDashOffset' | 'path' | 'points' | 'shadowColor' | 'shadowBlur' | 'shadowOffsetX' | 'shadowOffsetY' | 'visibility' | 'pointerEvents' | 'zIndex' | 'transformOrigin' | 'textTransform'> {
|
|
162
166
|
zIndex?: CSSUnitValue;
|
|
163
167
|
visibility?: CSSKeywordValue;
|
|
164
168
|
pointerEvents?: CSSKeywordValue;
|
|
@@ -179,6 +183,7 @@ export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x
|
|
|
179
183
|
width?: CSSUnitValue;
|
|
180
184
|
height?: CSSUnitValue;
|
|
181
185
|
lineWidth?: CSSUnitValue;
|
|
186
|
+
increasedLineWidthForHitTesting?: CSSUnitValue;
|
|
182
187
|
/**
|
|
183
188
|
* x according to definition, eg. Line's x1/x2, Polyline's points
|
|
184
189
|
*/
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -106,17 +106,4 @@ Object.keys(_canvas).forEach(function (key) {
|
|
|
106
106
|
return _canvas[key];
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
var _hooks = require("./hooks");
|
|
112
|
-
|
|
113
|
-
Object.keys(_hooks).forEach(function (key) {
|
|
114
|
-
if (key === "default" || key === "__esModule") return;
|
|
115
|
-
if (key in exports && exports[key] === _hooks[key]) return;
|
|
116
|
-
Object.defineProperty(exports, key, {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function get() {
|
|
119
|
-
return _hooks[key];
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
109
|
});
|
|
@@ -10,7 +10,7 @@ var _tslib = require("tslib");
|
|
|
10
10
|
|
|
11
11
|
var _manaSyringe = require("mana-syringe");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _interfaces = require("../css/interfaces");
|
|
14
14
|
|
|
15
15
|
var _animation = require("./animation");
|
|
16
16
|
|
|
@@ -127,7 +127,7 @@ function propertyInterpolation(property, left, right, target) {
|
|
|
127
127
|
var parsedLeft = left;
|
|
128
128
|
var parsedRight = right;
|
|
129
129
|
|
|
130
|
-
var registry = _manaSyringe.GlobalContainer.get(
|
|
130
|
+
var registry = _manaSyringe.GlobalContainer.get(_interfaces.StyleValueRegistry);
|
|
131
131
|
|
|
132
132
|
var metadata = registry.getMetadata(property);
|
|
133
133
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.0.23
|
|
3
|
+
"version": "5.0.23",
|
|
4
4
|
"description": "A core module including ECS and DI container.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/antvis/g#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@antv/g-math": "^1.0.20
|
|
41
|
+
"@antv/g-math": "^1.0.20",
|
|
42
42
|
"@antv/util": "^3.0.0",
|
|
43
43
|
"@types/offscreencanvas": "^2019.6.4",
|
|
44
44
|
"d3-color": "^1.4.0",
|
|
@@ -47,10 +47,11 @@
|
|
|
47
47
|
"mana-syringe": "^0.3.0",
|
|
48
48
|
"reflect-metadata": "^0.1.13",
|
|
49
49
|
"request-animation-frame-polyfill": "^1.1.2",
|
|
50
|
+
"tapable": "^2.2.1",
|
|
50
51
|
"tslib": "^2.3.1"
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|
|
53
54
|
"umd": "webpack"
|
|
54
55
|
},
|
|
55
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "e2325a6285d12ef05abd9f9e12cf095280006167"
|
|
56
57
|
}
|
package/es/utils/hooks.d.ts
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* a lite tapable implementation
|
|
3
|
-
* borrow from https://github.com/funnyecho/hamon
|
|
4
|
-
*/
|
|
5
|
-
declare type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ? T : never;
|
|
6
|
-
declare type Append<T extends any[], U> = {
|
|
7
|
-
0: [U];
|
|
8
|
-
1: [T[0], U];
|
|
9
|
-
2: [T[0], T[1], U];
|
|
10
|
-
3: [T[0], T[1], T[2], U];
|
|
11
|
-
4: [T[0], T[1], T[2], T[3], U];
|
|
12
|
-
5: [T[0], T[1], T[2], T[3], T[4], U];
|
|
13
|
-
6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
|
|
14
|
-
7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
|
|
15
|
-
8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
|
|
16
|
-
}[Measure<T['length']>];
|
|
17
|
-
declare type AsArray<T> = T extends any[] ? T : [];
|
|
18
|
-
declare type Callback<E, T> = (error?: E, result?: T) => void;
|
|
19
|
-
declare type ITapID = string;
|
|
20
|
-
declare type IHookBucketType = any;
|
|
21
|
-
declare type IHookBucketHashcode<T> = (...args: AsArray<T>) => IHookBucketType;
|
|
22
|
-
declare type IAsyncTapArgs<T, R> = Append<AsArray<T>, Callback<Error, R>>;
|
|
23
|
-
declare type ISyncTapCallback<T, R> = (...args: AsArray<T>) => R;
|
|
24
|
-
declare type IAsyncTapCallback<T, R> = (...args: IAsyncTapArgs<T, R>) => void;
|
|
25
|
-
declare type IPromiseTapCallback<T, R> = (...args: AsArray<T>) => Promise<R>;
|
|
26
|
-
export declare type ITapDestroy = () => void;
|
|
27
|
-
interface ITapOptions<T, R> {
|
|
28
|
-
fn: IAsyncTapCallback<T, R> | ISyncTapCallback<T, R>;
|
|
29
|
-
bucket: string;
|
|
30
|
-
}
|
|
31
|
-
interface IInvokeSeriesObserver<T, R> {
|
|
32
|
-
shouldBail?: boolean;
|
|
33
|
-
shouldWaterfall?: boolean;
|
|
34
|
-
onComplete?: (err: Error, result?: R) => void;
|
|
35
|
-
}
|
|
36
|
-
interface IInvokeParallelObserver<T, R> {
|
|
37
|
-
shouldBail?: boolean;
|
|
38
|
-
onComplete?: (err: Error, result?: R) => void;
|
|
39
|
-
}
|
|
40
|
-
interface IInvokeSynchronouslyObserver<T, R> {
|
|
41
|
-
shouldBail?: boolean;
|
|
42
|
-
shouldWaterfall?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Basic Hook Type
|
|
46
|
-
*
|
|
47
|
-
* @remarks
|
|
48
|
-
* All subtype hooks are extends from `Hook` which provide the tapping and calling logic
|
|
49
|
-
*
|
|
50
|
-
* @param T - tuple types of calling arguments
|
|
51
|
-
* @param R - returning value type of calling
|
|
52
|
-
*
|
|
53
|
-
* @public
|
|
54
|
-
* */
|
|
55
|
-
export declare abstract class Hook<T, R> {
|
|
56
|
-
private tapIdSeed;
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
* */
|
|
60
|
-
protected readonly bucketHashcode: IHookBucketHashcode<T>;
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
* */
|
|
64
|
-
protected readonly presetTapBucket: Set<ITapID>;
|
|
65
|
-
/**
|
|
66
|
-
* @internal
|
|
67
|
-
* */
|
|
68
|
-
protected readonly tapBuckets: Map<IHookBucketType, Set<ITapID>>;
|
|
69
|
-
/**
|
|
70
|
-
* @internal
|
|
71
|
-
* */
|
|
72
|
-
protected readonly tapOptionsCache: Map<ITapID, ITapOptions<T, R>>;
|
|
73
|
-
/**
|
|
74
|
-
* @param bucketHashcode - calculate the hashcode value of calling arguments
|
|
75
|
-
* */
|
|
76
|
-
constructor(bucketHashcode?: IHookBucketHashcode<T>);
|
|
77
|
-
/**
|
|
78
|
-
* clear all tapping from hook
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
* */
|
|
82
|
-
exhaust(): void;
|
|
83
|
-
/**
|
|
84
|
-
* clear all tapping from hook
|
|
85
|
-
*
|
|
86
|
-
* @remarks
|
|
87
|
-
* The same as `exhaust` {@link Hook.exhaust}
|
|
88
|
-
*
|
|
89
|
-
* @privateRemarks
|
|
90
|
-
* call `exhaust`
|
|
91
|
-
*
|
|
92
|
-
* @public
|
|
93
|
-
* */
|
|
94
|
-
destroy(): void;
|
|
95
|
-
/**
|
|
96
|
-
* @internal
|
|
97
|
-
* */
|
|
98
|
-
protected insertSyncTap(fn: ISyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
99
|
-
/**
|
|
100
|
-
* @internal
|
|
101
|
-
* */
|
|
102
|
-
protected insertAsyncTap(fn: IAsyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
103
|
-
/**
|
|
104
|
-
* @internal
|
|
105
|
-
* */
|
|
106
|
-
protected insertPromiseTap(fn: IPromiseTapCallback<T, R | void>, bucket?: IHookBucketType): ITapDestroy;
|
|
107
|
-
/**
|
|
108
|
-
* @internal
|
|
109
|
-
* */
|
|
110
|
-
protected invokeSeries(args: AsArray<T>, observer?: IInvokeSeriesObserver<T, R>): void;
|
|
111
|
-
/**
|
|
112
|
-
* @internal
|
|
113
|
-
* */
|
|
114
|
-
protected invokeParallel(args: AsArray<T>, observer?: IInvokeParallelObserver<T, R>): void;
|
|
115
|
-
/**
|
|
116
|
-
* @internal
|
|
117
|
-
* */
|
|
118
|
-
protected invokeSynchronously(args: AsArray<T>, observer?: IInvokeSynchronouslyObserver<T, R>): R;
|
|
119
|
-
/**
|
|
120
|
-
* @internal
|
|
121
|
-
* */
|
|
122
|
-
protected getBucketTaps(args: AsArray<T>): Set<ITapOptions<T, R>>;
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
* */
|
|
126
|
-
private tapping;
|
|
127
|
-
/**
|
|
128
|
-
* @internal
|
|
129
|
-
* */
|
|
130
|
-
protected popoutTap(tapId: ITapID): void;
|
|
131
|
-
/**
|
|
132
|
-
* @internal
|
|
133
|
-
* */
|
|
134
|
-
private generateTapId;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Abstract Sync Hook
|
|
138
|
-
*
|
|
139
|
-
* @remarks
|
|
140
|
-
* Providing `tap` method for synchronous hooks
|
|
141
|
-
*
|
|
142
|
-
* @public
|
|
143
|
-
* */
|
|
144
|
-
export declare abstract class SyncTapHook<T, R> extends Hook<T, R> {
|
|
145
|
-
/**
|
|
146
|
-
* listen to hook
|
|
147
|
-
*
|
|
148
|
-
* @param fn - Listener callback
|
|
149
|
-
* @param bucket - Listen to specified hashcode bucket
|
|
150
|
-
* @returns The unTap function
|
|
151
|
-
*
|
|
152
|
-
* @public
|
|
153
|
-
* */
|
|
154
|
-
tap(fn: ISyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Abstract Async Hook
|
|
158
|
-
*
|
|
159
|
-
* @remarks
|
|
160
|
-
* Providing `tapAsync` and `tapPromise` methods for asynchronous hooks
|
|
161
|
-
*
|
|
162
|
-
* @public
|
|
163
|
-
* */
|
|
164
|
-
export declare abstract class AsyncTapHook<T, R> extends Hook<T, R> {
|
|
165
|
-
/**
|
|
166
|
-
* listen to hook in async callback mode
|
|
167
|
-
*
|
|
168
|
-
* @param fn - Listener callback
|
|
169
|
-
* The last argument of `fn` which named `cb` will be a function which signature is `(err?: Error, result?: T) => void`.
|
|
170
|
-
* When error occur, pass the error to `cb` as first param and the `result` param should be void,
|
|
171
|
-
* Otherwise, first param must be void.
|
|
172
|
-
*
|
|
173
|
-
* @param bucket - Listen to specified hashcode bucket
|
|
174
|
-
* @returns The unTap function
|
|
175
|
-
*
|
|
176
|
-
* @public
|
|
177
|
-
* */
|
|
178
|
-
tapAsync(fn: IAsyncTapCallback<T, R>, bucket?: IHookBucketType): ITapDestroy;
|
|
179
|
-
/**
|
|
180
|
-
* listen to hook in async promise mode
|
|
181
|
-
*
|
|
182
|
-
* @param fn - Listener callback
|
|
183
|
-
* When tapping success, return resolved promise.
|
|
184
|
-
* Otherwise, throw error or return rejected promise.
|
|
185
|
-
*
|
|
186
|
-
* @param bucket - Listen to specified hashcode bucket
|
|
187
|
-
* @returns The unTap function
|
|
188
|
-
*
|
|
189
|
-
* @public
|
|
190
|
-
* */
|
|
191
|
-
tapPromise(fn: IPromiseTapCallback<T, R | void>, bucket?: IHookBucketType): ITapDestroy;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Synchronous Hook
|
|
195
|
-
*
|
|
196
|
-
* @remarks
|
|
197
|
-
* Invoke listener Synchronously and return nothing
|
|
198
|
-
*
|
|
199
|
-
* @public
|
|
200
|
-
* */
|
|
201
|
-
export declare class SyncHook<T, R = void> extends SyncTapHook<T, R> {
|
|
202
|
-
/**
|
|
203
|
-
* call listener with `...args`
|
|
204
|
-
*
|
|
205
|
-
* @param args - rest parameters of calling arguments
|
|
206
|
-
*
|
|
207
|
-
* */
|
|
208
|
-
call(...args: AsArray<T>): void;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Synchronous Waterfall Hook
|
|
212
|
-
*
|
|
213
|
-
* @remarks
|
|
214
|
-
* Invoke listener Synchronously.
|
|
215
|
-
* Those non-undefined value returned from upstream listener, will waterfall to downstream as first element of arguments.
|
|
216
|
-
* Calling return with waterfall value of last listener.
|
|
217
|
-
*
|
|
218
|
-
* @public
|
|
219
|
-
* */
|
|
220
|
-
export declare class SyncWaterfallHook<T, R> extends SyncTapHook<T, R> {
|
|
221
|
-
/**
|
|
222
|
-
* call listener with `...args`
|
|
223
|
-
*
|
|
224
|
-
* @param args - rest parameters of calling arguments
|
|
225
|
-
* @returns waterfall value
|
|
226
|
-
* */
|
|
227
|
-
call(...args: AsArray<T>): R;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Asynchronous Parallel Hook
|
|
231
|
-
*
|
|
232
|
-
* @remarks
|
|
233
|
-
* Invoke listeners in parallel asynchronously
|
|
234
|
-
*
|
|
235
|
-
* @public
|
|
236
|
-
* */
|
|
237
|
-
export declare class AsyncParallelHook<T, R = void> extends AsyncTapHook<T, R> {
|
|
238
|
-
/**
|
|
239
|
-
* call listener with `...args` and `cb`
|
|
240
|
-
*
|
|
241
|
-
* @param args - rest parameters of calling arguments and `cb`
|
|
242
|
-
* The signature of `cb` is `(err?: Error) => void`.
|
|
243
|
-
* */
|
|
244
|
-
callAsync(...args: IAsyncTapArgs<T, R>): void;
|
|
245
|
-
/***
|
|
246
|
-
* call listener with `...args`
|
|
247
|
-
*
|
|
248
|
-
* @param args - rest parameters of calling arguments
|
|
249
|
-
* @returns Promise indicated whether calling succeed or failed
|
|
250
|
-
* */
|
|
251
|
-
callPromise(...args: AsArray<T>): Promise<R>;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Asynchronous Waterfall Hook
|
|
255
|
-
*
|
|
256
|
-
* @remarks
|
|
257
|
-
* Invoke listener in queue Asynchronously.
|
|
258
|
-
* Those non-undefined value returned from upstream listener, will waterfall to downstream as first element of arguments.
|
|
259
|
-
* Calling return with waterfall value of last listener.
|
|
260
|
-
*
|
|
261
|
-
* @public
|
|
262
|
-
* */
|
|
263
|
-
export declare class AsyncSeriesWaterfallHook<T, R> extends AsyncTapHook<T, R> {
|
|
264
|
-
/**
|
|
265
|
-
* call listener with `...args` and `cb`
|
|
266
|
-
*
|
|
267
|
-
* @param args - rest parameters of calling arguments and `cb`
|
|
268
|
-
* The signature of `cb` is `(err?: Error) => void`.
|
|
269
|
-
* */
|
|
270
|
-
callAsync(...args: IAsyncTapArgs<T, R>): void;
|
|
271
|
-
/***
|
|
272
|
-
* call listener with `...args`
|
|
273
|
-
*
|
|
274
|
-
* @param args - rest parameters of calling arguments
|
|
275
|
-
* @returns Promise indicated whether calling succeed or failed
|
|
276
|
-
* If calling succeed, promise was resolved with waterfall value.
|
|
277
|
-
* */
|
|
278
|
-
callPromise(...args: AsArray<T>): Promise<R>;
|
|
279
|
-
}
|
|
280
|
-
export {};
|