javascript - Call class member of another JSAPI object from root JSAPI object (created by prepscript) -


looking @ this page firebreath.org found excerpt:

you can return jsapi instance javascript caller in form of jsapiptr , use make calls on different jsapi object, e.g. plugin().method1().method2() call method1() on root jsapi object , method2() on jsapi object returned in first call.

any examples?

my objective:

i want call class's (which implementing fb:jsapiauto) member (say abcapi:fb:jsapiauto ) through root jsapi object created automatically prepscript i.e. same described above creating jsapiptr of class. right here?

also, whether jsapi object of abcapi created me should also plugin reference or not?

i went through this page too, not able follow.

till now, create method returning fb::jsapiptr had value of class (implementing fb::jsapiauto) pointer.

a little example great here!

*another doubt: how expose simple c++ class(not extending firebreath class) javascript can access members?*i found v8 javascript engine thing.don't have idea this. want plugin available other browsers apart chrome.do need this?

okay, there couple of things here. first, prep script doesn't create jsapi objects -- fbgen. important distinction because run prep script many times, fbgen run once create project skeleton.

next, you're making far more complicated needs be. jsapi object class object; if have reference in c++, can call member of other class other object. there nothing magical it, except maybe when give javascript, , methods expose javascript ones can use.

what haven't explained reference second jsapi object comes from. passing in javascript? if so, things more tricky, , you'll have call using ->invoke method on other javascript object passed in page. did create in c++? if so, use other object.

as whether or not hypothetical abcapi object should plugin reference or not, that's totally you. root jsapi object doesn't need one, it's convenience in case want access plugin.

for examples, go @ fbtestplugin in firebreath code base. has examples of nesting jsapi objects , such.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -