Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@figliolia/galena

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figliolia/galena - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

24

dist/Galena/Galena.d.ts

@@ -29,5 +29,5 @@ import type { Middleware } from "../Middleware/Middleware";

* AppState.subscribe(appState => {
* const navState = appState.get("navigation");
* const { currentRoute } = navState.state;
* // do something with state changes!
* const navState = appState.get("navigation");
* const { currentRoute } = navState.state;
* // do something with state changes!
* });

@@ -38,4 +38,4 @@ * ```

* NavigationState.subscribe(navigation => {
* const { currentRoute } = navigation.state
* // do something with state changes!
* const { currentRoute } = navigation
* // do something with state changes!
* });

@@ -46,5 +46,5 @@ * ```

* ```typescript
* NavigationState.subscribeAll(galenaInstance => {
* const { currentRoute } = galenaInstance.get("navigation").state
* // do something with state changes!
* NavigationState.subscribeAll(nextState => {
* const { currentRoute } = nextState.navigation
* // do something with state changes!
* });

@@ -56,4 +56,4 @@ * ```

* NavigationState.update(state => {
* state.currentRoute = "/profile";
* // You can mutate state without creating new objects!
* state.currentRoute = "/profile";
* // You can mutate state without creating new objects!
* });

@@ -120,3 +120,3 @@ * ```

*/
subscribe<K extends keyof T>(name: K, mutation: Parameters<T[K]["subscribe"]>["0"]): string;
subscribe<K extends keyof T>(name: K, callback: Parameters<T[K]["subscribe"]>["0"]): string;
/**

@@ -140,3 +140,3 @@ * Unsubscribe

*/
subscribeAll(callback: (state: Galena<T>) => void): string;
subscribeAll(callback: (nextState: T) => void): string;
/**

@@ -143,0 +143,0 @@ * Unsubscribe

@@ -32,5 +32,5 @@ "use strict";

* AppState.subscribe(appState => {
* const navState = appState.get("navigation");
* const { currentRoute } = navState.state;
* // do something with state changes!
* const navState = appState.get("navigation");
* const { currentRoute } = navState.state;
* // do something with state changes!
* });

@@ -41,4 +41,4 @@ * ```

* NavigationState.subscribe(navigation => {
* const { currentRoute } = navigation.state
* // do something with state changes!
* const { currentRoute } = navigation
* // do something with state changes!
* });

@@ -49,5 +49,5 @@ * ```

* ```typescript
* NavigationState.subscribeAll(galenaInstance => {
* const { currentRoute } = galenaInstance.get("navigation").state
* // do something with state changes!
* NavigationState.subscribeAll(nextState => {
* const { currentRoute } = nextState.navigation
* // do something with state changes!
* });

@@ -59,4 +59,4 @@ * ```

* NavigationState.update(state => {
* state.currentRoute = "/profile";
* // You can mutate state without creating new objects!
* state.currentRoute = "/profile";
* // You can mutate state without creating new objects!
* });

@@ -143,4 +143,4 @@ * ```

*/
subscribe(name, mutation) {
return this.get(name).subscribe(mutation);
subscribe(name, callback) {
return this.get(name).subscribe(callback);
}

@@ -174,3 +174,3 @@ /**

this.state[key].subscribe(() => {
callback(this);
callback(this.state);
}),

@@ -177,0 +177,0 @@ ]);

@@ -53,3 +53,3 @@ import type { Middleware } from "../Middleware/Middleware";

* ```typescript
* MyState.subscribe(({ state }) => {
* MyState.subscribe((state) => {
* const { listItems } = state

@@ -204,3 +204,3 @@ * // Do something with your list items!

*/
subscribe(callback: (nextState: State<T>) => void): string;
subscribe(callback: (nextState: T) => void): string;
/**

@@ -207,0 +207,0 @@ * Unsubscribe

@@ -57,3 +57,3 @@ "use strict";

* ```typescript
* MyState.subscribe(({ state }) => {
* MyState.subscribe((state) => {
* const { listItems } = state

@@ -220,3 +220,3 @@ * // Do something with your list items!

this.lifeCycleEvent(types_1.MiddlewareEvents.onUpdate);
void this.scheduleTask(() => this.emitter.emit(this.name, this), priority);
void this.scheduleTask(() => this.emitter.emit(this.name, this.state), priority);
}

@@ -223,0 +223,0 @@ /**

import type { State } from "./State";
export type MutationEvent<T extends any> = {
[key: State<T>["name"]]: State<T>;
[key: State<T>["name"]]: T;
};

@@ -5,0 +5,0 @@ export declare enum Priority {

{
"name": "@figliolia/galena",
"version": "1.0.1",
"version": "2.0.0",
"description": "A performant state management library supporting mutable state, batched updates, middleware and a rich development API",

@@ -37,3 +37,3 @@ "main": "dist/index.js",

"dependencies": {
"@figliolia/event-emitter": "^1.0.6"
"@figliolia/event-emitter": "^1.0.7"
},

@@ -40,0 +40,0 @@ "devDependencies": {

@@ -57,3 +57,3 @@ # Galena

const subscription = AppState.subscribe("navigation", navigationState => {
const subscription = AppState.subscribe("navigation", state => {
// React to changes to Navigation state

@@ -60,0 +60,0 @@ });

@@ -33,5 +33,5 @@ import { AutoIncrementingID } from "@figliolia/event-emitter";

* AppState.subscribe(appState => {
* const navState = appState.get("navigation");
* const { currentRoute } = navState.state;
* // do something with state changes!
* const navState = appState.get("navigation");
* const { currentRoute } = navState.state;
* // do something with state changes!
* });

@@ -42,4 +42,4 @@ * ```

* NavigationState.subscribe(navigation => {
* const { currentRoute } = navigation.state
* // do something with state changes!
* const { currentRoute } = navigation
* // do something with state changes!
* });

@@ -50,5 +50,5 @@ * ```

* ```typescript
* NavigationState.subscribeAll(galenaInstance => {
* const { currentRoute } = galenaInstance.get("navigation").state
* // do something with state changes!
* NavigationState.subscribeAll(nextState => {
* const { currentRoute } = nextState.navigation
* // do something with state changes!
* });

@@ -60,4 +60,4 @@ * ```

* NavigationState.update(state => {
* state.currentRoute = "/profile";
* // You can mutate state without creating new objects!
* state.currentRoute = "/profile";
* // You can mutate state without creating new objects!
* });

@@ -173,5 +173,5 @@ * ```

name: K,
mutation: Parameters<T[K]["subscribe"]>["0"]
callback: Parameters<T[K]["subscribe"]>["0"]
) {
return this.get(name).subscribe(mutation);
return this.get(name).subscribe(callback);
}

@@ -200,3 +200,3 @@

*/
public subscribeAll(callback: (state: Galena<T>) => void) {
public subscribeAll(callback: (nextState: T) => void) {
const subscriptionID = this.IDs.get();

@@ -208,3 +208,3 @@ const stateSubscriptions: [state: string, ID: string][] = [];

this.state[key].subscribe(() => {
callback(this);
callback(this.state);
}),

@@ -211,0 +211,0 @@ ]);

@@ -56,3 +56,3 @@ import { MiddlewareEvents } from "Middleware/types";

* ```typescript
* MyState.subscribe(({ state }) => {
* MyState.subscribe((state) => {
* const { listItems } = state

@@ -241,3 +241,6 @@ * // Do something with your list items!

this.lifeCycleEvent(MiddlewareEvents.onUpdate);
void this.scheduleTask(() => this.emitter.emit(this.name, this), priority);
void this.scheduleTask(
() => this.emitter.emit(this.name, this.state),
priority
);
}

@@ -262,3 +265,3 @@

*/
public subscribe(callback: (nextState: State<T>) => void) {
public subscribe(callback: (nextState: T) => void) {
return this.emitter.on(this.name, callback);

@@ -265,0 +268,0 @@ }

import type { State } from "./State";
export type MutationEvent<T extends any> = {
[key: State<T>["name"]]: State<T>;
[key: State<T>["name"]]: T;
};

@@ -6,0 +6,0 @@

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