mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 10:58:12 +08:00
Break out helper functions from the frontend's managers and stores (#3920)
* Move destructor call to each manager/store constructor for safety * Break out utility functions
This commit is contained in:
@@ -8,6 +8,8 @@ let editorRef: Editor | undefined = undefined;
|
||||
let abortController: AbortController | undefined = undefined;
|
||||
|
||||
export function createFontsManager(editor: Editor) {
|
||||
destroyFontsManager();
|
||||
|
||||
editorRef = editor;
|
||||
abortController = new AbortController();
|
||||
|
||||
@@ -66,6 +68,5 @@ export function destroyFontsManager() {
|
||||
|
||||
// Self-accepting HMR: tear down the old instance and re-create with the new module's code
|
||||
import.meta.hot?.accept((newModule) => {
|
||||
destroyFontsManager();
|
||||
if (editorRef) newModule?.createFontsManager(editorRef);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user