You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@stencil/store

Package Overview
Dependencies
Maintainers
11
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stencil/store - npm Package Compare versions

Comparing version

to
1.1.0

18

dist/index.js

@@ -116,5 +116,8 @@ 'use strict';

handlers[eventName].push(callback);
return () => {
removeFromArray(handlers[eventName], callback);
};
};
const onChange = (propName, cb) => {
on('set', (key, newValue) => {
const unSet = on('set', (key, newValue) => {
if (key === propName) {

@@ -124,3 +127,7 @@ cb(newValue);

});
on('reset', () => cb(defaultState[propName]));
const unReset = on('reset', () => cb(defaultState[propName]));
return () => {
unSet();
unReset();
};
};

@@ -148,2 +155,9 @@ const use = (...subscriptions) => subscriptions.forEach((subscription) => {

};
const removeFromArray = (array, item) => {
const index = array.indexOf(item);
if (index >= 0) {
array[index] = array[array.length - 1];
array.length--;
}
};

@@ -150,0 +164,0 @@ const createStore = (defaultState) => {

8

dist/types.d.ts

@@ -10,8 +10,8 @@ export interface Handlers<T> {

export interface OnHandler<StoreType> {
(eventName: 'set', callback: SetEventHandler<StoreType>): void;
(eventName: 'get', callback: GetEventHandler<StoreType>): void;
(eventName: 'reset', callback: ResetEventHandler): void;
(eventName: 'set', callback: SetEventHandler<StoreType>): () => void;
(eventName: 'get', callback: GetEventHandler<StoreType>): () => void;
(eventName: 'reset', callback: ResetEventHandler): () => void;
}
export interface OnChangeHandler<StoreType> {
<Key extends keyof StoreType>(propName: Key, cb: (newValue: StoreType[Key]) => void): void;
<Key extends keyof StoreType>(propName: Key, cb: (newValue: StoreType[Key]) => void): () => void;
}

@@ -18,0 +18,0 @@ export interface Subscription<StoreType> {

{
"name": "@stencil/store",
"version": "1.0.1",
"version": "1.1.0",
"description": "Store is a lightweight shared state library by the StencilJS core team. Implements a simple key/value map that efficiently re-renders components when necessary.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet