@douyinfe/semi-animation 2.1.0-alpha.1 → 2.1.0-alpha.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.
Files changed (42) hide show
  1. package/lib/es/src/Animation.js +1 -3
  2. package/lib/es/src/getEasing.js +1 -3
  3. package/lib/es/src/interpolate.js +1 -5
  4. package/lib/es/src/utils/Event.js +4 -11
  5. package/lib/es/src/utils/debounce.js +2 -7
  6. package/lib/es/src/utils/log.js +1 -5
  7. package/lib/es/src/wrapValue.js +1 -3
  8. package/package.json +3 -3
  9. package/lib/cjs/index.d.ts +0 -6
  10. package/lib/cjs/index.js +0 -69
  11. package/lib/cjs/src/Animation.d.ts +0 -55
  12. package/lib/cjs/src/Animation.js +0 -323
  13. package/lib/cjs/src/constants.d.ts +0 -1
  14. package/lib/cjs/src/constants.js +0 -11
  15. package/lib/cjs/src/getEasing.d.ts +0 -10
  16. package/lib/cjs/src/getEasing.js +0 -165
  17. package/lib/cjs/src/interpolate.d.ts +0 -13
  18. package/lib/cjs/src/interpolate.js +0 -62
  19. package/lib/cjs/src/mapToZero.d.ts +0 -1
  20. package/lib/cjs/src/mapToZero.js +0 -25
  21. package/lib/cjs/src/presets.d.ts +0 -18
  22. package/lib/cjs/src/presets.js +0 -41
  23. package/lib/cjs/src/shouldStopAnimation.d.ts +0 -13
  24. package/lib/cjs/src/shouldStopAnimation.js +0 -55
  25. package/lib/cjs/src/shouldUseBezier.d.ts +0 -1
  26. package/lib/cjs/src/shouldUseBezier.js +0 -13
  27. package/lib/cjs/src/stepper.d.ts +0 -16
  28. package/lib/cjs/src/stepper.js +0 -56
  29. package/lib/cjs/src/stripStyle.d.ts +0 -1
  30. package/lib/cjs/src/stripStyle.js +0 -24
  31. package/lib/cjs/src/utils/Event.d.ts +0 -7
  32. package/lib/cjs/src/utils/Event.js +0 -90
  33. package/lib/cjs/src/utils/debounce.d.ts +0 -6
  34. package/lib/cjs/src/utils/debounce.js +0 -33
  35. package/lib/cjs/src/utils/log.d.ts +0 -2
  36. package/lib/cjs/src/utils/log.js +0 -22
  37. package/lib/cjs/src/utils/noop.d.ts +0 -1
  38. package/lib/cjs/src/utils/noop.js +0 -12
  39. package/lib/cjs/src/utils/shallowEqual.d.ts +0 -1
  40. package/lib/cjs/src/utils/shallowEqual.js +0 -36
  41. package/lib/cjs/src/wrapValue.d.ts +0 -18
  42. package/lib/cjs/src/wrapValue.js +0 -61
@@ -1,165 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
- _Object$defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
-
11
- exports.default = getEasing;
12
- exports.easingMap = void 0;
13
-
14
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
15
-
16
- var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
17
-
18
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
19
-
20
- var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
21
-
22
- var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
23
-
24
- var _bezierEasing = _interopRequireDefault(require("bezier-easing"));
25
-
26
- function minMax(val, min, max) {
27
- return Math.min(Math.max(val, min), max);
28
- }
29
-
30
- function parseEasingParameters(string) {
31
- var _context;
32
-
33
- const match = /\(([^)]+)\)/.exec(string);
34
- return match ? (0, _map.default)(_context = match[1].split(',')).call(_context, p => (0, _parseFloat2.default)(p)) : [];
35
- } // Elastic easing adapted from jQueryUI http://api.jqueryui.com/easings/
36
-
37
-
38
- function elastic() {
39
- let amplitude = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
40
- let period = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5;
41
- const a = minMax(amplitude, 1, 10);
42
- const p = minMax(period, 0.1, 2);
43
- return t => t === 0 || t === 1 ? t : -a * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p / (Math.PI * 2) * Math.asin(1 / a)) * (Math.PI * 2) / p);
44
- } // anime.js/src/index.js
45
-
46
-
47
- const easingMap = (() => {
48
- const names = ['Quad', 'Cubic', 'Quart', 'Quint', 'Sine', 'Expo', 'Circ', 'Back', 'Elastic']; // Approximated Penner equations http://matthewlein.com/ceaser/
49
-
50
- const curves = {
51
- In: [[0.55, 0.085, 0.68, 0.53]
52
- /* inQuad */
53
- , [0.55, 0.055, 0.675, 0.19]
54
- /* inCubic */
55
- , [0.895, 0.03, 0.685, 0.22]
56
- /* inQuart */
57
- , [0.755, 0.05, 0.855, 0.06]
58
- /* inQuint */
59
- , [0.47, 0.0, 0.745, 0.715]
60
- /* inSine */
61
- , [0.95, 0.05, 0.795, 0.035]
62
- /* inExpo */
63
- , [0.6, 0.04, 0.98, 0.335]
64
- /* inCirc */
65
- , [0.6, -0.28, 0.735, 0.045]
66
- /* inBack */
67
- , elastic
68
- /* inElastic */
69
- ],
70
- Out: [[0.25, 0.46, 0.45, 0.94]
71
- /* outQuad */
72
- , [0.215, 0.61, 0.355, 1.0]
73
- /* outCubic */
74
- , [0.165, 0.84, 0.44, 1.0]
75
- /* outQuart */
76
- , [0.23, 1.0, 0.32, 1.0]
77
- /* outQuint */
78
- , [0.39, 0.575, 0.565, 1.0]
79
- /* outSine */
80
- , [0.19, 1.0, 0.22, 1.0]
81
- /* outExpo */
82
- , [0.075, 0.82, 0.165, 1.0]
83
- /* outCirc */
84
- , [0.175, 0.885, 0.32, 1.275]
85
- /* outBack */
86
- , (a, p) => t => 1 - elastic(a, p)(1 - t)
87
- /* outElastic */
88
- ],
89
- InOut: [[0.455, 0.03, 0.515, 0.955]
90
- /* inOutQuad */
91
- , [0.645, 0.045, 0.355, 1.0]
92
- /* inOutCubic */
93
- , [0.77, 0.0, 0.175, 1.0]
94
- /* inOutQuart */
95
- , [0.86, 0.0, 0.07, 1.0]
96
- /* inOutQuint */
97
- , [0.445, 0.05, 0.55, 0.95]
98
- /* inOutSine */
99
- , [1.0, 0.0, 0.0, 1.0]
100
- /* inOutExpo */
101
- , [0.785, 0.135, 0.15, 0.86]
102
- /* inOutCirc */
103
- , [0.68, -0.55, 0.265, 1.55]
104
- /* inOutBack */
105
- , (a, p) => t => t < 0.5 ? elastic(a, p)(t * 2) / 2 : 1 - elastic(a, p)(t * -2 + 2) / 2
106
- /* inOutElastic */
107
- ]
108
- };
109
- const eases = {
110
- linear: [0.25, 0.25, 0.75, 0.75]
111
- };
112
-
113
- for (const coords of (0, _keys.default)(curves)) {
114
- var _context2;
115
-
116
- (0, _forEach.default)(_context2 = curves[coords]).call(_context2, (ease, i) => {
117
- eases['ease' + coords + names[i]] = ease;
118
- });
119
- }
120
-
121
- return eases;
122
- })();
123
- /**
124
- * get easing function
125
- * @param {string|Function} easing
126
- * @returns {Function}
127
- */
128
-
129
-
130
- exports.easingMap = easingMap;
131
-
132
- function getEasing(easing) {
133
- if (typeof easing === 'function') {
134
- return easing;
135
- }
136
-
137
- if (!easing || typeof easing !== 'string') {
138
- easing = 'linear';
139
- } else {
140
- easing = (0, _trim.default)(easing).call(easing);
141
- }
142
-
143
- let name = easing.split('(')[0];
144
- const args = parseEasingParameters(easing);
145
- let ease;
146
-
147
- if (name === 'cubic-bezier' || name === 'cubicBezier') {
148
- return (0, _bezierEasing.default)(...(args.length ? args : easingMap.linear));
149
- } else {
150
- // eslint-disable-next-line eqeqeq
151
- if (!name || typeof name !== 'string' || typeof name === 'string' && easingMap[name] == null) {
152
- name = 'linear';
153
- }
154
-
155
- ease = easingMap[name];
156
-
157
- if (typeof ease === 'function') {
158
- return ease(...args);
159
- } else if (args.length) {
160
- return (0, _bezierEasing.default)(...args);
161
- } else {
162
- return (0, _bezierEasing.default)(...ease);
163
- }
164
- }
165
- }
@@ -1,13 +0,0 @@
1
- /**
2
- *
3
- * @param {number|number[]|string|string[]} from
4
- * @param {number|number[]|string|string[]} to
5
- * @param {number} ratio
6
- * @param {Function} [parser]
7
- * @param {Function} [formatter]
8
- * @returns {any}
9
- */
10
- export declare type FromTo = string | number | (string | number)[];
11
- export declare type Parser = (value: FromTo) => any;
12
- export declare type Formatter = (value: any[]) => any;
13
- export default function interpolate(from: FromTo, to: FromTo, ratio?: number, parser?: Parser, formatter?: Formatter): any;
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
- _Object$defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
-
11
- exports.default = interpolate;
12
-
13
- var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
14
-
15
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
16
-
17
- var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
18
-
19
- /**
20
- *
21
- * @param {number|number[]|string|string[]} from
22
- * @param {number|number[]|string|string[]} to
23
- * @param {number} ratio
24
- * @param {Function} [parser]
25
- * @param {Function} [formatter]
26
- * @returns {any}
27
- */
28
- // eslint-disable-next-line max-len
29
- function interpolate(from, to) {
30
- let ratio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
31
- let parser = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
32
- let formatter = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
33
-
34
- if (typeof parser === 'function') {
35
- from = parser(from);
36
- to = parser(to);
37
- }
38
-
39
- if (typeof from === 'string' || typeof from === 'number') {
40
- from = [(0, _parseFloat2.default)(from)];
41
- }
42
-
43
- if (typeof to === 'string' || typeof to === 'number') {
44
- to = [(0, _parseFloat2.default)(to)];
45
- }
46
-
47
- const result = [];
48
-
49
- if ((0, _isArray.default)(from) && (0, _isArray.default)(to)) {
50
- (0, _forEach.default)(from).call(from, (fromVal, idx) => {
51
- fromVal = (0, _parseFloat2.default)(fromVal);
52
- const toVal = (0, _parseFloat2.default)(to[idx]);
53
- result.push((toVal - fromVal) * ratio + fromVal);
54
- });
55
- }
56
-
57
- if (typeof formatter === 'function') {
58
- return formatter(result);
59
- } else {
60
- return result;
61
- }
62
- }
@@ -1 +0,0 @@
1
- export default function mapToZero(obj: Record<string, any>): {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
- _Object$defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
-
11
- exports.default = mapToZero;
12
-
13
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
14
-
15
- // currently used to initiate the velocity style object to 0
16
- function mapToZero(obj) {
17
- const ret = {};
18
- const objKeys = obj && (0, _keys.default)(obj) || [];
19
-
20
- for (const key of objKeys) {
21
- ret[key] = 0;
22
- }
23
-
24
- return ret;
25
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * stiffness is like tension
3
- * damping is like friction
4
- */
5
- export interface PresetsItem {
6
- tension: number;
7
- friction: number;
8
- }
9
- export interface Presets {
10
- default: PresetsItem;
11
- gentle: PresetsItem;
12
- wobbly: PresetsItem;
13
- stiff: PresetsItem;
14
- slow: PresetsItem;
15
- molasses: PresetsItem;
16
- }
17
- declare const _default: Presets;
18
- export default _default;
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
-
9
- exports.default = void 0;
10
-
11
- /**
12
- * stiffness is like tension
13
- * damping is like friction
14
- */
15
- var _default = {
16
- default: {
17
- tension: 170,
18
- friction: 26
19
- },
20
- gentle: {
21
- tension: 120,
22
- friction: 14
23
- },
24
- wobbly: {
25
- tension: 180,
26
- friction: 12
27
- },
28
- stiff: {
29
- tension: 210,
30
- friction: 20
31
- },
32
- slow: {
33
- tension: 280,
34
- friction: 60
35
- },
36
- molasses: {
37
- tension: 280,
38
- friction: 120
39
- }
40
- };
41
- exports.default = _default;
@@ -1,13 +0,0 @@
1
- /**
2
- * usage assumption: currentStyle values have already been rendered but it says
3
- * nothing of whether currentStyle is stale (see unreadPropStyle)
4
- *
5
- * @param {object} currentStyle
6
- * @param {object} style
7
- * @param {object} currentVelocity
8
- * @param {number} startTime
9
- * @param {number} nowTime
10
- *
11
- * @returns {boolean}
12
- */
13
- export default function shouldStopAnimation(currentStyle: Record<string, any>, style: Record<string, any>, currentVelocity: Record<string, any>, startTime: number, nowTime: number): boolean;
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
- _Object$defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
-
11
- exports.default = shouldStopAnimation;
12
-
13
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
14
-
15
- var _shouldUseBezier = _interopRequireDefault(require("./shouldUseBezier"));
16
-
17
- /**
18
- * usage assumption: currentStyle values have already been rendered but it says
19
- * nothing of whether currentStyle is stale (see unreadPropStyle)
20
- *
21
- * @param {object} currentStyle
22
- * @param {object} style
23
- * @param {object} currentVelocity
24
- * @param {number} startTime
25
- * @param {number} nowTime
26
- *
27
- * @returns {boolean}
28
- */
29
- // eslint-disable-next-line max-len
30
- function shouldStopAnimation(currentStyle, style, currentVelocity, startTime, nowTime) {
31
- for (const key of (0, _keys.default)(style)) {
32
- const styleValue = style[key];
33
- const value = typeof styleValue === 'number' ? styleValue : styleValue.val;
34
-
35
- if (typeof styleValue === 'object' && styleValue.done) {
36
- continue;
37
- }
38
-
39
- if ((0, _shouldUseBezier.default)(styleValue) && startTime && nowTime && styleValue.duration) {
40
- if (styleValue.duration + startTime <= nowTime || value !== currentStyle[key]) {
41
- return false;
42
- }
43
- } else if (typeof currentVelocity[key] === 'number' && currentVelocity[key] !== 0) {
44
- return false;
45
- } // stepper will have already taken care of rounding precision errors, so
46
- // won't have such thing as 0.9999 !=== 1
47
-
48
-
49
- if (currentStyle[key] !== value) {
50
- return false;
51
- }
52
- }
53
-
54
- return true;
55
- }
@@ -1 +0,0 @@
1
- export default function shouldUseBezier(config: Record<string, any>): boolean;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
-
9
- exports.default = shouldUseBezier;
10
-
11
- function shouldUseBezier(config) {
12
- return Boolean(config && typeof config === 'object' && (config.duration > 0 || typeof config.easing === 'string' || typeof config.easing === 'function'));
13
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * @file
3
- *
4
- * react-motion/src/stepper.js
5
- */
6
- /**
7
- *
8
- * @param {number} secondPerFrame
9
- * @param {number} x
10
- * @param {number} v
11
- * @param {number} destX
12
- * @param {number} k
13
- * @param {number} b
14
- * @param {number} precision
15
- */
16
- export default function stepper(secondPerFrame: number, x: number, v: number, destX: number, k: number, b: number, precision: number): number[];
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
-
9
- exports.default = stepper;
10
-
11
- /**
12
- * @file
13
- *
14
- * react-motion/src/stepper.js
15
- */
16
- // stepper is used a lot. Saves allocation to return the same array wrapper.
17
- // This is fine and danger-free against mutations because the callsite
18
- // immediately destructures it and gets the numbers inside without passing the
19
- // array reference around.
20
- const reusedTuple = [0, 0];
21
- /**
22
- *
23
- * @param {number} secondPerFrame
24
- * @param {number} x
25
- * @param {number} v
26
- * @param {number} destX
27
- * @param {number} k
28
- * @param {number} b
29
- * @param {number} precision
30
- */
31
- // eslint-disable-next-line max-len
32
-
33
- function stepper(secondPerFrame, x, v, destX, k, b, precision) {
34
- // Spring stiffness, in kg / s^2
35
- // for animations, destX is really spring length (spring at rest). initial
36
- // position is considered as the stretched/compressed position of a spring
37
- const Fspring = -k * (x - destX); // Damping, in kg / s
38
-
39
- const Fdamper = -b * v; // usually we put mass here, but for animation purposes, specifying mass is a
40
- // bit redundant. you could simply adjust k and b accordingly
41
- // let a = (Fspring + Fdamper) / mass;
42
-
43
- const a = Fspring + Fdamper;
44
- const newV = v + a * secondPerFrame;
45
- const newX = x + newV * secondPerFrame;
46
-
47
- if (Math.abs(newV) < precision && Math.abs(newX - destX) < precision) {
48
- reusedTuple[0] = destX;
49
- reusedTuple[1] = 0;
50
- return reusedTuple;
51
- }
52
-
53
- reusedTuple[0] = newX;
54
- reusedTuple[1] = newV;
55
- return reusedTuple;
56
- }
@@ -1 +0,0 @@
1
- export default function stripStyle(style: Record<string, any>): {};
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
-
9
- exports.default = stripStyle;
10
-
11
- /* eslint-disable no-restricted-syntax */
12
- function stripStyle(style) {
13
- const ret = {};
14
-
15
- for (const key in style) {
16
- if (!Object.prototype.hasOwnProperty.call(style, key)) {
17
- continue;
18
- }
19
-
20
- ret[key] = typeof style[key] === 'number' ? style[key] : style[key].val;
21
- }
22
-
23
- return ret;
24
- }
@@ -1,7 +0,0 @@
1
- export default class Event {
2
- _eventMap: Map<any, any>;
3
- on(event: any, callback: any): this;
4
- once(event: any, callback: any): void;
5
- off(event: any, callback: any): this;
6
- emit(event: any, ...args: any): boolean;
7
- }
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
- _Object$defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
-
11
- exports.default = void 0;
12
-
13
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
14
-
15
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
16
-
17
- var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
18
-
19
- var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
20
-
21
- var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
22
-
23
- class Event {
24
- constructor() {
25
- this._eventMap = new _map.default();
26
- }
27
-
28
- on(event, callback) {
29
- if (event && typeof callback === 'function') {
30
- this._eventMap.has(event) || this._eventMap.set(event, []);
31
-
32
- this._eventMap.get(event).push(callback);
33
- }
34
-
35
- return this;
36
- }
37
-
38
- once(event, callback) {
39
- var _this = this;
40
-
41
- if (event && typeof callback === 'function') {
42
- const fn = function () {
43
- callback(...arguments);
44
-
45
- _this.off(event, fn);
46
- };
47
-
48
- this.on(event, fn);
49
- }
50
- }
51
-
52
- off(event, callback) {
53
- if (event) {
54
- if (typeof callback === 'function') {
55
- const callbacks = this._eventMap.get(event);
56
-
57
- if ((0, _isArray.default)(callbacks) && callbacks.length) {
58
- let index = -1; // eslint-disable-next-line max-depth
59
-
60
- while ((index = (0, _findIndex.default)(callbacks).call(callbacks, cb => cb === callback)) > -1) {
61
- (0, _splice.default)(callbacks).call(callbacks, index, 1);
62
- }
63
- } // eslint-disable-next-line eqeqeq
64
-
65
- } else if (callback == null) {
66
- this._eventMap.delete(event);
67
- }
68
- }
69
-
70
- return this;
71
- }
72
-
73
- emit(event) {
74
- var _context;
75
-
76
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
77
- args[_key - 1] = arguments[_key];
78
- }
79
-
80
- if (!this._eventMap.has(event)) {
81
- return false;
82
- }
83
-
84
- (0, _forEach.default)(_context = this._eventMap.get(event)).call(_context, callback => callback(...args));
85
- return true;
86
- }
87
-
88
- }
89
-
90
- exports.default = Event;
@@ -1,6 +0,0 @@
1
- /**
2
- *
3
- * @param {Function} func
4
- * @param {number} delay
5
- */
6
- export default function debounce(func: any, delay?: number): (...args: any) => void;
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
- _Object$defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
-
11
- exports.default = debounce;
12
-
13
- var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
14
-
15
- /**
16
- *
17
- * @param {Function} func
18
- * @param {number} delay
19
- */
20
- function debounce(func) {
21
- let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
22
- let timeoutId;
23
- return function () {
24
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25
- args[_key] = arguments[_key];
26
- }
27
-
28
- // eslint-disable-next-line @typescript-eslint/no-this-alias
29
- const context = this;
30
- clearTimeout(timeoutId);
31
- timeoutId = (0, _setTimeout2.default)(() => func.apply(context, args), delay);
32
- };
33
- }
@@ -1,2 +0,0 @@
1
- declare const log: (text: any, ...rest: any[]) => void;
2
- export default log;