onesignal-web-sdk
Version:
Web push notifications from OneSignal.
29 lines (23 loc) • 632 B
JavaScript
// https://developer.mozilla.org/en-US/docs/Web/API/Notification
export default class Notification {
constructor(title, options) {
this.title = title;
Object.assign(this, options);
}
close() {
}
snapshot() {
const keys = Object.keys(this);
const result = {};
for (let i = 0; i < keys.length; i += 1) {
if (typeof this[keys[i]] !== 'function') {
result[keys[i]] = this[keys[i]];
}
}
return result;
}
}
Notification.requestPermission = function () {
return Promise.resolve(Notification.permission);
};
Notification.permission = 'granted';