0

Thanks in advance .

I am creating one function as follows . //requestFile is implemented in NPAPI Plugin , Getting initFS as an NPObject when task is complete i am calling NPN_InvokeDefault on this object.

window.requestFile("test",true,initFS);
//After this function initFS is getting called.
function initFS(fs) {
 alert('Inside initFS'); //alert is coming.
 //testFunc is implemented in NPAPI Plugin, it will return true if it is get called
 alert(fs.testFunc());   // It is not getting called.
 alert(fs.testCall());   //It is not getting called.
 }
function testCall() {
alert('Inside testCall function');
}

I am not getting it which kind of object is returned from Plugin after calling NPN_InvokeDefault. and how to use it in javascript . Specifically i want to return NPObject specially for my plugin , and want to call Plugin methods from javascript.

How to use Asynchronous Javascipt functions with NPAPI Plugins ? any sample will be appreciated.

r_tex
  • 77
  • 9

1 Answers1

1

Use this (fiddle) as a starting point:

    var testcall=function() {
    alert('Inside testCall function');
    }

    var fs={
        testFunc: function(){console.log("succes")},
        testCall:testcall
    }


    //After this function initFS is getting called. 

    initFS(fs) //<--PASS in fs also

function initFS(fs) {
     alert('Inside initFS');
     //testFunc is implemented in NPAPI Plugin, it will return true if it is get called
     fs.testFunc();   // It is not getting called.
     fs.testCall();   //It is not getting called.
     }

You need to pass in the fs object into initFS

cube
  • 1,774
  • 4
  • 23
  • 33