Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ruben-arushanyan/base-classes
Useful JavaScript base classes for efficient and quick solutions to common problems.
https://github.com/ruben-arushanyan/base-classes
base-class class class-based constructor encapsulation extends inheritance inherited javascript object-oriented oop parent-class superclass
Last synced: about 2 months ago
JSON representation
Useful JavaScript base classes for efficient and quick solutions to common problems.
- Host: GitHub
- URL: https://github.com/ruben-arushanyan/base-classes
- Owner: Ruben-Arushanyan
- License: mit
- Created: 2022-09-22T15:08:11.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-03T23:26:07.000Z (about 1 year ago)
- Last Synced: 2024-10-13T18:43:05.254Z (2 months ago)
- Topics: base-class, class, class-based, constructor, encapsulation, extends, inheritance, inherited, javascript, object-oriented, oop, parent-class, superclass
- Language: JavaScript
- Homepage: https://base-classes.js.org
- Size: 1.52 MB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# [JavaScript Base Classes](https://base-classes.js.org)
> You can find the full documentation on the [website](https://base-classes.js.org).
## DescriptionUseful JavaScript base classes for efficient and quick solutions to common problems.
## Installation
```bash
npm install base-classes
```## [Store](https://base-classes.js.org/docs/store)
The `Store` is a base class that provides the necessary methods and attributes to organize state management efficiently and easily.
### Import```js
import {Store} from 'base-classes'
```
```js
const {Store} = require('base-classes')
```### Basic Usage
```js
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](https://base-classes.js.org/docs/store/#api)
- [constructor](https://base-classes.js.org/docs/store/#constructor)
- [state](https://base-classes.js.org/docs/store/#state)
- [updateState](https://base-classes.js.org/docs/store/#updatestate)
- [subscribe](https://base-classes.js.org/docs/store/#subscribe)
- [subscribeSelector](https://base-classes.js.org/docs/store/#subscribeselector)
- [prevState](https://base-classes.js.org/docs/store/#prevstate)## [Contributing](https://github.com/ruben-arushanyan/base-classes/blob/master/CONTRIBUTING.md)
Read our [contributing guide](https://github.com/ruben-arushanyan/base-classes/blob/master/CONTRIBUTING.md) to learn about our development process.
## [Code of Conduct](https://github.com/ruben-arushanyan/base-classes/blob/master/CODE_OF_CONDUCT.md)
This project has adopted the [Contributor Covenant](https://www.contributor-covenant.org) as its Code of Conduct, and we expect project participants to adhere to it. Please read the [full text](https://github.com/ruben-arushanyan/base-classes/blob/master/CODE_OF_CONDUCT.md) so that you can understand what actions will and will not be tolerated.
## Authors
- [Ruben Arushanyan](https://github.com/ruben-arushanyan)
## License
[MIT License](https://github.com/Ruben-Arushanyan/base-classes/blob/master/LICENSE)