diff --git a/README.md b/README.md index 4b936f1..fdfb905 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This SDK is **not** for a server-side NodeJS app. ## Installation -Add the following `script` tags to all pages where you need the SDK to be available: +Add the following `script` tags to all pages where you need to call the Pi Apps SDK: ```html diff --git a/SDK_reference.md b/SDK_reference.md index 57e2e3d..8a72e3d 100644 --- a/SDK_reference.md +++ b/SDK_reference.md @@ -1,5 +1,37 @@ # Client SDK reference: +## Initialization + +Add the following `script` tags to all pages where you need to call the Pi Apps SDK: + +```html + + +``` + +The config object passed to the init function accepts the following keys: +* `version` (string, required) - this is required to ensure compatibility of your app with newer SDK versions that might bring + breaking changes (in which case breaking changes will be implemented under a higher version number) +* `sandbox`: (boolean, optional) - this enables you to configure the SDK to run in the sandbox. + +### Using the SDK in sandbox mode: + +```html + + +``` + +You may now run your app in the sandbox environment (https://sandbox.minepi.com), provided you've configured +a development URL in the developer portal. Visit the developer portal by opening develop.pi in the Pi Browser +to configure this and view your Sandbox URL. + +> Typically, if you're using a framework or a boilerplate that supports it, you should be able to set up your +> sandbox flag to match your development environment. For example, most good Node boilerplates will set up the +> value of `process.env.NODE_ENV` to either `"development"` or `"production"`, and you could do something like: +> `Pi.init({ version: "2.0", sandbox: <%= process.env.NODE_ENV !== 'production' %> })`. This depends on your +> setup, but running the Pi SDK in sandbox mode will generally happen whenever your app is running in development. + + ## Authentication ```typescript