本文整理汇总了TypeScript中node-notifier.notify函数的典型用法代码示例。如果您正苦于以下问题:TypeScript notify函数的具体用法?TypeScript notify怎么用?TypeScript notify使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notify函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: return
return (
err: Error,
stats: webpack.compiler.Stats
) => {
const customStats: CustomStats = webpackStatsDecorator(stats);
const jsonStats = stats.toJson();
if (err) {
debug(chalk.red(`${debugPrefix(_name)}COMPILE ERRORS...`));
debug(err);
notifier.notify({
title: 'Webpack compile errors!',
message: err,
});
return reject(err);
} else if (stats.hasErrors()) {
debug(chalk.red(`${debugPrefix(_name)}COMPILE ERRORS...`));
debug(jsonStats.errors);
notifier.notify({
title: 'Webpack compile errors!',
message: jsonStats.errors,
});
return reject(new Error(jsonStats.errors));
} else if (stats.hasWarnings()) {
debug(chalk.yellow(`${debugPrefix(_name)}COMPILE WARNINGS...`));
debug(jsonStats.warnings);
return reject(new Error(jsonStats.warnings));
}
resolve(customStats);
};
示例2: function
.on('end', function(){
console.timeEnd('compilation done')
if (lastTsErrorMsg) {
notifier.notify({title: 'Server Compilation Errors (' + errorCount + ')', message: lastTsErrorMsg.replace(removeColorsReg, '')})
lastTsErrorMsg = null; errorCount = 0;
} else {
notifier.notify({title: 'Server',message:'Compilation finished'})
}
})
示例3: notify
function notify(msg?: string) {
if (!notifier || !msg) return
notifier.notify({
title: 'tmux-weather',
message: msg,
})
}
示例4: errorNotification
private errorNotification(err, str, req) {
let title = 'Error in ' + req.method + ' ' + req.url;
notifier.notify({
title: title,
message: str
});
}
示例5: extractChannelTitle
res.on("end", () => {
let title: string = extractChannelTitle(body);
let broadcasting: boolean = checkBroadcasting(body);
if (broadcasting) {
if (lastChannelBroadcastings[url] === undefined ||
lastChannelBroadcastings[url] === false) {
lastChannelBroadcastings[url] = true;
notifier.notify({
title: title,
message: url,
icon: __dirname + "/../browser/notification.png",
sound: true,
wait: true,
});
notifier.on("click", (notifierObject: NodeNotifier, options: Notification) => {
electron.shell.openExternal(options.message + '/live');
});
}
} else {
lastChannelBroadcastings[url] = false;
}
updateTrayIcon();
if (mainWindow !== undefined) {
mainWindow.webContents.send("updateChannelStatus", JSON.stringify({
url: url,
title: title,
broadcasting: broadcasting,
}));
}
});
示例6: require
app.listen(config.localPort, () => {
// 开发模式弹窗,告知已重启 node 服务
if (process.env.NODE_ENV !== 'production') {
const notifier = require('node-notifier')
notifier.notify(`server start on port: ${config.localPort}`)
}
})
示例7: errorNotification
function errorNotification(err:Error,str:string,req:Request,res:Response){
const title='Error in'+req.method+''+req.url;
notifier.notify({
title:title,
message:str
});
};
示例8: notify
private static notify(message: string, icon: string): angular.IPromise<void> {
notifier.notify({
title: 'jmxhealth',
message: message,
icon: path.join(process.cwd(), 'icons', icon),
sound: true,
wait: true
});
var defered = Q.defer<void>();
notifier.on('click', function(notifierObject, options) {
console.log(notifierObject);
console.log(options);
defered.resolve();
});
notifier.on('timeout', function(notifierObject, options) {
console.log(notifierObject);
console.log(options);
defered.reject();
});
return defered.promise;
}
示例9: toggleProxy
async function toggleProxy() {
const httpProxy: IHTTP_ProxyConf = getHttpProxy();
// let settingsTmpDir = (process.platform == 'win32' ? process.env.TMP : process.env.TMPDIR);
let settingsTmpDir = os.tmpdir();
let settingsTmpFile = path.join(settingsTmpDir, path.basename(settingsPath + '.tmp.' + Math.random()));
// debug
// console.log(settingsTmpDir);
// console.log(settingsTmpFile);
let line: string;
let array = await fs.readFileSync(settingsPath, 'utf8').toString().split("\n");
// Backup to extensionPath
let backupTmpFile = path.join(vscode.extensions.getExtension("satokaz.vscode-toggleproxy").extensionPath, path.basename(settingsPath + '.tmp'));
if(fs.statSync(settingsPath).size !== 0){
await fs.writeFileSync(backupTmpFile, array.join('\n'));
}
for (line in array) {
const matchResult = regExpMatchHttpProxy(array[line]);
// console.log('matchResult =', matchResult)
if (matchResult !== null) {
if (!matchResult.http_proxyEnabled) {
// should enable proxy
array[line] = array[line].replace(/\/\/\W/, "");
vscode.window.setStatusBarMessage('Enabled http.proxy', 2000);
} else {
// should disable proxy
array[line] = array[line].replace(/^/, "// ");
vscode.window.setStatusBarMessage('Disabled http.proxy', 2000);
}
}
}
await fs.writeFileSync(settingsTmpFile, array.join('\n'));
// copy tmp settings file to vscode settings
// console.log("fs.writeFileSync(settingsPath, fs.readFileSync(settingsTmpFile,\"utf-8\"), 'utf8');")
await fs.writeFileSync(settingsPath, await fs.readFileSync(settingsTmpFile,"utf-8"));
// console.log("fs.unlink(settingsTmpFile);");
await fs.unlink(settingsTmpFile);
// node-notifier
if (vscode.workspace.getConfiguration('toggleproxy')['notifier'] === true) {
notifier.notify({
'title': 'Visual Studio Code - Proxy Notification',
'message': !httpProxy.http_proxyEnabled ? 'Proxy Enabled: ' + httpProxy.http_proxy : 'Proxy Disabled',
'appName': 'Visual Studio Code',
'icon': path.join(vscode.extensions.getExtension("satokaz.vscode-toggleproxy").extensionPath, path.join('images', 'octicon-globe_128_0_7c05c9_none.png')) ,
timeout: 5
});
}
vscode.workspace.onDidChangeConfiguration(e => configureHttpRequest());
return void 0;
}
示例10: showNotification
function showNotification(notificationObject: NotificationObject) {
const { title, subtitle, message, url, authorIconPath } = notificationObject;
notifier.notify({
url,
title,
subtitle,
message,
icon: authorIconPath || DEFAULT_ICON_PATH,
wait: false
});
}