Skip to content

Commit

Permalink
fix: Do not require es6 or downlevel-iterators TS flag (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-oakes committed May 24, 2019
1 parent 18584b6 commit f91cdd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/internal/deprecatedSubscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ let _latestState: DeprecatedTypes.NetInfoData | null = null;
let _isListening = false;

function _listenerHandler(state: Types.NetInfoState): void {
_latestState = DeprecatedUtils.convertState(state);
for (let handler of _subscriptions) {
handler(_latestState);
}
const convertedState = DeprecatedUtils.convertState(state);
_latestState = convertedState;
_subscriptions.forEach((handler): void => handler(convertedState));
}

export function add(handler: DeprecatedTypes.ChangeHandler): void {
Expand Down
4 changes: 1 addition & 3 deletions src/internal/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ let _nativeEventSubscription: NativeEventSubscription | null = null;

function _listenerHandler(state: Types.NetInfoState): void {
_latestState = state;
for (let handler of _subscriptions) {
handler(_latestState);
}
_subscriptions.forEach((handler): void => handler(state));
}

export function add(
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"include": ["src/**/*.ts", "example/**/*.ts", "example/**/*.tsx"],
"compilerOptions": {
"target": "es6",
"module": "es6",
"target": "es5",
"module": "commonjs",
"strict": true,
"downlevelIteration": true,
"moduleResolution": "node",
"lib": ["es2015", "es2016", "esnext"],
"jsx": "react-native"
Expand Down

0 comments on commit f91cdd3

Please sign in to comment.