Skip to content

WatchEvent

观察事件。

想了解事件的触发顺序,请查看 渲染生命周期 图示。

事件名称

WatchEvent.REQUEST

请求观察数据。

watch.request

WatchEvent.DATA

发送观察数据。

watch.data

关键属性

data: IWatchEventData

观察数据。

继承事件

Event

示例

ts
import { Leafer, Rect, WatchEvent } from 'leafer-ui'

const leafer = new Leafer({ view: window })

const rect = new Rect({ x: 100, y: 100, fill: '#32cd79', draggable: true })

leafer.add(rect)

leafer.on(WatchEvent.DATA, function (e: WatchEvent) {
    console.log(e.data) // changed list
})
js
import { Leafer, Rect, WatchEvent } from 'leafer-ui'

const leafer = new Leafer({ view: window })

const rect = new Rect({ x: 100, y: 100, fill: '#32cd79', draggable: true })

leafer.add(rect)

leafer.on(WatchEvent.DATA, function (e) {
    console.log(e.data) // changed list
})

Released under the MIT License.