[Refactor] Extract global window litegraph as a composable (#2380)

This commit is contained in:
Chenlei Hu
2025-01-29 16:53:26 -08:00
committed by GitHub
parent 94065b6c21
commit 7bdad335ca
2 changed files with 30 additions and 24 deletions

View File

@@ -0,0 +1,27 @@
// @ts-strict-ignore
import {
ContextMenu,
DragAndScale,
LGraph,
LGraphBadge,
LGraphCanvas,
LGraphGroup,
LGraphNode,
LLink,
LiteGraph
} from '@comfyorg/litegraph'
/**
* Assign all properties of LiteGraph to window to make it backward compatible.
*/
export const useGlobalLitegraph = () => {
window['LiteGraph'] = LiteGraph
window['LGraph'] = LGraph
window['LLink'] = LLink
window['LGraphNode'] = LGraphNode
window['LGraphGroup'] = LGraphGroup
window['DragAndScale'] = DragAndScale
window['LGraphCanvas'] = LGraphCanvas
window['ContextMenu'] = ContextMenu
window['LGraphBadge'] = LGraphBadge
}