Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@intelligo.ai/bonfire

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intelligo.ai/bonfire

Open source decorators utils for angular

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
increased by733.33%
Maintainers
4
Weekly downloads
 
Created
Source

Bonfire

Writen by Tzach bonfil. github

Build Status

Bonfire is open source decorators utils for angular.

  • Make change detection easy
  • Makes Observable for you

You can your code cleaner and simpler with adding just 2 decorators to your code. We know that angular change detection is not simple if you want it to be officent, so I made Bonfire. Simple solution to hard problem.

Now there is no use to call the change detection!

Installation

Bonfire requires Node.js v4+ to run.

Install the dependencies and devDependencies and start the server.

$ npm i @intelligo/bonfire

The Tools

See Examples Below:

ToolsWhat it does?How to use?
(1) ReRenderOnChangeThe decorator on the component is actually what causes the other decorators to use change detectionPut it on the top of the component and make sure the component have change detection injected
(2) SetPickerPut it on a property we want to trigger re-render only if it changedJust put it on the property
(3) WithObservableGenerate a behavior subject (Observable), Which emit values that stored in the original property (You don't need to maintain it at all! Just use it)Put in on the original property and next to it write the same property name with '$', it will store automatically

Where to use

Before you use it, make sure you inject the change detection to your component!

import { ReRenderOnChange, SetChecker, WithObservable } from '@intelligo.ai/bonfire';

@ReRenderOnChange() // <== (1)
@Component({
  selector: 'my-component',
  templateUrl: './my-component.component.html',
  styleUrls: ['./my-component.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush // <== IMPORTANT
})

export class MyComponent {

  @SetChecker() group: ISomeInterface = {
   test: [
     {
       name: 'Hello',
       age: 30
     }
    ]
  }; // <== (2)

  @WithObservable() showLoader = false; showLoader$: BehaviorSubject<boolean>; // <== (3)

  constructor(
    private cd: ChangeDetectorRef // <== MOST IMPORTANT
  ) {

    setTimeout(() => {
      // This won't trigger change detection unless you are using SetChecker :-)
      this.groups.test[0].name = 'World'
    },5000)

  }
}

Dependencies

Bonfire uses a number of open source projects to work properly:

  • Angular - Platform for building mobile and desktop web applications.
  • Rxjs - Reactive extensions library for javascript.
  • uuid - Simple, fast generation of RFC4122 UUIDS.

Todos

  • Write MORE Tests

License

MIT

Keywords

FAQs

Package last updated on 20 Nov 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc