Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
dialog-node
Advanced tools
Readme
dialog-node is providing developers an easy cross platform way to use interactive dialogs for desktop applications written in nodejs. The code has been heavily inspired and influenced by Tomás Pollak and his dialog project (https://www.npmjs.com/package/dialog). dialog-node takes the same concept of providing a wrapper around OS specific dialog tools like zenity, apple script and VBS but extends it to dialogs that request user inputs (like questions, input dialog or file selector). The approach of calling UI tools included int the OS by default has the advantage of avoiding the usage of heavier cross platform UI frameworks like electron.js or Qt and provides the following benefits:
npm install dialog-node
In order to run the test after installation:
npm test
or
cd dialog-node
nodejs test-dialog-node
This test will run through all available dialogs with some example settings
var dialog = require('dialog-node');
//will be called after user closes the dialog
var callback = function(code, retVal, stderr)
{
console.log("return value = <" + retVal + ">");
}
dialog.entry('Type some text', "entry prompt", 0, callback);
in order to run example.js:
npm start
Some packaging tools don't set __dirname
properly (webpack or jxcore)
setCwd
allows the calling module to set dialog-node's working directory properly
in order to find its assets
Needs to be called before any other function
You can safely ignore this function if using no packaging tool(npm is fine)
setCwd(directory);
directory = location of mode_modules folder that includes dialog-node
dialog-node.<dialog>(msg, title, timeout, callback);
msg = string containing specific dialog message
title = string containing title of dialog (this parameter is not observed for all dialogs)
timeout = dialog is timing out after <timeout> seconds, if parameter is 0 dialog does not time out
callback = to be called after user closes dialog, for further description see further below
Information dialog with text and title and an OK button
dialog-node.info(msg, title, timeout, callback);
Warning dialog with text and title and an OK button
dialog-node.warn(msg, title, timeout, callback);
Error dialog with text and title and an OK button
dialog-node.error(msg, title, timeout, callback);
A dialog that displays text and title and that prompts user to click a Cancel or an OK button. OK is the default answer.
dialog-node.question(msg, title, timeout, callback);
Returns the result of the user action as a string handed into the callback function (see also callback mechanism):
Dialog querying user to type in some text.
dialog-node.entry(msg, title, timeout, callback);
Returns the text the user typed as a string handed into the callback function (see also callback mechanism):
Prompts user to select or type a date. This one varies quite a bit across the different OSes.
dialog-node.calendar(msg, title, timeout, callback);
Returns the date the user selected as a string handed into the callback function (see also callback mechanism):
Prompts user to select a file.
dialog-node.fileselect(msg, title, timeout, callback);
Returns the path of a selected file as a string handed into the callback function (see also callback mechanism):
dialog-nodes are non-blocking and call a callback function after the user action happened (i.e. clicking 'OK' button). For dialogs that return some information (i.e. the entry text that the user typed), callback hands in retVal which contains the user's response as a string.
function(code, retVal, stderr)
code = return code from dialog
retVal = user's response as a string
stderr = any error information that the dialog created
This project is licensed under the MIT License -
FAQs
dialog-node is providing developers an easy cross platform way to use interactive dialogs for desktop applications written in nodejs.
The npm package dialog-node receives a total of 794 weekly downloads. As such, dialog-node popularity was classified as not popular.
We found that dialog-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.