0.15.6 • Published 2 years ago

@ax/config-ui v0.15.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

config-ui

NOTICE

This feature is currently provided as a preview. Features and workflows may change; compatibility with future versions is not guaranteed.

Interface for web apps to exchange data with the library toolbox extension.

Usage

Install with npm

npm add @ax/config-ui

Functions

getInitializer(): Promise\<any>

Request the current initializer and return a Promise which resolves to the initializer object representation.

getInitializer().then((initializer) => {
  if (initializer === null) return;

  /* use initializer content */
  if (initializer.recipe === "Pancakes") {
    congratulateUserChoice();
  }
});

If no initializer is available it will be null.

Each property not set will be undefined.

setInitializer()

Send the initializer to the extension, which will transform it to a code representation and close the web app.

const initializer = {
  Recipe: `"Pancakes"`,
  Ingredients: {
    Egg: 4,
    Milk: 0.6,
    Flour: 0.3,
  },
};
setInitializer(initializer);

showMessage()

Display a message in a notification popup

showMessage("Hello User");