Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
dialog-promise
Advanced tools
Dialog that returns promises
Implements alert
, confirm
& prompt
functions with Promises
<script src="dialog-promise.js"></script>
<button onclick='example2(this)'>example</button>
<script>
function example2(button){
promptPromise("What's your name?").then(function(name){
return alertPromise("Hi "+name);
}).then(function(){
button.textContent='try again!';
});
}
</script>
Recives a mensage (and an object with options).
These are versions of the native funcions alert
, confirm
y prompt
function | returned value |
---|---|
alert | true |
confirm | true or false |
prompt | a string with the entered text |
If Escape
is pressed or the mouse clicked outside the dialog the function returns undefined
.
The options could be passed to all of these functions
option | def | use |
---|---|---|
underElement | null | the dialog apears below this element. If no element is passed the dialog apears in the center of the window |
withCloseButton | true | display the close button |
mainAttrs | {} | attributes for main dialog window |
reject | true | true if rejects the promise when close by the close button, Esc key or clicking outside of the dialog |
closeValue | undefined | value if rejects the promise when close by the close button, Esc key or clicking outside of the dialog |
buttonDef | {label:'Ok', value:true} | main button of the alertPromise dialog |
Display a menu
<script src="dialog-promise.js"></script>
<button id=theButton onclick='example3(this)'>example</button>
<script>
function example3(button){
miniMenuPromise([
{value:'ar', img:'ar.png', label:'Argentina'},
{value:'cl', img:'cl.png', label:'Chile'},
{value:'uy', img:'uy.png', label:'Uruguay'},
], {underElement: theButton}).then(function(option){
return alertPromise("val = "+option);
});
}
</script>
The options could be passed to all of these functions
option | use |
---|---|
label | text to show |
value | value when click. If not set the row is not clickeable. |
img | image url |
startGroup | if it starts a group (puts a little line) |
imgStyle | object with style attributes for the image |
fun | alternate function to create cells of the row |
FAQs
Dialog that returns promises
The npm package dialog-promise receives a total of 14 weekly downloads. As such, dialog-promise popularity was classified as not popular.
We found that dialog-promise demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.