npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@justbe-angular/jb-bizconcept

v2.3.13

Published

biz concept wrapper for justbe still in experimental phase don't use

Downloads

18

Readme

Bizconcept

Common pattern to handle justbe bizconcept. To get basic concept lets consider bizconcept as list/collection/array. for example consider myMatches bizconcept which returns the list of matches so how the response is handle and what processes happens under the hood are as follows,

step 1 : app requests for a bizconcept. 
step 2 : library calls server and one parallel process look in to pouch database if some older records are present.
step 3 : if older matches are present then it update the store as store got updated and app listen to store application view gets updated automatically.
step 4 : As asynchronus response of bizconcept comes from server it also got updated in to store and application view gets updated automatically.

so one name to these steps can be given => bizconcept synchronisation

Installation

Use the node package manager npm to install @justbe-angular/jb-bizconcept.

npm install @justbe-angular/jb-bizconcept --save

Usage

import JBBizconceptModule into your root module/app.module

import { NgModule } from '@angular/core';
import { JBBizconceptModule } from '@justbe-angular/jb-bizconcept';
@NgModule({
    declarations: [
        ..
    ],
    imports: [
        ..,
        JBBizconceptModule,
        ..,
    ]
})
export class AppModule { }

configure bizconcept service at root of your application.

import { Component } from '@angular/core';
import { BizconceptService } from '@justbe-angular/jb-bizconcept';
@Component({
    templateUrl: 'root.component.html'
})
export class RootComponent {
    ..
    constructor(
        ..,
        private bizconceptService: BizconceptService,
        ..
    ){}
    this.bizconceptService.setConfig({
        apiEndpt: 'http://your-domain.com', //api end points to make calls
        apiType: 'mapi' //api access type //api//mapi//for secure and public access
    })
}

synchronise 'allLiveMatches' bizconcept;

import { BizconceptService } from '@justbe-angular/jb-bizconcept';
import { StoreService } from '@justbe-angular/jb-store';
export class MatchesTabComponent{
    constructor(
        ..,
        private bizconceptService: BizconceptService,
        private storeService: StoreService
        ..,
    ){}
    subscriptions = [];
    ngOnInit(){
        this.bizconceptService.sync({ pattern: 'allLiveMatches' });
        let subOne = this.storeService.getListener('allLiveMatches').subscribe(allLiveMatches => {
            console.log(allLiveMatches)
            //here are the list of matches
            //caution as we are using subscription we need to unsubscribe it when we dont need it to //-avoi memory leaks & and data leaks
        })
    }
    ngOnDestroy(){
        this.subscriptions.forEach(sub=>{
            sub.unsubscribe();
        })
    }
}

Use SuperSubscriptionsClass class to avoid boilerplate code as below;

Installation

Use the node package manager npm to install @justbe-super-classes/subscriptions.

npm install @justbe-super-classes/subscriptions --save
import { BizconceptService } from '@justbe-angular/jb-bizconcept';
import { StoreService } from '@justbe-angular/jb-store';
import { SuperSubscriptionsClass } from '@justbe-super-classes/subscriptions';
export class MatchesTabComponent extends SuperSubscriptionsClass{
    constructor(
        ..,
        private bizconceptService: BizconceptService,
        private storeService: StoreService
        ..,
    ){}
    ngOnInit(){
        this.bizconceptService.sync({ pattern: 'allLiveMatches' });
        let subOne = this.storeService.getListener('allLiveMatches').subscribe(allLiveMatches => {
            console.log(allLiveMatches)
            //here are the list of matches
            //caution as we are using subscription we need to unsubscribe it when we dont need it to //-avoi memory leaks & and data leaks
        })
    }
}

by using super class we dont need to delare subscriptions array and dont need to mannually //unsubscribe to the subscriptions under the hood there is one base method ionViewDidLeave(){} which is lifecycle event hook for ionic which gets triggered as ionic view get left from viewcontroller subscriptions gets unsubscribed

pattern can get more complecated as we need to synchronise child bizconcept ex 'liveAndUpcomingMatchesForTP/tp-12342gs5' as below,

..
this.bizconceptService.sync({ pattern: 'completedMatchesForTP/' + this.team.id });
let subOne = this.storeService.getListener('completedMatchesForTP-' + this.team.id).subscribe(completedMatchesForTP => {
    console.log(completedMatchesForTP);
})
..

Bizconcept with infinite scroll

..
let configs = this.bizconceptService.sync({ pattern: 'completedMatchesForTP/' + this.team.id });
..

the bizconcept also return a configs object which has complete information of store and pouch where data is going to resides, this object is input to the pagination method and that method evaluate where next set of response is going to resides suppose paginate method gets called when ever view reaches to the bottom,

paginate(event){
    this.bizconceptService.paginate(configs).subscribe(res => {
        if (res === 404) {
            console.log('no more data to load')
        }
        event.complete();
    })
}

License

MIT