How to use the telejson.isJSON function in telejson

To help you get started, we’ve selected a few telejson 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 storybookjs / storybook / lib / channel-postmessage / src / index.ts View on Github external
private handleEvent(rawEvent: RawEvent): void {
    try {
      const { data } = rawEvent;
      const { key, event } = typeof data === 'string' && isJSON(data) ? parse(data) : data;
      if (key === KEY) {
        logger.debug(`message arrived at ${this.config.page}`, event.type, ...event.args);
        this.handler(event);
      }
    } catch (error) {
      logger.error(error);
      // debugger;
    }
  }
}

telejson

A library for teleporting rich data to another place.

MIT
Latest version published 9 months ago

Package Health Score

77 / 100
Full package analysis