How to use the piral-base.loadPilet function in piral-base

To help you get started, we’ve selected a few piral-base 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-core / src / helpers.tsx View on Github external
ws.onmessage = ({ data }) => {
          const meta = JSON.parse(data);
          const getter = getDependencyResolver(globalDependencies, getDependencies);
          const fetcher = (url: string) =>
            fetch(url, {
              method: 'GET',
              cache: 'reload',
            }).then(m => m.text());
          loadPilet(meta, getter, fetcher).then(pilet => {
            try {
              const newApi = createApi(pilet);
              context.injectPilet(pilet);
              pilet.setup(newApi);
            } catch (error) {
              console.error(error);
            }
          });
        };

piral-base

The base library for creating a Piral instance.

MIT
Latest version published 9 days ago

Package Health Score

84 / 100
Full package analysis