Skip to content

Commit 2d5f15f

Browse files
committed
chore: move event emitter to own file
1 parent b865b47 commit 2d5f15f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { NativeEventEmitter } from 'react-native';
2+
import { NativeRNAppZungCodePushModule } from './NativeRNAppZungCodePushModule';
3+
4+
export const CodePushEventEmitter = new NativeEventEmitter(NativeRNAppZungCodePushModule);

src/internals/RemotePackageImplementation.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { NativeEventEmitter } from 'react-native';
21
import { LogLevel } from '../enums/LogLevel.enum';
32
import type { DownloadProgressCallback, LocalPackage, RemotePackage } from '../types';
43
import type { ApiSdkDownloadReportPackageInfo } from './CodePushApiSdk.types';
4+
import { CodePushEventEmitter } from './CodePushEventEmitter';
55
import { LocalPackageImplementation } from './LocalPackageImplementation';
66
import { NativeRNAppZungCodePushModule } from './NativeRNAppZungCodePushModule';
77
import { log } from './utils/log';
@@ -21,9 +21,8 @@ export class RemotePackageImpl implements RemotePackage {
2121
let downloadProgressSubscription;
2222

2323
if (downloadProgressCallback) {
24-
const codePushEventEmitter = new NativeEventEmitter(NativeRNAppZungCodePushModule);
2524
// Use event subscription to obtain download progress.
26-
downloadProgressSubscription = codePushEventEmitter.addListener(
25+
downloadProgressSubscription = CodePushEventEmitter.addListener(
2726
'CodePushDownloadProgress',
2827
downloadProgressCallback,
2928
);

0 commit comments

Comments
 (0)