oft/module/hooks/oft.preRegisterTweak.mjs

19 lines
993 B
JavaScript

/*
This hook is used to give external modules or systems the ability to interact
with the tweak registration lifecycle to do something before a tweak is registered
or being able to prevent registration of incompatible tweaks.
The hook receives a string indicating which tweak this hook is being called for
and a boolean value indicating if the tweak is considered invasive. Returning
explicit false prevents that tweak from being registered.
Invasive tweaks are additions that manipulate or override Document or helper
classes. An example of an invasive tweak is the "toggleMouseBroadcast",
tweak which replaces the existing "CONFIG.Canvas.layers.controls.layerClass"
class, most of these tweaks do smartly extend from the same CONFIG class
that they replace, however if they override a part of the class that
other modules/systems rely on, then that is a good time to block that
specific tweak's registration.
Call Signature: (tweakKey: string, isInvasive: boolean) => (void | boolean)
*/