@@ -2,47 +2,47 @@ var extend = require("extend");
2
2
var { NativeAppEventEmitter } = require ( "react-native" ) ;
3
3
4
4
module . exports = ( NativeCodePush ) => {
5
- var remote = {
6
- abortDownload : function abortDownload ( ) {
7
- return NativeCodePush . abortDownload ( this ) ;
8
- } ,
9
- download : function download ( progressHandler ) {
10
- if ( ! this . downloadUrl ) {
11
- return Promise . reject ( new Error ( "Cannot download an update without a download url" ) ) ;
12
- }
5
+ var remote = {
6
+ abortDownload : function abortDownload ( ) {
7
+ return NativeCodePush . abortDownload ( this ) ;
8
+ } ,
9
+ download : function download ( progressHandler ) {
10
+ if ( ! this . downloadUrl ) {
11
+ return Promise . reject ( new Error ( "Cannot download an update without a download url" ) ) ;
12
+ }
13
13
14
- var downloadProgressSubscription ;
15
- if ( progressHandler ) {
16
- // Use event subscription to obtain download progress.
17
- downloadProgressSubscription = NativeAppEventEmitter . addListener (
18
- 'CodePushDownloadProgress' ,
19
- progressHandler
20
- ) ;
21
- }
14
+ var downloadProgressSubscription ;
15
+ if ( progressHandler ) {
16
+ // Use event subscription to obtain download progress.
17
+ downloadProgressSubscription = NativeAppEventEmitter . addListener (
18
+ 'CodePushDownloadProgress' ,
19
+ progressHandler
20
+ ) ;
21
+ }
22
22
23
- // Use the downloaded package info. Native code will save the package info
24
- // so that the client knows what the current package version is.
25
- return NativeCodePush . downloadUpdate ( this )
26
- . then ( ( downloadedPackage ) => {
27
- downloadProgressSubscription && downloadProgressSubscription . remove ( ) ;
28
- return extend ( { } , downloadedPackage , local ) ;
29
- } )
30
- . catch ( ( error ) => {
31
- downloadProgressSubscription && downloadProgressSubscription . remove ( ) ;
32
- // Rethrow the error for subsequent handlers down the promise chain.
33
- throw error ;
34
- } ) ;
35
- }
36
- } ;
23
+ // Use the downloaded package info. Native code will save the package info
24
+ // so that the client knows what the current package version is.
25
+ return NativeCodePush . downloadUpdate ( this )
26
+ . then ( ( downloadedPackage ) => {
27
+ downloadProgressSubscription && downloadProgressSubscription . remove ( ) ;
28
+ return extend ( { } , downloadedPackage , local ) ;
29
+ } )
30
+ . catch ( ( error ) => {
31
+ downloadProgressSubscription && downloadProgressSubscription . remove ( ) ;
32
+ // Rethrow the error for subsequent handlers down the promise chain.
33
+ throw error ;
34
+ } ) ;
35
+ }
36
+ } ;
37
37
38
- var local = {
39
- apply : function apply ( rollbackTimeout = 0 , restartImmediately = true ) {
40
- return NativeCodePush . applyUpdate ( this , rollbackTimeout , restartImmediately ) ;
41
- }
42
- } ;
38
+ var local = {
39
+ apply : function apply ( rollbackTimeout = 0 , restartImmediately = true ) {
40
+ return NativeCodePush . applyUpdate ( this , rollbackTimeout , restartImmediately ) ;
41
+ }
42
+ } ;
43
43
44
- return {
45
- remote : remote ,
46
- local : local
47
- } ;
44
+ return {
45
+ remote : remote ,
46
+ local : local
47
+ } ;
48
48
} ;
0 commit comments