
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
angular-defer-alert
Advanced tools
Angular service to promisify $window alerts, confirms and prompts.
Angular service to promisify $window alerts, confirms and prompts.
Do you want to use $window.confirm
in a promise chain, but are too lazy to figure out how?
Well then, this is the service for you!
Confirmations are great to insert in a process. They resolve successfully with an "OK" click. They are rejected when a user clicks "Cancel".
MyDonutService
.getDonuts(12)
.then(function(donutsFetched) {
var confirmMessage = 'Are you sure you want to eat ' + donutsFetched + ' donuts?';
DeferAlertService.openConfirm(confirmMessage)
.then(function() {
// User wants to eat donuts!
return true;
})
.catch(function() {
// User does not want to eat donuts
return false;
});
});
Prompts ask a user for input before continuing. They resolve successfully with an "OK" click and provide the entered value. They are rejected when a user clicks "Cancel".
var promptMesage = 'How many donuts do you want to eat?';
var defaultValue = '12';
DeferAlertService.openPrompt(promptMessage, defaultValue)
.then(function(donutAmount) {
MyDonutService
.getDonuts(donutAmount)
.then(function(donutsFetched) {
var confirmMessage = 'Are you sure you want to eat ' + donutsFetched + ' donuts?';
DeferAlertService.openConfirm(confirmMessage)
.then(function() {
// User wants to eat donuts!
return true;
})
.catch(function() {
// User does not want to eat donuts
return false;
});
});
});
Since alerts don't really require a promise, we immediately resolve them, making for a very boring demo.
MyAwesomeService
.doThing()
.then(function(textToAlert) {
DeferAlertService.openAlert(textToAlert);
});
FAQs
Angular service to promisify $window alerts, confirms and prompts.
The npm package angular-defer-alert receives a total of 0 weekly downloads. As such, angular-defer-alert popularity was classified as not popular.
We found that angular-defer-alert 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
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.