import { WonderPush } from '@awesome-cordova-plugins/wonderpush';
constructor(private wonderPush: WonderPush) { }
...
this.wonderPush.subscribeToNotifications()
.then(() => console.log("User subscribed to notifications"))
.catch((error: any) => console.error(error));
this.wonderPush.sendEvent('purchase', {
float_price: 12.99,
string_sku: "X123456"
});
this.wonderPush.addTag('customer');
this.wonderPush.putProperties({
string_name: 'John D.',
int_age: 24
});
const onClick = (userConsent: boolean) => this.wonderPush.setUserConsent(userConsent);
document.addEventListener('wonderpush.notificationOpen', function(event) {
console.log('Notification opened', event.notification);
if (event.notificationType === 'data') {
console.log('Silent notification', event.notification);
}
});