Creates a snack session on the web. Multiple mobile devices can connect to the same session and each one will be updated when new code is pushed.
Parameters
options
objectoptions.files
ExpoSnackFiles The initial React Native code.options.name
string? Name shown if this Snack is saved.options.description
string? Descriptions shown if this Snack is saved.options.sessionId
string? Can be specified if you want a consistent url. This is a global namespace so make sure to use a UUID or scope it somehow if you use this.options.sdkVersion
string? Determines what version of React Native is used on the mobile client. Defaults to 15.0.0 which maps to React Native 0.42.0. If you specify a different version, make sure to save that version along with the code. Code from one SDK version is not guaranteed to work on others.options.verbose
boolean? Enable verbose logging mode.
Starts the session.
Returns Promise<void> A promise that resolves when the session is started.
Stops the session.
Returns Promise<void> A promise that resolves when the session is stopped.
Returns a url that will open the current Snack session in the Expo client when opened on a phone. You can create a QR code from this link or send it to the phone in another way. See https://github.com/expo/snack-sdk/tree/master/example for how to turn this into a QR code.
Returns Promise<void> A promise that contains the url when fulfilled.
Upload an asset file that will be available in each connected mobile client
Returns Promise<string> A promise that contains the url when fulfilled
Push new code to each connected mobile client. Any clients that connect in the future will also get the new code.
Parameters
files
ExpoSnackFiles The new React Native code.
Returns Promise<void> A promise that resolves when the code has been sent. Does not wait for the mobile clients to update before resolving.
Add a listener to get notified of error events.
Parameters
callback
function (array) The callback that handles new error events. If there are no errors this will be called with an empty array. Otherwise will be called with an array of objects that each contain amessage
field.
Returns object A subscription object. Call .remove()
on this object so stop getting new events.
Add a listener to get notified of log events.
Parameters
callback
function (object) The callback that handles new log events. Will be called with an object containing amessage
field.
Returns object A subscription object. Call .remove()
on this object so stop getting new events.
Add a listener to get notified of presence events.
Parameters
callback
function (object) The callback that handles new presence events. Will be called with an object containing astatus
field.
Returns object A subscription object. Call .remove()
on this object so stop getting new events.
Uploads the current code to Expo's servers and return a url that points to that version of the code.
Returns Promise<object> A promise that contains an object with a url
field when fulfilled.
Adds a given module, along with any required peer dependencies, to the current project Reports errors to any registered DependendencyErrorListeners
Returns Promise<any>