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.
@ng-vcl/store
Advanced tools
npm install @ng-vcl/store --save
import { NgModule } from '@angular/core';
import { StoreModule } from 'ng-vcl';
import { AppComponent } from './app.component';
import { REDUCERS } from './reducers';
import { EFFECTS } from './effects';
@NgModule({
imports: [
StoreModule.forRoot({
enableRouter: true, // enables the StoreRouter
reducers: [ ... ], // optional - Your reducers
effects: [ ... ] // optional - Effect classes
})
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
export const initialState: BooksState = {
loading: false,
books: [],
error: null
};
export class SearchBooksAction {
constructor(public query: string) {}
}
export class SearchBooksCompleteAction {
constructor(public books: any[]) {}
}
export class SearchBooksErrorAction {
constructor(public error: any) {}
}
function bookReducer(state = initialState, action: SearchBooksAction | SearchBooksCompleteAction | SearchBooksErrorAction) {
if (action instanceof SearchBooksAction) {
return {
loading: true,
books: [],
error: null
};
} else if (action instanceof SearchBooksCompleteAction) {
return {
loading: false,
books: [...action.books],
error: null
};
} else if (action instanceof SearchBooksErrorAction) {
return {
loading: false,
books: [],
error: action.error
};
}
return state;
}
export const BOOK_REDUCERS = {
books: bookReducer
}
@Injectable()
export class BooksService {
constructor(
private store: Store,
) { }
books$ = this.store.select<BooksState>(state => state.books);
public search(query: string) {
this.store.dispatch(new SearchBooksAction(query));
}
}
@Injectable()
export class BooksEffects {
constructor(
private actions$: StoreActions,
private http: Http
) { }
@Effect()
search = this.actions$
.ofType(SearchBooksAction)
.switchMap( ({query}) => {
return this.http.get(`${API}?q=${query || ''}`)
.map(res => res.json())
.map(result => result.items)
.map(items => {
return new SearchBooksCompleteAction(items);
})
.catch(err => {
return Observable.of(new SearchBooksErrorAction(err));
});
});
}
0.2.1 (2017-03-01)
Bugfix release
FAQs
ng-vcl store
The npm package @ng-vcl/store receives a total of 2 weekly downloads. As such, @ng-vcl/store popularity was classified as not popular.
We found that @ng-vcl/store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.