foo_spider_monkey_panel
foo_spider_monkey_panel copied to clipboard
Add `on_startup_completed` (name pending)
So that users can find out when it's safe to call other components and stuff.
Other possible names:
on_fb2k_initialization_done
on_fb2k_initialized
on_fb2k_ready
Note to self: implementing such callback might be impossible. Investigate if it's possible to create at least a bool check, smth like IsFoobarReady()
. IsInitializing()
method in fb2k API might be the one.
i've stumbled upon something hopefully useful:
the init_stage_callback
impl. in dllmain.cpp
could have stages that could be used for such a thing
https://github.com/TheQwertiest/foo_spider_monkey_panel/blob/00b8cee40801f9594fcb45fbd578e9b91c1304a3/foo_spider_monkey_panel/dllmain.cpp#L144-L150
these are the stages available:
-
before_config_read
as of now, this is the only stage utiliized -
after_config_read
-
before_library_init
-
after_library_init
this would be my candidate, as per Peter's comment in the source:since foobar2000 v2.0,
after_library_init
is fired out of order with the rest, after asynchronous library init has completed. -
before_ui_init
-
after_ui_init
personal note: this one could be used for first execution frame (with the scripts being already loaded/compiled), as to have the panel widths/height etc readily avaliable from the script-global context on script load.
see: https://github.com/TheQwertiest/foobar2000-sdk/blob/238dfd951322d07b0288c751c6aedd555bb620cb/SDK/initquit.h#L22-L32
Note to self: use after_ui_init stage for the corresponding event ('initStageComplete'? args or always after_ui_init?)