How to use the piral-core.buildName 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
unregisterModal(name) {
          const id = buildName(pilet, name);
          context.unregisterModal(id);
        },
      };
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) {
github smapiot / piral / src / packages / piral-menu / src / create.ts View on Github external
unregisterMenu(name) {
          const id = buildName(pilet, name);
          context.unregisterMenuItem(id);
        },
      };
github smapiot / piral / src / packages / piral-feeds / src / create.ts View on Github external
createConnector(resolver) {
          const id = buildName(target.name, feeds++);
          const options = createFeedOptions(id, resolver);
          const invalidate = () => context.createFeed(options.id);

          if (options.immediately) {
            context.loadFeed(options);
          } else {
            invalidate();
          }

          const connect = (component => withFeed(component, options) as any) as FeedConnector;
          connect.invalidate = invalidate;
          return connect;
        },
      };
github smapiot / piral / src / packages / piral-modals / src / create.ts View on Github external
showModal(name, options) {
          const dialog = {
            name: buildName(pilet, name),
            alternative: name,
            options,
            close() {
              context.closeModal(dialog);
            },
          };
          context.openModal(dialog);
          return dialog.close;
        },
        registerModal(name, arg, defaults) {
github smapiot / piral / src / packages / piral-dashboard / src / create.ts View on Github external
unregisterTile(name) {
          const id = buildName(pilet, name);
          context.unregisterTile(id);
        },
      };
github smapiot / piral / src / packages / piral-search / src / create.ts View on Github external
unregisterSearchProvider(name) {
          const id = buildName(pilet, name);
          context.unregisterSearchProvider(id);
        },
      };
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-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-containers / src / create.ts View on Github external
createState(options) {
          const actions = {};
          const id = buildName(target.name, containers++);
          const cb = dispatch => context.replaceState(id, dispatch);
          context.createState(id, options.state);
          Object.keys(options.actions).forEach(key => {
            const action = options.actions[key];
            actions[key] = (...args) => action.call(api, cb, ...args);
          });
          return component => withPiletState(component, id, actions) as any;
        },
      };