IRC Log Viewer » #firebreath » 2013-10-25

IRC Nick Time (GMT-7) Message
diorcety 00:10 taxilian: yes
[[LES]] 14:10 I have an fb plugin that is loaded multiple times in the dom. When the plugin's api is invoked from javascript, is there a way to get a handle to correct window/host for the instance that the javascript called?
taxilian 15:10 I'm not sure I understand the question
but if I understand you correctly, the m_host variable will be the one belonging to the page that called you
and the plugin object will be the one hosted in that page
so pluginwindow and everything you access through the plugin object (the one that extends FB::PluginCore) will be the ones you want
so basically yes, you don't have to do anything special for that, it already works
[[LES]] 15:10 hmmm, maybe i didn't ask correctly...
taxilian 15:10 could be
[[LES]] 15:10 The page contain multiple instances of the plugin (but the plugin only loads once) - think tabs. The plugin only seems to load once. So, is the m_host variable always the correct host for that instance of the plugin?
taxilian 15:10 yes
m_host is for that instance
[[LES]] 15:10 ok...that was my confusion.
taxilian 15:10 global variables would be global to all
[[LES]] 15:10 i was assuming m_host was global as well
thank you for the help
taxilian 15:10 yw
[[LES]] 15:10 One more question (maybe :) )...
So, should instance variables on the instance of the class that extends plugin core be "thread safe" (for multiple instances)?
taxilian 15:10 err no, but yes
multiple instances all run on the same thread
so that's not an issue
[[LES]] 15:10 sorry....i know thread is the wrong word there
taxilian 15:10 but there is no guarantee of things being threadsafe if you create your own threads, you'll need to do some synchronization there
there will not be any conflict between instance variables
only globals
of which there are very very few in FireBreath, and all generally read only
[[LES]] 15:10 my problem is i get access violations when i open multiple of these in quick succession. I thought i might have had a shared data problem, but it may be something else.
taxilian 16:10 very doubtful that it's a shared data issue unless you're using static variables
or globals