Managing Assets
JS SDK comes with configurable options that enables developers to switch the working environment easily.
While downloading the SDK, imi-environments.js file comes pre configured with ‘default’ environment. The ‘default’ environment is based upon your setup at the platform.
This file can host multiple environments in JSON format.
var imiEnvironments = {
"target": "default",
"default": {
"asset": {
"appId": ‘<your App ID here>’,
"appSecret":’<your secret here>’,
"pathConfig": {
"assetPath": "/assets/",
"root": "/"
}
Parameters | Description |
---|---|
target | Specifies the current target environment for JS SDK. The environments are defined locally within the same file. |
pathConfig | If the website is hosted within a sub-folder, use pathConfig parameter to specify folders: //Example var pathConfig = { "assets": "/website_root/assets/", "root": "/ website_root/" } |
pathConfig.assets | Folder ‘assets’ is the relative path to JS SDK including ‘manifest’ folder. By default, this location is derived as window.location.origin + '/assets'; //Sample Code: "assets": "/website_root/assets/", |
pathConfig.root | Folder containing ‘sw.j’s file. Important! ‘sw.js’ file should always be in website root for Push notifications to work properly. |
Updated about 1 year ago