mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
add fscript_set_global_object
This commit is contained in:
parent
3390b185e9
commit
20365c638e
@ -1,4 +1,6 @@
|
||||
# 最新动态
|
||||
2022/02/18
|
||||
* 增加函数fscript\_set\_global\_object。
|
||||
|
||||
2022/02/16
|
||||
* 增加函数ui\_loader\_load\_widget\_from\_xml。
|
||||
|
@ -2736,12 +2736,23 @@ tk_object_t* fscript_get_global_object(void) {
|
||||
return s_global_obj;
|
||||
}
|
||||
|
||||
ret_t fscript_global_init(void) {
|
||||
tk_object_t* obj = object_default_create_ex(FALSE);
|
||||
return_value_if_fail(obj != NULL, RET_BAD_PARAMS);
|
||||
ret_t fscript_set_global_object(tk_object_t* obj) {
|
||||
TK_OBJECT_UNREF(s_global_obj);
|
||||
|
||||
s_global_obj = object_locker_create(obj);
|
||||
TK_OBJECT_UNREF(obj);
|
||||
TK_OBJECT_REF(obj);
|
||||
s_global_obj = obj;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t fscript_global_init(void) {
|
||||
if (s_global_obj != NULL) {
|
||||
tk_object_t* obj = object_default_create_ex(FALSE);
|
||||
return_value_if_fail(obj != NULL, RET_BAD_PARAMS);
|
||||
|
||||
s_global_obj = object_locker_create(obj);
|
||||
TK_OBJECT_UNREF(obj);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
@ -330,6 +330,16 @@ ret_t fscript_eval(tk_object_t* obj, const char* script, value_t* result);
|
||||
*/
|
||||
ret_t fscript_global_init(void);
|
||||
|
||||
/**
|
||||
* @method fscript_set_global_object
|
||||
* 用于替换默认的全局对象。
|
||||
* >仅限于在系统初始化时调用。
|
||||
* @param {tk_object_t*} obj 全局对象。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t fscript_set_global_object(tk_object_t* obj);
|
||||
|
||||
/**
|
||||
* @method fscript_register_func
|
||||
* 注册全局自定义函数。
|
||||
|
Loading…
Reference in New Issue
Block a user