-
Notifications
You must be signed in to change notification settings - Fork 207
View self watchValue string function function
XiongFangyu edited this page Nov 25, 2020
·
1 revision
观察对象, a.b.c b/c的变化走会走回调
当属性发生改变的时候,function会被调用. @overload fun(key:void, func:fun(new):void)
- @param var string 被观察对象
- @param filterFunc function @see WatchContext filterFunc: 只监听native端或lua或全部的修改变化 参数 context值为: WatchContext.NATIVE : 原生端改变值引起的变化 eg: watch_from_native WatchContext.LUA : lua端改变值引起的变化 eg: watch_from_lua filterFunc 参数可以直接使用 watch_from_lua | watch_from_native | watch_all
eg: watch(data.name, watch_all, function(new) print("监听到data.name的改变", new) end)
- @param callback function 回调格式:
function(string new)
end