
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
@lit-app/state
Advanced tools
@lit-app/state is a global state management, integrating with lit web-components.
There are plenty options available for state management, so why yet another one?
import { State, StateController, property } from "@lit-app/state";
import { LitElement } from "lit";
// declare some state
class MyState extends State {
@property({value: 'Bob'}) name
}
const myState = new MyState()
// declare a component
class StateEl extends LitElement {
// StateController is a Reactive Controller binding myState with the element
state = new StateController(this, myState)
override render() {
return html`
<div>This will be updated when the state changes: ${myState.name}</div>
`;
}
}
// changing the state will reflect in the template
myState.name = 'Alice'
Very simple demo on lit.dev playground.
State
extends EventTarget and dispatches a StateEvent
when one of its properties changes.
StateController
listens for a StateEvent
emited by a bound state. By default, it calls a requestUpdate on the lit element; the callback function is configurable.
Decorators augment the capacity of state properties:
Bind a state property with localStorage, so that its value can persist.
import { State, property, storage } from "@lit-app/state";
class MyState extends State {
@storage({key: 'localstorage_key'})
@property({value: 'Bob'}) name
}
const myState = new MyState()
Init a state property value with an URL parameter, and also persist it to localStorage.
import { State, property, storage } from "@lit-app/state";
class MyState extends State {
@query({parameter: 'name-parameter'})
@storage({key: 'localstorage_key'})
@property({value: 'Bob'}) name
}
const myState = new MyState()
Hook decorator allows to configure state properties for the use of other third parties
import { State, property, hook } from "@lit-app/state";
class MyState extends State {
@hook('firebase', {path: 'a/path/to/be/consumed'})
@property({value: 'Bob'}) name
}
const myState = new MyState()
> pnpm add @lit-app/state
or
> npm install @lit-app/state
FAQs
state management for lit-app
The npm package @lit-app/state receives a total of 327 weekly downloads. As such, @lit-app/state popularity was classified as not popular.
We found that @lit-app/state demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.