Bluestep JS Documentation
    Preparing search index...

    Class PolyglotClass

    The functions of the Polyglot object allow to interact with values from other polyglot languages.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Parses and evaluates the sourceCode with the interpreter identified by languageId. The value of sourceCode is expected to be a string (or convertible to one). Returns the evaluation result, depending on the sourceCode and/or the semantics of the language evaluated.

      Exceptions can occur when an invalid languageId is passed, when the sourceCode cannot be evaluated by the language, or when the executed program throws one.

      Parameters

      • languageId: string
      • sourceCode: string

      Returns any

    • Parses the file sourceFileName with the interpreter identified by languageId. The value of sourceFileName is expected to be a string (or convertible to one), representing a file reachable by the current path. Returns an executable object, typically a function.

      Exceptions can occur when an invalid languageId is passed, when the file identified by sourceFileName cannot be found, or when the language throws an exception during parsing (parse time errors, e.g. syntax errors). Exceptions thrown by the evaluated program are only thrown once the resulting function is evaluated.

      Parameters

      • languageId: string
      • sourceFileName: string

      Returns any

    • Exports the JavaScript value under the name key (a string) to the polyglot bindings.

      If the polyglot bindings already had a value identified by key, it is overwritten with the new value. Throws a TypeError if key is not a string or missing. The value may be any valid Polyglot value.

      Parameters

      • key: string
      • value: any

      Returns void

    • Imports the value identified by key (a string) from the polyglot bindings and returns it.

      If no language has exported a value identified by key, null is returned. Throws a TypeError if key is not a string or missing.

      Parameters

      • key: string

      Returns any