evCreate API 5.7 Help

Calling evCreate API in Browser Console

You can explore the evCreate API by calling its functions in the console of the browser tab that hosts the Canvas Envision Editor.

Calling functions in the browser console

To call evCreate API functions in the browser console:

  1. Create or open an Envision document in the Canvas Envision Creator.

    Blank new Envision document opened in the Envision Creator
  2. Open the browser console.

    Browser console opened for the blank new Envision document
  3. In the browser console, enter the evCreate API function you want to call and press Enter.

    Calling await window.evCreate.document.AddPage() in the browser console
  4. Explore and process the return value of the called function.

    A new page item created by calling await window.evCreate.document.AddPage() in the browser console
  5. Explore the result of calling the function in the document and compare it against the return value.

    A new blank page added to the document by calling await window.evCreate.document.AddPage()

Opening the browser console

You can open the browser console for a given web page in multiple ways. The general procedure is the same across the supported browsers:

  1. Open the Developer tools browser pane, either:

    • Press F12.

    • Press Ctrl+Shift+I.

    • On the browser toolbar, click the ellipsis button and then More tools > Developer tools.

      The More tools > Developer tools browser menu option
  2. In the Developer tools browser pane, click the Console tab on a toolbar of the upper or lower pane section.

    Console tabs in the Developer tools browser pane
  3. If the Console tab is not visible on the pane section toolbar, click the More tools button on this toolbar and then click Console from the menu.

    The More tools > Console option of the Developer tools browser pane toolbar

Function call expression statement

When calling an evCreate API function in the browser console, you should enter it as follows:

await window.evCreate.namespace.Function()

Where:

await

A global JS operator that pauses the function execution until the returned Promise is fulfilled or rejected. If the Promise is fulfilled, the console outputs a value (data object) unwrapped from the Promise. If the Promise is rejected, the console throws an error. You can omit await for functions that return a standard JS datatype value, custom data object, or nothing. Calling a function that returns a Promise without await will output the unwrapped Promise to the console if this Promise is fulfilled.

Function calls in the browser console with and without await

window

A global variable representing the browser window that runs the Canvas Envision Editor and exposes the evCreate API to external systems. For quick input, you can omit window globally in the browser console. In such a case, the console implicitly assumes the window namespace. However, you should explicitly specify it in the namespaces nested in compound calls, JS scripts, and files.

Function calls in the browser console with and without the window namespace

evCreate

The namespace of the evCreate API that provides access to the API sections represented as nested namespaces.

namespace

The namespace of an evCreate API section that represents items, objects, or functionality and provides access to functions for working with them, such as document, page, object, object.text, object.text.edit, and so on.

Function()

A function in a given API namespace to be executed with the provided arguments. Depending on the function declaration, you can or must provide no, one, or more than one argument.

For example:

await window.evCreate.document.AddPage(1, false, "New Page")

Closing the browser console

You can close the opened browser console for a given web page in multiple ways. The general procedure is the same across the supported browsers, either:

  • Press F12.

  • Press Ctrl+Shift+I.

  • On the right side of the Developer tools browser pane toolbar, click X.

    The Close DevTools button on the Developer tools browser pane toolbar
07 February 2025