Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

windows 10 toast notifications nodejs

// use node notifier -> https://www.npmjs.com/package/node-notifier
// npm install node-notifier

const WindowsToaster = require('node-notifier').WindowsToaster; // import the module node-notifier.windowsToaster

// declare the notifier 

var notifier = new WindowsToaster({
	withFallback: false, // Fallback to Growl or Balloons?
	customPath: "Relative" // Relative/Absolute path if you want to use your fork of SnoreToast.exe
});

// send notification, accept javascript objects

notifier.notify({
	title: `hello world`, // the title
	message: `annoying popup`, // the message below the title
	icon: path.join(__dirname, "avatar.png") // optional: the icon
})

// listen to when the user click on the notification
notifier.on("click", (window) => {
    // enter here the script that will execute when someone clicks on the notification
    const { exec } = require("child_process");
	exec(`cd C:Program Files (x86)GoogleChromeApplication && chrome.exe https://c.tenor.com/RvBPEdvCqHkAAAAd/social-credit.gif`)
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: node run parameters 
Javascript :: javascript generate unique id 
Javascript :: js date locale brasil 
Javascript :: convert date time in reactjs 
Javascript :: play store rejected app due non-certified ads SDK 
Javascript :: if button is keeping pressed execute increment javascript 
Javascript :: ajax redirect in success 
Javascript :: javascript go to page 
Javascript :: generate random int js 
Javascript :: get epoch timestamp js 
Javascript :: horizontal scroll onclick react 
Javascript :: sort array with objects 
Javascript :: react router 404 redirect 
Javascript :: simulate a user click 
Javascript :: how to insert html in javascript 
Javascript :: dynamics js search another entity 
Javascript :: rafraichir page javascript 
Javascript :: scroll to bottom javascript 
Javascript :: ngcc failed angular 9 
Javascript :: Function in JavaScript that can be called only once 
Javascript :: add and remove checked jquery 
Javascript :: bjsmasth 
Javascript :: framer motion styled components 
Javascript :: javascript test if element has focus 
Javascript :: locate and delete an object in an array 
Javascript :: read json file javascript 
Javascript :: match url regex 
Javascript :: nextelementsibling js 
Javascript :: sort an array by characters length in js 
Javascript :: mathjs get element from matrix 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =