Skip to content

Commit 9821073

Browse files
authored
Merge pull request #71 from OneSignal/2.0.4
2.0.4 Release - fix typescript compiler errors related to event handler functions
2 parents c9550a7 + 0075739 commit 9821073

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# See https://help.github.com/ignore-files/ for more about ignoring files.
32

43
# dependencies
@@ -20,6 +19,3 @@ dist
2019
npm-debug.log*
2120
yarn-debug.log*
2221
yarn-error.log*
23-
24-
# NPM README file
25-
package/README.md

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Modified MIT License
22

3-
Copyright 2021 OneSignal
3+
Copyright 2022 OneSignal
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,4 @@ Special thanks to [pedro-lb](https://github.com/pedro-lb) and others for work on
201201
<img src="https://user-images.githubusercontent.com/11739227/119415383-1d354700-bcb7-11eb-946d-01c40cd07010.png" />
202202
</a>
203203

204-
Enjoy!
204+
Enjoy!

example/src/onesignal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import OneSignal from 'react-onesignal';
22

33
export default async function runOneSignal() {
4-
await OneSignal.init({ appId: 'bb8fb3ed-6c11-4dc4-b026-83d3d29e45ee'});
4+
await OneSignal.init({ appId: 'bb8fb3ed-6c11-4dc4-b026-83d3d29e45ee', allowLocalhostAsSecureOrigin: true});
55
OneSignal.showSlidedownPrompt();
66
}

index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ interface IInitObject {
121121

122122
interface IOneSignal {
123123
init(options: IInitObject): Promise<void>
124-
on(event: string, listener: () => void): void
125-
off(event: string, listener: () => void): void
126-
once(event: string, listener: () => void): void
124+
on(event: string, listener: (eventData?: any) => void): void
125+
off(event: string, listener: (eventData?: any) => void): void
126+
once(event: string, listener: (eventData?: any) => void): void
127127
isPushNotificationsEnabled(callback?: Action<boolean>): Promise<boolean>
128128
showHttpPrompt(options?: AutoPromptOptions): Promise<void>
129129
registerForPushNotifications(options?: RegisterOptions): Promise<void>
@@ -162,7 +162,7 @@ interface IOneSignal {
162162

163163

164164

165-
function on(event: string, listener: () => void): void {
165+
function on(event: string, listener: (eventData?: any) => void): void {
166166
if (!doesOneSignalExist()) {
167167
reactOneSignalFunctionQueue.push({
168168
name: 'on',
@@ -176,7 +176,7 @@ interface IOneSignal {
176176
});
177177
}
178178

179-
function off(event: string, listener: () => void): void {
179+
function off(event: string, listener: (eventData?: any) => void): void {
180180
if (!doesOneSignalExist()) {
181181
reactOneSignalFunctionQueue.push({
182182
name: 'off',
@@ -190,7 +190,7 @@ interface IOneSignal {
190190
});
191191
}
192192

193-
function once(event: string, listener: () => void): void {
193+
function once(event: string, listener: (eventData?: any) => void): void {
194194
if (!doesOneSignalExist()) {
195195
reactOneSignalFunctionQueue.push({
196196
name: 'once',

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-onesignal",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "React OneSignal Module: Make it easy to integrate OneSignal with your React App!",
55
"author": "rgomezp",
66
"contributors": [{ "name": "Rodrigo Gomez-Palacio" }, { "name": "Pedro Bini" }, { "name": "Graham Marlow" }],

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"outDir": "build",
3+
"outDir": "dist",
44
"module": "esnext",
55
"target": "es6",
66
"lib": ["es6", "dom", "es2016", "es2017"],

0 commit comments

Comments
 (0)