IRC Log Viewer » #firebreath » 2011-11-27

IRC Nick Time (GMT-7) Message
staylor 09:11 hmm, so do you end up using a timer to capture double clicks manually?
raymond1 19:11 taxilian_away, FireBreathBot : I am a little puzzled about the constuctor of JSAPIAuto, How can the browser know which kind of object I have in my plugin, say I have a MyPluginAPI::MyObj class derived from JSAPIAuto and override Construct(), How can the browser know it? since it's not the MyPluginAPI object which been returned by MyPlugin's createJSAPI method.
is there any real example code on this?
linearray 19:11 you mean how you can have several JSAPIs?
I'm afraid I don't understand the question
raymond1 19:11 linearray: I mean I want to do obj = new myObj() , and taxilian mentioned that there are Construct() in JSAPI etc.
while I am wondering, how can browser know there is a myObj, since there are no way to export the info to the browser.
I know I can return another JSAPI by myPlugin.createObj() etc.
linearray 19:11 ah I see
but don't have an answer
raymond1 19:11 ;) now I do a wrapper like window.myObj = function(){ return myPlugin.createObj(); } then I can call obj = new myObj()
but try to find a better solution
linearray 19:11 must be real important to you :)
raymond1 19:11 yes
taxilian 21:11 raymond1: when you do new plugin().something(1, 2, 3) it *should* call construct on the something JSAPI object (the object that is returned by the property called something) with those parameters; it should then create a new instance and return it
I have never used it myself
raymond1 21:11 taxilian, if something is a registered property, then it seems to me "new" won't work?
since it's a returned jsapi object, so it should be plugin().something return a jsapi object, then "new" on this object? that should be the same as a = plugin.createobj(), then new a(1,2,3)?
taxilian 21:11 raymond1: please re-read my message
what I explained is how it works
you would have a property called something
that returns the instance of some JSAPI object
which is probably a factory of some kind
when you do new plugin().something it will first request that property
and then it will call construct on that JSAPI object
it should create a JSAPI object (may be the same object, may not) and return it
raymond1 21:11 taxilian, ok, got it. will try it out
taxilian 21:11 you might say that new plugin().something() is the same as plugin().something.createObj()
though construct was implemented, it was not implemented nor tested by me
so I don't know for certain that it works, but it should
raymond1 22:11 taxilian, Ok, I tried it out. and now I see what this constructor means. the "new" operation is redirect to an object's Construct() function. just like some operator override for new. that's interesting