# Function: onAttributesUpdate

onAttributesUpdate(handler: AttributesUpdateEventHandler): void

开始监听 属性列表更新事件

example

import mogs, { attributeSystem } from '@timi/mogs-sdk';
// ...
// 开始监听
attributeSystem.onAttributesUpdate((event) => {
  console.log('Attribute list changed:', event.previousValue, event.currentValue);
});
1
2
3
4
5
6

# 参数:

属性 类型 描述
handler AttributesUpdateEventHandler 要注册的属性列表更新事件处理函数,可同说注册多个事件处理函数。

AttributesUpdateEventHandler: MogsEventHandler‹AttributesUpdateEvent

AttributesUpdateEvent结构

属性 类型 描述
currentValue ReadonlyClone‹Attribute[]› 数据改变后的值
previousValue ReadonlyClone‹Attribute[]› 数据改变前的值
type Update 事件类型,由具体的事件构造时提供

# 返回值:

void