New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bloc-react

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bloc-react - npm Package Compare versions

Comparing version 0.0.14-2 to 0.0.14-3

9

dist/bloc-react.d.ts

@@ -49,8 +49,11 @@ import { Subscription } from 'rxjs';

private blocListGlobal;
private blocObservers;
private blocChangeObservers;
private blocValueChangeObservers;
private mockBlocs;
constructor(blocs: BlocBase<any>[], options?: ReactBlocOptions$1);
notifyChange(bloc: BlocBase<any>, state: any): void;
notifyValueChange(bloc: BlocBase<any>): void;
notifyTransition(bloc: BlocBase<any>, state: any, event: any): void;
addBlocObserver<T extends BlocBase<any>>(blocClass: BlocClass<T>, callback: (bloc: T, event: ChangeEvent<ValueType<T>>) => unknown, scope?: BlocObserverScope): void;
addBlocChangeObserver<T extends BlocBase<any>>(blocClass: BlocClass<T>, callback: (bloc: T, event: ChangeEvent<ValueType<T>>) => unknown, scope?: BlocObserverScope): void;
addBlocValueChangeObserver<T extends BlocBase<any>>(blocClass: BlocClass<T>, callback: (bloc: T) => unknown, scope?: BlocObserverScope): void;
addLocalBloc(key: string, bloc: BlocBase<any>): void;

@@ -83,2 +86,3 @@ removeLocalBloc(key: string): void;

onChange: null | ((change: ChangeEvent<T>) => void);
onValueChange: null | ((value: T) => void);
constructor(initialValue: T, blocOptions?: BlocOptions);

@@ -88,2 +92,3 @@ protected _consumer: BlocConsumer | null;

protected notifyChange: (state: T) => void;
protected notifyValueChange: () => void;
}

@@ -90,0 +95,0 @@

@@ -82,2 +82,3 @@ 'use strict';

this.onChange = null;
this.onValueChange = null;
this._consumer = null;

@@ -91,2 +92,6 @@ this.notifyChange = (state) => {

};
this.notifyValueChange = () => {
this._consumer?.notifyValueChange(this);
this.onValueChange?.(this.state);
};
}

@@ -109,2 +114,3 @@ set consumer(consumer) {

this.next(newState);
this.notifyValueChange();
} else {

@@ -131,2 +137,3 @@ console.error(`"mapEventToState" not implemented for "${this.constructor.name}"`);

this.next(value);
this.notifyValueChange();
};

@@ -168,3 +175,4 @@ }

this._blocMapLocal = {};
this.blocObservers = [];
this.blocChangeObservers = [];
this.blocValueChangeObservers = [];
this.mockBlocs = [];

@@ -181,3 +189,3 @@ this.blocListGlobal = blocs;

this.observer.addChange(bloc, state);
for (const [blocClass, callback, scope] of this.blocObservers) {
for (const [blocClass, callback, scope] of this.blocChangeObservers) {
const isGlobal = this.blocListGlobal.indexOf(bloc) !== -1;

@@ -193,8 +201,20 @@ const matchesScope = scope === "all" || isGlobal && scope === "global" || !isGlobal && scope === "local";

}
notifyValueChange(bloc) {
for (const [blocClass, callback, scope] of this.blocValueChangeObservers) {
const isGlobal = this.blocListGlobal.indexOf(bloc) !== -1;
const matchesScope = scope === "all" || isGlobal && scope === "global" || !isGlobal && scope === "local";
if (matchesScope && bloc instanceof blocClass) {
callback(bloc);
}
}
}
notifyTransition(bloc, state, event) {
this.observer.addTransition(bloc, state, event);
}
addBlocObserver(blocClass, callback, scope = "all") {
this.blocObservers.push([blocClass, callback, scope]);
addBlocChangeObserver(blocClass, callback, scope = "all") {
this.blocChangeObservers.push([blocClass, callback, scope]);
}
addBlocValueChangeObserver(blocClass, callback, scope = "all") {
this.blocValueChangeObservers.push([blocClass, callback, scope]);
}
addLocalBloc(key, bloc) {

@@ -201,0 +221,0 @@ this._blocMapLocal[key] = bloc;

{
"name": "bloc-react",
"version": "0.0.14-2",
"version": "0.0.14-3",
"scripts": {

@@ -5,0 +5,0 @@ "dev": "vite",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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