Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@ngxs-labs/actions-executing
Advanced tools
![master](https://github.com/ngxs-labs/actions-executing/workflows/main/badge.svg?branch=master) [![npm version](https://badge.fury.io/js/%40ngxs-labs%2Factions-executing.svg)](https://badge.fury.io/js/%40ngxs-labs%2Factions-executing) [![Coverage Status]
This plugin allows you to easily know if an action is being executed and control UI elements or control flow of your code to execute. The most common scenarios for using this plugin are to display loading spinner or disable a button while an action is executing.
Angular | @ngxs-labs/actions-executing |
---|---|
non-ivy | 0.x |
ivy | 1.x (compiled in partial mode) |
Install the plugin:
npm install --save @ngxs-labs/actions-executing
yarn add @ngxs-labs/actions-executing
Next, include it in you app.module.ts
//...
import { NgxsModule } from '@ngxs/store';
import { NgxsActionsExecutingModule } from '@ngxs-labs/actions-executing';
@NgModule({
//...
imports: [
//...
NgxsModule.forRoot([
//... your states
]),
NgxsActionsExecutingModule.forRoot()
]
//...
})
export class AppModule {}
To use it on your components you just need to include the following @Select()
//...
import { actionsExecuting, ActionsExecuting } from '@ngxs-labs/actions-executing';
//...
export class SingleComponent {
@Select(actionsExecuting([MyAction])) myActionIsExecuting$: Observable<ActionsExecuting>;
}
then you can disable a button or display a loading indicator very easily
<button [disabled]="myActionIsExecuting$ | async" (click)="doSomething()">
My Action
</button>
<span *ngIf="myActionIsExecuting$ | async">
Loading...
</span>
actionsExecuting
selector returns the type ActionsExecuting
type ActionsExecuting = { [action: string]: number } | null;
This allows you to know which actions and how many of them are being executed at any given time.
You can also pass multiple actions to the selector and this way you'll receive updates when any of those actions are executing.
@Select(actionsExecuting([Action1, Action2])) multipleActions$: Observable<ActionsExecuting>;
FAQs
![master](https://github.com/ngxs-labs/actions-executing/workflows/main/badge.svg?branch=master) [![npm version](https://badge.fury.io/js/%40ngxs-labs%2Factions-executing.svg)](https://badge.fury.io/js/%40ngxs-labs%2Factions-executing) [![Coverage Status]
We found that @ngxs-labs/actions-executing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.