Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MonacoContext

Hierarchy

Index

Properties

id

id: string

Readonly options

Methods

getMonaco

  • Finds the current instance of the monaco editor, if it was created already. Use this to interact with the editor via JavaScript. See also the monaco editor API docs.

    Returns IStandaloneCodeEditor | undefined

    The current monaco editor instance. undefined in case the editor was not created yet.

tryWithMonaco

  • tryWithMonaco<TReturn>(handler: (editor: IStandaloneCodeEditor) => TReturn, defaultReturnValue: TReturn): TReturn
  • tryWithMonaco<TReturn>(handler: (editor: IStandaloneCodeEditor) => TReturn): TReturn | undefined
  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    • handler: (editor: IStandaloneCodeEditor) => TReturn

      Handler that is invoked with the current monaco editor instance.

    • defaultReturnValue: TReturn

      Default value that is returned when no editor exists currently, or when the handler throws.

    Returns TReturn

    The return value of the handler, or the default return value if either no editor exists or the handler throws an error.

  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    Returns TReturn | undefined

    The return value of the handler, or undefined if either no editor exists or the handler throws an error.

withMonaco

  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    Returns TReturn

    The return value of the handler, or the default return value if no editor exists.

  • Calls the given handler with the current monaco editor instance if it exists.

    Type parameters

    • TReturn

      Type of the return value.

    Parameters

    Returns TReturn | undefined

    The return value of the handler, or undefined if no editor exists.

Generated using TypeDoc