mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-20 16:14:57 +08:00
Added INotification and IConfiguration to electron notify
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/// <reference path="./electron-notify.d.ts" />
|
||||
|
||||
import * as eNotify from 'electron-notify';
|
||||
|
||||
eNotify.setConfig({
|
||||
appIcon: 'images/otherIcon.png',
|
||||
displayTime: 6000,
|
||||
defaultStyleText: {
|
||||
color: '#FF0000',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
});
|
||||
|
||||
eNotify.notify({
|
||||
title: 'Title',
|
||||
text: 'Some text',
|
||||
image: 'path/to/image.png',
|
||||
url: 'http://google.de',
|
||||
sound: 'notification.wav',
|
||||
onClickFunc: function () { console.log('onClick') },
|
||||
onShowFunc: function () { console.log('onShow') },
|
||||
onCloseFunc: function () { console.log('onClose') }
|
||||
});
|
||||
42
electron-notify/electron-notify.d.ts
vendored
42
electron-notify/electron-notify.d.ts
vendored
@@ -6,22 +6,54 @@
|
||||
/// <reference path="../github-electron/github-electron.d.ts" />
|
||||
|
||||
declare namespace ElectronNotify {
|
||||
|
||||
interface INotification {
|
||||
title: string,
|
||||
text?: string,
|
||||
image?: string,
|
||||
url?: string,
|
||||
sound?: string,
|
||||
onClickFunc?: (event: string, id: number, closeNotification) => void,
|
||||
onShowFunc?: (event: string, id: number, closeNotification) => void,
|
||||
onCloseFunc?: (event: string, id: number) => void
|
||||
}
|
||||
|
||||
interface IConfiguration {
|
||||
width?: number,
|
||||
height?: number,
|
||||
padding?: number,
|
||||
borderRadius?: number,
|
||||
displayTime?: number,
|
||||
animationSteps?: number,
|
||||
animationStepMs?: number,
|
||||
animateInParallel?: boolean,
|
||||
appIcon?: string,
|
||||
pathToModule?: string,
|
||||
logging?: boolean,
|
||||
defaultWindow?: Electron.BrowserWindowOptions,
|
||||
defaultStyleContainer?: any,
|
||||
defaultStyleAppIcon?: any,
|
||||
defaultStyleImage?: any,
|
||||
defaultStyleClose?: any,
|
||||
defaultStyleText?: any
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Nice and simple notifications for electron apps */
|
||||
declare module 'electron-notify' {
|
||||
|
||||
/** Change some config options. Can be run multiple times, also between notify()-calls to change electron-notifys behaviour. */
|
||||
export function setConfig(configObj);
|
||||
export function setConfig(customConfig: ElectronNotify.IConfiguration);
|
||||
|
||||
/** Displays new notification. */
|
||||
export function notify(notificationObj);
|
||||
export function notify(notification: ElectronNotify.INotification);
|
||||
|
||||
/** Clears the animation queue and closes all windows opened by electron-notify. Call this to clean up before quiting your app. */
|
||||
export function closeAll();
|
||||
|
||||
export function setTemplatePath(path);
|
||||
export function getTemplatePath(): string;
|
||||
|
||||
export function setTemplatePath(path: string);
|
||||
|
||||
/** Returns the maximum amount of notifications that fit onto the users screen. */
|
||||
export function calcMaxVisibleNotification(): number;
|
||||
}
|
||||
Reference in New Issue
Block a user