How to use the snack-sdk.SnackSession function in snack-sdk

To help you get started, we’ve selected a few snack-sdk 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 expo / snack-web / snack / workers / snack-session.worker.js View on Github external
self.addEventListener('message', event => {
  const { type, payload } = event.data;

  switch (type) {
    case 'INIT': {
      // Initialize the snack session
      snackSession = new SnackSession(payload);
      snackSession.expoApiUrl = nullthrows(process.env.API_SERVER_URL);

      snackSession.addStateListener(state => self.postMessage({ type: 'STATE', payload: state }));

      snackSession.addPresenceListener(event =>
        self.postMessage({ type: 'PRESENCE', payload: event })
      );

      snackSession.addErrorListener(errors => self.postMessage({ type: 'ERROR', payload: errors }));

      snackSession.addLogListener(log => self.postMessage({ type: 'LOG', payload: log }));

      snackSession.dependencyErrorListener = error =>
        self.postMessage({ type: 'DEPENDENCY_ERROR', payload: error });

      // Send the initial details
github expo / snack-web / src / client / workers / snack-session.worker.js View on Github external
create(options) {
    session = new SnackSession(options);
  },

snack-sdk

The Expo Snack SDK

MIT
Latest version published 11 days ago

Package Health Score

73 / 100
Full package analysis

Similar packages