# Function: offAttributeUpdate

offAttributeUpdate(handler?: AttributeUpdateEventHandler): void

停止监听属性更新事件

example

// 导入属性系统
import { attributeSystem } from '@timi/mogs-sdk';
// ...
// 定义一个事件
const handler: AttributeUpdateEventHandler = (event) => {
  console.log(event.previousValue, event.currentValue);
};
//开始监听 Attributes 改变事件
attributeSystem.onAttributeUpdate(handler);
// ...
// 移除刚刚添加的事件处理函数
attributeSystem.offAttributeUpdate(handler);
1
2
3
4
5
6
7
8
9
10
11
12

# 参数:

属性 类型 描述
handler? AttributeUpdateEventHandler 要取消注册的 Event Handler;若未提供,则取消注册所有事件处理函数。

AttributeUpdateEventHandler: MogsEventHandler‹AttributeUpdateEvent

AttributeUpdateEvent结构

属性 类型 描述
attributeId number (发生变更的)属性 ID
currentValue ReadonlyClone‹Attribute | undefined› 数据改变后的值
previousValue ReadonlyClone‹Attribute | undefined› 数据改变前的值
type AttributeUpdateEventType 事件类型,由具体的事件构造时提供

# 返回值:

void