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

crfsa-core

v0.0.17

Published

Core Module for Carrefour Application

Downloads

2

Readme

Running unit tests

Run ng test to execute the unit tests via Karma.

Bootstrapping the Core Module (Happens in main application)

Step 1: Importing it into your project's app.module.ts file

import {CarrefourCoreModule} from 'crfsa-core-module';

After adding this import statement, you have to add it to the imports of your app.module.ts.

Something along these lines:

@NgModule({
  ...
  imports: [
    CarrefourCoreModule
  ]
  ...
})

Now you have all of the Core Module's exposed functionality within your project.

But, there are a couple more things to do in order to get your module working with the Core Module.

Step 2: Initializing the Bootstrapping process of the CoreModule

In order for the Core Module to start it's Bootstrapping functionality, you have to call startInitialization on the CoreModuleBootstrapService

TIP: Do this within the ngOnInit lifecycle within you app.component.ts to trigger it properly.

import {CoreModuleBootstrapService} from 'crfsa-core-module';

export class AppComponent implements OnInit {
  ...
  constructor(private coreModuleBootstrapService: CoreModuleBootstrapService) {

  }
  ...
  ngOnInit() {
    this.coreModuleBootstrapService.startInitialization(
      [
        ...
        'CoreModule',
        'AuthModule',
        ...
        // Here is where you specify the names of all modules you're going to be using within your app: this is an Array<string>
      ]
    )
  }
  ...
}

NOTE: this bootstrapping/nitializing happens only once within the carrefour application, this is not done from within any module. A module's job is not to handle the bootstrapping, the bootstrapping is handled by the lifecycle of the main application aka the rootPage's ngOnInit lifecycle.

Registering a module in the Core Module (Happens within modules)

Here's some example code to illustrate how this happens:

    listenForRegistrationEvent() {
      // Add a listener to the 'crf_module_init' browser event to trigger the module registry process
      document.addEventListener("crf_module_init", (event: any) => {
          // Get the register function from the event.detail property
          const register: (registrationData: ModuleRegistrationData, callback: any)=> void = event.detail;

          const moduleData: ModuleRegistrationData = {
            name: 'TestModule', // Set the name of the module to be registered
            version: '0.0.1', // Set the registration version of the module, all versions of all modules must match
            eventTypes: [
              ...
              'test/example/event',
              'test/api/onResponse', // These are needed to register the events in the Event Bus
              'test/api/request'
              ...
            ],
            isInitialModule: false, // Only 1 module can be the Initial Module
            isAuthenticationModule: false // Only 1 module can be the authenticationModule
          }

          // Call registration function with the moduleData variable to register it
          register(moduleData, (eventBus) => {

              this.bus = eventBus; // if everything goes right, this callback should be called and you are now granted the event bus

          });
      });
    }