Skip to content

Commit ba6d0eb

Browse files
committed
Strict Mode Fix
• Moves a nested function out of an if statement and into the root to fix a strict mode issue. #js_noob
1 parent 7da7edc commit ba6d0eb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

index.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ if (RNOneSignal != null) {
3030

3131
_listeners[eventName] = handleEventBroadcast(eventName, eventBroadcastName)
3232
}
33+
}
3334

34-
function handleEventBroadcast(type, broadcast) {
35-
return oneSignalEventEmitter.addListener(
36-
broadcast, (notification) => {
37-
// Check if we have added listener for this type yet
38-
// Cache the result first if we have not.
39-
var handler = _notificationHandler.get(type);
40-
41-
if (handler) {
42-
handler(notification);
43-
} else {
44-
_notificationCache.set(type, notification);
45-
}
46-
}
47-
);
48-
}
35+
function handleEventBroadcast(type, broadcast) {
36+
return oneSignalEventEmitter.addListener(
37+
broadcast, (notification) => {
38+
// Check if we have added listener for this type yet
39+
// Cache the result first if we have not.
40+
var handler = _notificationHandler.get(type);
41+
42+
if (handler) {
43+
handler(notification);
44+
} else {
45+
_notificationCache.set(type, notification);
46+
}
47+
}
48+
);
4949
}
5050

5151
function checkIfInitialized() {

0 commit comments

Comments
 (0)