In javascript my code will be as follows:
function start() {
var start = document.getElementById('start'); //start is object for my plugin
if(start){
getAsLoad(start);
}
}
function getAsLoad(startObj) {
var load = startObj.startMethod();
// Handle progress, success, and errors
load.onload = loaded;
load.onerror = errorHandler;
}
function loaded(evt) {
var StringData = evt.target.result;
alert(StringData);
} // Like loaded similar code for errorHandling
How to start it in plain NPAPI Plugin , the event handling mechanism , I know in firebreadth it is a cakewalk , as per my requirement i can't use it. so this kind of thing i have to implement in NPAPI Plugin. Thanks in advance.
The easiest way to do it would be to have javascript call your plugin.
If you want to do it from the plugin, though, you just get the DOM window NPObject and start Invoking methods and getting properties, etc.
For example, to get "start" you could call getProperty with "document", then call Invoke on the resulting NPObject with "getElementById" and "start" as the parameter.
The tricky part comes up if you want a callback into your plugin, in which case you'll have to create an NPObject that handles InvokeDefault which is what will be called when the callback fires. It's a bit of a pain, but from there the details are the same as javascript, just a little more cumbersome