@leafer/event 1.9.1 → 1.9.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/package.json +6 -6
- package/src/Eventer.ts +4 -2
- package/src/PropertyEvent.ts +11 -1
- package/src/index.ts +1 -1
- package/types/index.d.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/event",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "@leafer/event",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/decorator": "1.9.
|
|
26
|
-
"@leafer/math": "1.9.
|
|
27
|
-
"@leafer/data": "1.9.
|
|
28
|
-
"@leafer/platform": "1.9.
|
|
25
|
+
"@leafer/decorator": "1.9.2",
|
|
26
|
+
"@leafer/math": "1.9.2",
|
|
27
|
+
"@leafer/data": "1.9.2",
|
|
28
|
+
"@leafer/platform": "1.9.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@leafer/interface": "1.9.
|
|
31
|
+
"@leafer/interface": "1.9.2"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/Eventer.ts
CHANGED
|
@@ -118,8 +118,10 @@ export class Eventer implements IEventer {
|
|
|
118
118
|
if (!id) return
|
|
119
119
|
const list = isArray(id) ? id : [id]
|
|
120
120
|
list.forEach(item => {
|
|
121
|
-
if (
|
|
122
|
-
|
|
121
|
+
if (item) {
|
|
122
|
+
if (!item.listener) isArray(item.type) && (item.type as IEventParams[]).forEach(v => item.current.off(v[0], v[1], v[3]))
|
|
123
|
+
else item.current.off(item.type as string | string[], item.listener, item.options)
|
|
124
|
+
}
|
|
123
125
|
})
|
|
124
126
|
list.length = 0
|
|
125
127
|
}
|
package/src/PropertyEvent.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { IPropertyEvent, IEventTarget } from '@leafer/interface'
|
|
1
|
+
import { IPropertyEvent, IEventTarget, IStringMap } from '@leafer/interface'
|
|
2
2
|
|
|
3
3
|
import { Event } from './Event'
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
const SCROLL = 'property.scroll'
|
|
7
|
+
|
|
6
8
|
export class PropertyEvent extends Event implements IPropertyEvent {
|
|
7
9
|
|
|
8
10
|
static CHANGE = 'property.change'
|
|
9
11
|
static LEAFER_CHANGE = 'property.leafer_change'
|
|
10
12
|
|
|
13
|
+
static SCROLL = SCROLL
|
|
14
|
+
|
|
11
15
|
readonly attrName: string
|
|
12
16
|
readonly oldValue: unknown
|
|
13
17
|
readonly newValue: unknown
|
|
@@ -19,4 +23,10 @@ export class PropertyEvent extends Event implements IPropertyEvent {
|
|
|
19
23
|
this.newValue = newValue
|
|
20
24
|
}
|
|
21
25
|
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 额外派发的属性事件
|
|
29
|
+
export const extraPropertyEventMap: IStringMap = {
|
|
30
|
+
scrollX: SCROLL,
|
|
31
|
+
scrollY: SCROLL
|
|
22
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ChildEvent } from './ChildEvent'
|
|
2
|
-
export { PropertyEvent } from './PropertyEvent'
|
|
2
|
+
export { PropertyEvent, extraPropertyEventMap } from './PropertyEvent'
|
|
3
3
|
export { ImageEvent } from './ImageEvent'
|
|
4
4
|
export { BoundsEvent } from './BoundsEvent'
|
|
5
5
|
export { ResizeEvent } from './ResizeEvent'
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEvent, IObject, IEventTarget, IChildEvent, ILeaf, IPropertyEvent, IImageEvent, ILeaferImage, IBoundsEvent, IResizeEvent, INumberMap, IScreenSizeData, IWatchEvent, IWatchEventData, ILayoutEvent, ILayoutBlockData, IRenderEvent, IBounds, IRenderOptions, ILeaferEvent,
|
|
1
|
+
import { IEvent, IObject, IEventTarget, IChildEvent, ILeaf, IPropertyEvent, IStringMap, IImageEvent, ILeaferImage, IBoundsEvent, IResizeEvent, INumberMap, IScreenSizeData, IWatchEvent, IWatchEventData, ILayoutEvent, ILayoutBlockData, IRenderEvent, IBounds, IRenderOptions, ILeaferEvent, IEventer, InnerId, IEventListenerMap, IEventParamsMap, IEventParams, IEventListener, IEventOption, IEventListenerId } from '@leafer/interface';
|
|
2
2
|
|
|
3
3
|
declare class Event implements IEvent {
|
|
4
4
|
readonly origin: IObject;
|
|
@@ -31,11 +31,13 @@ declare class ChildEvent extends Event implements IChildEvent {
|
|
|
31
31
|
declare class PropertyEvent extends Event implements IPropertyEvent {
|
|
32
32
|
static CHANGE: string;
|
|
33
33
|
static LEAFER_CHANGE: string;
|
|
34
|
+
static SCROLL: string;
|
|
34
35
|
readonly attrName: string;
|
|
35
36
|
readonly oldValue: unknown;
|
|
36
37
|
readonly newValue: unknown;
|
|
37
38
|
constructor(type: string, target: IEventTarget, attrName: string, oldValue: unknown, newValue: unknown);
|
|
38
39
|
}
|
|
40
|
+
declare const extraPropertyEventMap: IStringMap;
|
|
39
41
|
|
|
40
42
|
declare class ImageEvent extends Event implements IImageEvent {
|
|
41
43
|
static LOAD: string;
|
|
@@ -146,4 +148,4 @@ declare class Eventer implements IEventer {
|
|
|
146
148
|
destroy(): void;
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
export { BoundsEvent, ChildEvent, Event, Eventer, ImageEvent, LayoutEvent, LeaferEvent, PropertyEvent, RenderEvent, ResizeEvent, WatchEvent, leaferTransformAttrMap };
|
|
151
|
+
export { BoundsEvent, ChildEvent, Event, Eventer, ImageEvent, LayoutEvent, LeaferEvent, PropertyEvent, RenderEvent, ResizeEvent, WatchEvent, extraPropertyEventMap, leaferTransformAttrMap };
|