Discussion:
Function assignment
t***@gmail.com
2013-05-15 11:18:19 UTC
Permalink
Hi

Suppose you have a plugin providing a function called "overwriteMe()". What is the behaviour of the following javascript:

----------------------------
newFunction: function() { alert("Hello World!"); }

var plugin = document.getElementById("mySpecialPlugin");
plugin.overwriteMe = newFunction;
plugin.overwriteMe();

----------------------------

First of all, is it possible to do this with NPAPI?

Secondly if the assignment ends in an NPO_SetProperty(). I thought this was okay, since it would might be possible to then use the value from this when invoking the method later on. However, the value is an NPObject and I can't see how this later on should be used for method invoke. Furthermore, I guess it's wrong to handle "overwriteMe" as a method and a property in the plugin.

/Christian

Loading...