@leafer/event 1.0.0-beta → 1.0.0-beta.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/event",
3
- "version": "1.0.0-beta",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "@leafer/event",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,9 +19,9 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/decorator": "1.0.0-beta"
22
+ "@leafer/decorator": "1.0.0-beta.11"
23
23
  },
24
24
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-beta"
25
+ "@leafer/interface": "1.0.0-beta.11"
26
26
  }
27
27
  }
@@ -0,0 +1,10 @@
1
+ import { IAnimateEvent } from '@leafer/interface'
2
+
3
+ import { Event } from './Event'
4
+
5
+
6
+ export class AnimateEvent extends Event implements IAnimateEvent {
7
+
8
+ static FRAME = 'animate.frame'
9
+
10
+ }
package/src/ImageEvent.ts CHANGED
@@ -1,24 +1,22 @@
1
- import { IImageEvent, IObject, IEventTarget, ILeaferImage } from '@leafer/interface'
1
+ import { IImageEvent, IObject, ILeaferImage } from '@leafer/interface'
2
2
 
3
3
  import { Event } from './Event'
4
4
 
5
5
  export class ImageEvent extends Event implements IImageEvent {
6
6
 
7
+ static LOAD = 'image.load'
7
8
  static LOADED = 'image.loaded'
8
9
  static ERROR = 'image.error'
9
10
 
10
11
  readonly image: ILeaferImage
11
12
  readonly error: string | IObject
12
13
 
13
- readonly attrName?: string
14
- readonly attrValue?: IObject
14
+ readonly attrName: string
15
+ readonly attrValue: IObject
15
16
 
16
- constructor(type: string, target: IEventTarget, image: ILeaferImage, attrName?: string, attrValue?: IObject, error?: string | IObject) {
17
- super(type, target)
18
- this.image = image
19
- this.attrName = attrName
20
- this.attrValue = attrValue
21
- if (error) this.error = error
17
+ constructor(type: string, data: IImageEvent) {
18
+ super(type)
19
+ Object.assign(this, data)
22
20
  }
23
21
 
24
22
  }
@@ -29,9 +29,12 @@ export class ResizeEvent extends Event implements IResizeEvent {
29
29
  readonly old: IScreenSizeData
30
30
 
31
31
  constructor(size: IScreenSizeData | string, oldSize?: IScreenSizeData) {
32
- const realSize = typeof size === 'object'
33
- super(realSize ? ResizeEvent.RESIZE : size)
34
- if (realSize) Object.assign(this, size)
32
+ if (typeof size === 'object') {
33
+ super(ResizeEvent.RESIZE)
34
+ Object.assign(this, size)
35
+ } else {
36
+ super(size)
37
+ }
35
38
  this.old = oldSize
36
39
  }
37
40
 
package/src/index.ts CHANGED
@@ -5,8 +5,8 @@ export { ResizeEvent } from './ResizeEvent'
5
5
  export { TransformEvent } from './TransformEvent'
6
6
  export { WatchEvent } from './WatchEvent'
7
7
  export { LayoutEvent } from './LayoutEvent'
8
+ export { AnimateEvent } from './AnimateEvent'
8
9
  export { RenderEvent } from './RenderEvent'
9
10
  export { LeaferEvent } from './LeaferEvent'
10
11
 
11
- export { Event } from './Event'
12
-
12
+ export { Event } from './Event'