foo_spider_monkey_panel icon indicating copy to clipboard operation
foo_spider_monkey_panel copied to clipboard

Add `on_startup_completed` (name pending)

Open TheQwertiest opened this issue 4 years ago • 4 comments

So that users can find out when it's safe to call other components and stuff.

TheQwertiest avatar Nov 29 '19 13:11 TheQwertiest

Other possible names: on_fb2k_initialization_done on_fb2k_initialized on_fb2k_ready

TheQwertiest avatar Nov 29 '19 13:11 TheQwertiest

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.

TheQwertiest avatar Dec 02 '19 18:12 TheQwertiest

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:

  1. before_config_read as of now, this is the only stage utiliized

  2. after_config_read

  3. before_library_init

  4. 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.

  5. before_ui_init

  6. 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

razielanarki avatar Jan 24 '22 14:01 razielanarki

Note to self: use after_ui_init stage for the corresponding event ('initStageComplete'? args or always after_ui_init?)

TheQwertiest avatar May 10 '23 16:05 TheQwertiest