plugin.tsx 749 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { definePluginCreator } from '@flowgram.ai/core';
  6. import type { WorkflowContainerPluginOptions } from './type';
  7. import { NodeIntoContainerService } from '.';
  8. export const createContainerNodePlugin = definePluginCreator<WorkflowContainerPluginOptions>({
  9. onBind: ({ bind }) => {
  10. bind(NodeIntoContainerService).toSelf().inSingletonScope();
  11. },
  12. onInit(ctx, options) {
  13. ctx.get(NodeIntoContainerService).init();
  14. },
  15. onReady(ctx, options) {
  16. if (options.disableNodeIntoContainer !== true) {
  17. ctx.get(NodeIntoContainerService).ready();
  18. }
  19. },
  20. onDispose(ctx) {
  21. ctx.get(NodeIntoContainerService).dispose();
  22. },
  23. });