how to start the javascript function in my firebreath plugin

狂风中的少年 提交于 2019-12-25 02:57:56

问题


I have implemented a javascript function in firebreath plugin file 'MyPluginProject.cpp'

like

void MyPluginProjectAPI::MyJsThings()
{
    std::string argument = "my javascript functionality goes here";

    m_host->evaluateJavaScript(argument);
}

Now to use the MyJsThings in my webpages I have created <object> for the plugin. Now I can call MyJsThings by calling it in my javascript code like below

plugin.MyJsThings()

This is the very basic thing. Now I don't want to call MyJsThings method in my javascript. I am just creating object for the plugin by below code.

<object type="application/x-my-plugin-project" id="plugin" style="width:0px;height:0px;">
        <param id="onload" value="alert('Plugin Loaded');"> 
</object>

When I load my page I want my method MyJsFunction has to be called so that my js functionalities will do the remaining things.
My main aim is to call the function MyJsFunction when the plugin is loaded, not in any where in the html script.


回答1:


Sounds like what you really want is to use the onPluginLoad method in your PluginCore-derived object.

Note that you would have found this if you'd read the getting started pages on the website and/or looked through the FBTestPlugin example -- highly recommended reading.



来源:https://stackoverflow.com/questions/24504743/how-to-start-the-javascript-function-in-my-firebreath-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!