mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import Notify from 'notifyjs';
|
|
|
|
function test_Notify_constructor() {
|
|
//Min
|
|
var n = new Notify("hoge")
|
|
n.show();
|
|
|
|
//With option
|
|
n = new Notify("hoge", { body: "fuga" });
|
|
n.show();
|
|
|
|
//With Full option
|
|
n = new Notify("hoge", {
|
|
body: "fuga",
|
|
icon: "./logo.png",
|
|
tag: "user",
|
|
timeout: 2,
|
|
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;
|
|
}
|