Let us take code as an example:
class MinimapSetting(sublime_plugin.EventListener):
def on_load(self, view):
show_minimap = view.settings().get('show_minimap')
if show_minimap:
view.window().set_minimap_visible(True)
elif show_minimap is not None:
view.window().set_minimap_visible(False)
It is used the sync callback, instead of the async version (on_load_async
).
Let us supposed someone did a Find and Replace
in a project, which replaced things in 1.000 files. Therefore, Sublime Text will open 1.000 views. In this context, are on_load
and on_load_async
exchangeable? Or does on_load_async
is more costly/expensive, if it will be called 1.000 times in a row?
Note: Disregard other scenarios where on_load_async
must be used because it holds a slightly expensive code, which could actually be better running off in a separate thread, other than blocking the Sublime Text main async thread.