Socket
Socket
Sign inDemoInstall

aurelia-store

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aurelia-store - npm Package Compare versions

Comparing version 0.16.0 to 0.16.1

2

package.json
{
"name": "aurelia-store",
"version": "0.16.0",
"version": "0.16.1",
"description": "Aurelia single state store based on RxJS",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,4 +5,6 @@ # aurelia-store

Aurelia single state store based on RxJS
Aurelia single state store based on RxJS.
Various examples can be found in the [samples repository](https://github.com/zewa666/aurelia-store-examples).
THIS IS WORK IN PROGRESS, DO NOT USE YET FOR PRODUCTION

@@ -144,2 +146,9 @@

In order to remove a registered action, simply call `store.unregisterAction`
```typescript
...
store.unregisterAction(demoAction);
```
## Execution order

@@ -146,0 +155,0 @@ If multiple actions are dispatched, they will get queued and executed one after another in order to make sure that each dispatch starts with an up to date state.

@@ -42,4 +42,4 @@ import { Observable } from "rxjs/Observable";

private devTools: any;
private actions: Map<Reducer<T>, { name: string, reducer: Reducer<T> }> = new Map();
private middlewares: Map<Middleware<T>, { placement: MiddlewarePlacement, reducer: Middleware<T> }> = new Map();
private actions: Map<Reducer<T>, { name: string }> = new Map();
private middlewares: Map<Middleware<T>, { placement: MiddlewarePlacement }> = new Map();
private _state: BehaviorSubject<T>;

@@ -64,3 +64,3 @@ private options: Partial<StoreOptions>;

public registerMiddleware(reducer: Middleware<T>, placement: MiddlewarePlacement) {
this.middlewares.set(reducer, { placement, reducer });
this.middlewares.set(reducer, { placement });
}

@@ -79,3 +79,3 @@

this.actions.set(reducer, { name, reducer });
this.actions.set(reducer, { name });
}

@@ -118,12 +118,12 @@

if (!this.actions.has(reducer)) {
throw new Error(`Tried to dispatch an unregistered action ${reducer.name}`);
throw new Error(`Tried to dispatch an unregistered action${reducer ? " " + reducer.name : ""}`);
}
performance.mark("dispatch-start");
const action = this.actions.get(reducer);
if (this.options.logDispatchedActions) {
this.logger[getLogType(this.options, "dispatchedActions", LogLevel.info)](`Dispatching: ${reducer.name}`);
this.logger[getLogType(this.options, "dispatchedActions", LogLevel.info)](`Dispatching: ${action!.name}`);
}
const action = this.actions.get(reducer);
const beforeMiddleswaresResult = await this.executeMiddlewares(

@@ -133,4 +133,4 @@ this._state.getValue(),

);
const result = action!.reducer(beforeMiddleswaresResult, ...params);
performance.mark("dispatch-after-reducer-" + reducer.name);
const result = reducer(beforeMiddleswaresResult, ...params);
performance.mark("dispatch-after-reducer-" + action!.name);

@@ -165,3 +165,3 @@ if (!result && typeof result !== "object") {

this.logger[getLogType(this.options, "performanceLog", LogLevel.info)](
`Total duration ${measures[0].duration} of dispatched action ${reducer.name}:`,
`Total duration ${measures[0].duration} of dispatched action ${action!.name}:`,
measures

@@ -173,3 +173,3 @@ );

this.logger[getLogType(this.options, "performanceLog", LogLevel.info)](
`Total duration ${totalDuration} of dispatched action ${reducer.name}:`,
`Total duration ${totalDuration} of dispatched action ${action!.name}:`,
marks

@@ -194,5 +194,5 @@ );

private executeMiddlewares(state: T, placement: MiddlewarePlacement): T {
return Array.from(this.middlewares.values())
.filter((middleware) => middleware.placement === placement)
.map((middleware) => middleware.reducer)
return Array.from(this.middlewares)
.filter((middleware) => middleware[1].placement === placement)
.map((middleware) => middleware[0])
.reduce(async (prev: any, curr, _, _arr: Middleware<T>[]) => {

@@ -199,0 +199,0 @@ try {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc