How to use the piral-core.withApi function in piral-core

To help you get started, we’ve selected a few piral-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smapiot / piral / src / packages / piral-modals / src / create.ts View on Github external
registerModal(name, arg, defaults) {
          const id = buildName(pilet, name);
          context.registerModal(id, {
            pilet,
            name,
            component: withApi(context.converters, arg, api, 'modal'),
            defaults,
          });
        },
        unregisterModal(name) {
github smapiot / piral / src / packages / piral-search / src / create.ts View on Github external
function toChild(content: SearchResultType, api: PiletApi, context: GlobalStateContext): ReactChild {
  if (typeof content === 'string' || isValidElement(content)) {
    return content;
  } else {
    const component = withApi(context.converters, content, api, 'extension');
    return createElement(component);
  }
}
github smapiot / piral / src / packages / piral-menu / src / create.ts View on Github external
registerMenu(name, arg, settings?) {
          if (typeof name !== 'string') {
            settings = arg;
            arg = name;
            name = next++;
          }

          const id = buildName(pilet, name);
          context.registerMenuItem(id, {
            pilet,
            component: withApi(context.converters, arg, api, 'menu'),
            settings: getSettings(defaultSettings, settings),
          });
        },
        unregisterMenu(name) {
github smapiot / piral / src / packages / piral-dashboard / src / create.ts View on Github external
registerTile(name, arg, preferences?) {
          if (typeof name !== 'string') {
            preferences = arg;
            arg = name;
            name = next++;
          }

          const id = buildName(pilet, name);
          context.registerTile(id, {
            pilet,
            component: withApi(context.converters, arg, api, 'tile'),
            preferences: getPreferences(defaultPreferences, preferences),
          });
        },
        unregisterTile(name) {