Code Monkey home page Code Monkey logo

ngx-state's Introduction

@devlime/ngx-state

Simple State Management Utilities for Angular Apps

CircleCI Codecov branch Greenkeeper badge Commitizen friendly semantic-release

Let's make state easy

@devlime/ngx-state was created to simplify state management in Angular applications. We do not consider it a "framework" but rather a bag of utilities to help make the world a better place by making performant state management EASY in Angular without the need to learn YET ANOTHER FRAMEWORK or REDUX! @devlime/ngx-state provides a VERY SIMPLE type-safe state class to extend from, a handful of decorators to help make your life more enjoyable while keeping state CLEAN & READABLE, and a *subscribe directive so you aren't *ngIfing your life away

Setup

yarn add @devlime/ngx-state if you wanna be hip

or

npm install @devlime/ngx-state --save if your neck has a beard

Usage

Bear with us... We promise next time you check this it will be filled in

State

The State "service" class is a base class to extend your state(s) from. It takes in an interface and provides a type-safe set function. It is recommended that your States be used only to store your state data and that's it.

State Usage Example:

Basic state class example

State set Usage Example:

Basic state set usage example

Decorators

The decorators in @devlime/ngx-state were created to make your life easy by keeping states clean and readable. Behind the scenes the property decorators leverage Object.defineProperty to create both hidden private, and public properties with setters and getters that provide immutability and indirect access to your state data.

@StateProp (it's just a variable)

Type Parameters

T: extends State, P: value type

Parameters

defaultValue: P = null

Description

The @StateProp decorator is used to store a plain (non-observable) value that doesn't need to be subscribed to.

@StateBehavior (it's just a BehaviorSubject)

Type Parameters

T: extends State, P: BehaviorSubject value type

Parameters

defaultValue: P = null

Description

The @StateBehavior decorator is used to store a value as an RxJS BehaviorSubject. When creating a @StateBehavior the decorator will automagically create a second property of the same name but with a $ suffix. The property will be used to access the BehvaiorSubject via the asObservable method. You should also manually add this second property to the state to maintain proper typings.

@StateReplay (it's just a ReplaySubject)

Type Parameters

T: extends State, P: ReplaySubject value type

Parameters

replaylength: number = 1

@StateSubject (it's just a Subject)

Type Parameters

T: extends State, P: value type

Parameters

N/A

Schematics

Angular schematics for @devlime/ngx-state are already underway! Update coming soon!

Inspiration

Project inspired by Angular and how awesome it is when used properly (with great power comes great responsibility).

Contact

Created by John Pribesh for Devlime Labs

License

@devlime/ngx-state is released under the MIT license for you to enjoy, abuse, or fall in love and have 3 kids with. This is our gift to you and what you do with it is your call!

ngx-state's People

Contributors

dependabot[bot] avatar greenkeeper[bot] avatar jrpribs avatar semantic-release-bot avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ngx-state's Issues

An in-range update of @angular-devkit/build-ng-packagr is breaking the build 🚨

The devDependency @angular-devkit/build-ng-packagr was updated from 0.803.20 to 0.803.21.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@angular-devkit/build-ng-packagr is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ci/circleci: test: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @angular-devkit/build-angular is breaking the build 🚨

The devDependency @angular-devkit/build-angular was updated from 0.803.20 to 0.803.21.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@angular-devkit/build-angular is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ci/circleci: test: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/jasmine is breaking the build 🚨

The devDependency @types/jasmine was updated from 3.5.1 to 3.5.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/jasmine is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/circleci: build: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of karma-jasmine-html-reporter is breaking the build 🚨

The devDependency karma-jasmine-html-reporter was updated from 1.4.2 to 1.5.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

karma-jasmine-html-reporter is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ci/circleci: test: Your tests failed on CircleCI (Details).

Commits

The new version differs by commits ahead by 0, behind by 2.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @angular/cli is breaking the build 🚨

The devDependency @angular/cli was updated from 8.3.20 to 8.3.21.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@angular/cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ci/circleci: build: Your tests passed on CircleCI! (Details).
  • ci/circleci: test: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.