
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
vue3-promise-dialog
Advanced tools
Dialogs meet promises in Vue 3 !
As we all know, requesting data from the server is an asynchronous process that is best handled with promises. For example the Fetch API is a promise based API.
let response = await fetch('http://example.com/movies.json');
Now, just like fetching data from the server, requesting data from the user using a dialog is also an asynchronous process that may complete with a value at some point in the future when the user closes the dialog. Why would the API to fetch data from the user be any different than the API to fetch data from the server ?
Opening a confirm dialog box should then be as simple as this :
let ok = await confirm('Are you sure you want to do this ?');
if (ok) {
// Do something
}
Compare that to the usual approach to working with Dialogs :
<template>
<transition name="...">
<ConfirmDialog v-if="show" @ok="onOk()" @cancel="onCancel()"></ConfirmDialog>
</transition>
</template>
<script>
// Set up a show ref, onOk and onCancel functions. Switch show to true to open the dialog.
</script>
That approach has several disadvantages :
You may be familiar with the following Vue 2 project : vue-modal-dialog. This repository demonstrates how the basic functionality of that great project can be easily recovered in Vue 3. The code is published on NPM but it is so simple (60 lines of code for the core functionality !) you might as well copy paste it in your own project and customize it as you see fit.
The core functionality is in the lib folder. There are only two small files : lib.ts and DialogWrapper.vue. These two files are published on NPM.
An example of a small dialog collection built upon the core functionality is in the dialogs folder. It is not published on NPM since it is dependent on PrimeVue component library which you may not be using and the look and feel you may be aiming for for your own dialog may differ. Use it as inspiration to build you own dialog collection.
FAQs
Dialogs meet promises in Vue 3 !
The npm package vue3-promise-dialog receives a total of 1,454 weekly downloads. As such, vue3-promise-dialog popularity was classified as popular.
We found that vue3-promise-dialog 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.