WebKit JS callback functions(3)
来源:互联网 发布:tensorflow图像预处理 编辑:程序博客网 时间:2024/05/22 09:48
In JSC, we can implement an JS function easily, however it may be hard for us to implement an JS function with one or more callback functions, like:
window.ourOwnFunction("param1", "param2", function(e){alert(e);});
Now I will explain how to implement this.
First, given that we have implemented this JS extention: window.ourOwnFunction("param1", "param2")
Second, define this function as:
[Custom] ourOwnFunction(in DOMString, in DOMString, in [Callback, optional] OurCallbackFunc);
[Custom] is optional if you will implement the whole class of "OurCallbackFunc", else please use it to implement it on our own way.
Then, add four new files:
OurCallback.idl
OurCallback.h
JSOurCallbackCustom.h
JSOurCallbackCustom.cpp
Finally, modify the following files to implement the function invoking:
JSDOMWindowCustom.cpp
DOMWindow.cpp
Normally, we have done the process.
Now, let's test it.
<sctipt>
function callbackFunc(e)
{ alert(e); }
window.ourOwnFunction('a', 'b', callbackFunc);
</script>
- WebKit JS callback functions(3)
- JQuery Callback and Functions
- Block callback functions simulink
- Callback Functions in JavaScript
- Callback Functions Tutorial
- Callback Functions Tutorial
- Callback functions in GLFW
- VIX API Concepts : Callback Functions
- 回调函数(Callback Functions)
- js callback
- js callback
- JS Functions
- JS Functions
- How To Use RPC Callback Functions
- Implementing Callback Functions Using Delegates In C++
- JS学习(3)----Functions、Objects、variables
- JS 回调(CallBack)
- JS 回调(CallBack)
- Eclipse的Ctrl+Shift+o自动补全引用类
- 基于NAM的多子模式图像表示和检索方法研究
- myeclipse快捷键调试
- 基于内容图像检索的若干技术研究
- 移植wireless tools for liunx
- WebKit JS callback functions(3)
- Write blog via 3DS in CSDN
- Libevent参考手册:前言
- wince5.0 2010年补丁包下载地址
- 很美的句子……
- 你必须知道的Windows Phone 7开发
- 变态的规则(百度之星06第三题)
- sizeof
- centos 5.5 yum 升级 php