|
16 | 16 | A live-update service for your NativeScript apps!
|
17 | 17 |
|
18 | 18 | <details>
|
19 |
| - <summary>What this is, and how it works (optional reading).</summary> |
| 19 | + <summary>*Optional reading: what this is, and how it works*</summary> |
20 | 20 |
|
21 | 21 | A NativeScript app is composed of XML/HTML, CSS and JavaScript files and any accompanying images, which are bundled together by the NativeScript CLI and distributed as part of a platform-specific binary (i.e. an .ipa or .apk file). Once the app is released, updating either the code (e.g. making bug fixes, adding new features) or image assets, requires you to recompile and redistribute the entire binary, which of course, includes any review time associated with the store(s) you are publishing to.
|
22 | 22 |
|
@@ -130,7 +130,7 @@ warm restart (`InstallMode.ON_NEXT_RESUME`), or a positive response to a user pr
|
130 | 130 |
|
131 | 131 | Note that Apple doesn't want you to prompt the user to restart your app, so use `InstallMode.IMMEDIATE` on iOS only for Enterprise-distributed apps (or when testing your app through TestFlight for instance).
|
132 | 132 |
|
133 |
| -> Check out the [demo](/demo) for a solid example. |
| 133 | +> 💁♂️ Check out the [demo](/demo) for a solid example. |
134 | 134 |
|
135 | 135 | ```typescript
|
136 | 136 | // import the main plugin classes
|
@@ -202,18 +202,33 @@ CodePush.sync({
|
202 | 202 |
|
203 | 203 | </details>
|
204 | 204 |
|
| 205 | +#### When should this check run? |
205 | 206 | It's recommended to check for updates more than once in a cold boot cycle,
|
206 |
| -so it may be easiest to tie this check to the `resume` event: |
| 207 | +so it may be easiest to tie this check to the `resume` event (which usually also runs on app startup): |
207 | 208 |
|
208 | 209 | ```typescript
|
209 | 210 | import * as application from "tns-core-modules/application";
|
| 211 | +import { CodePush } from "nativescript-code-push"; |
210 | 212 |
|
211 | 213 | // add this in some central place that's executed once in a lifecycle
|
212 | 214 | application.on(application.resumeEvent, () => {
|
213 | 215 | CodePush.sync(...);
|
214 | 216 | });
|
215 | 217 | ```
|
216 | 218 |
|
| 219 | +<details> |
| 220 | + <summary>Click here to see a JavaScript example</summary> |
| 221 | + |
| 222 | +```js |
| 223 | +var application = require("tns-core-modules/application"); |
| 224 | + |
| 225 | +application.on(application.resumeEvent, function () { |
| 226 | +// call the sync function |
| 227 | +}); |
| 228 | +``` |
| 229 | + |
| 230 | +</details> |
| 231 | + |
217 | 232 | ## Releasing an update
|
218 | 233 | Once your app has been configured and distributed to your users, and you've made some code and/or asset changes,
|
219 | 234 | it's time to instantly unleash those changes onto your users!
|
|
0 commit comments