DefinitelyTyped/types/notifyjs/notifyjs-tests.ts
Ore Poran d48442e687
🤖 Merge PR #46869 export INotifyOption by @oreporan
* export options

* npm naming

* correct option export

Co-authored-by: NateScarlet <NateScarlet@Gmail.com>
2020-08-19 23:31:29 -04:00

42 lines
1.2 KiB
TypeScript

import Notify, { NotifyOption } from 'notifyjs';
function test_Notify_constructor() {
//Min
var n = new Notify('hoge');
n.show();
//With option
const option: NotifyOption = { body: 'fuga' };
n = new Notify('hoge', option);
n.show();
//With Full option
n = new Notify('hoge', {
body: 'fuga',
icon: './logo.png',
tag: 'user',
timeout: 2,
silent: false,
notifyShow: (e: Event) => console.log('notifyShow', e),
notifyClose: () => console.log('notifyClose'),
notifyClick: () => console.log('notifyClick'),
notifyError: () => console.log('notifyError'),
permissionGranted: () => console.log('permissionGranted'),
permissionDenied: () => console.log('permissionDenied'),
requireInteraction: true,
});
n.show();
}
function test_Notify_static_methods() {
Notify.needsPermission;
Notify.requestPermission();
Notify.requestPermission(() => console.log('onPermissionGrantedCallback'));
Notify.requestPermission(
() => console.log('onPermissionGrantedCallback'),
() => console.log('onPermissionDeniedCallback'),
);
Notify.isSupported();
Notify.permissionLevel;
}