2.1.0 • Published 7 months ago

base-classes v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

JavaScript Base Classes

You can find the full documentation on the website.

Description

Useful JavaScript base classes for efficient and quick solutions to common problems.

Installation

npm install base-classes

Store

The Store is a base class that provides the necessary methods and attributes to organize state management efficiently and easily.

Import

import {Store} from 'base-classes'
const {Store} = require('base-classes')

Basic Usage

import {Store} from 'base-classes'

class MyClass extends Store {
    state = { count: 1 }
}

const myClass = new MyClass()

myClass.subscribe((state, prevState) => {
    console.log('state changed:', state)
})
myClass.updateState((state) => {
    return {...state, count: 2}
})

API

Contributing

Read our contributing guide to learn about our development process.

Code of Conduct

This project has adopted the Contributor Covenant as its Code of Conduct, and we expect project participants to adhere to it. Please read the full text so that you can understand what actions will and will not be tolerated.

Authors

License

MIT License