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

@rage-js/core

v2.0.2

Published

Core module for RAGE which provides the functionality for RAGE methods.

Downloads

52

Readme

The core module of RAGE which provides the functionality for RAGE methods like Push After Interval, Push On Update and No Interval.

Read the full documentation about the core module through this link: https://github.com/rage-js/docs

Table of Contents

Installation

npm install @rage-js/core

Run the command above to install the module.

How to use it?

Setup

You could use @rage-js/cli for that, because it's primarily built for this purpose only.

Run the following commands below:

npm install @rage-js/cli
npx rage

If you ran the above command, it will start to interact with you, provide the inputs it asks and then wait for it to create it by it's own. Once done, you can go to the directory that you gave as input, you will be able to see the main javascript file, package.json file and also rage.config.json which is the configuration file for RAGE core module.

[!NOTE] If you mess up with the configuration while giving the cli the inputs, you can just go to the respective directory and search for the rage.config.json file and then you can edit the configuration there manually.

How to use the core module manually?

This is the default file content that the cli will provide you:

// Run "npm install" to install the dependencies.

const { App } = require("@rage-js/core");

const app = new App("./rage.config.json", true);

async function start() {
  await app.setup();
  await app.start();
}

start();

process.on("exit" || "SIGINT" || "SIGTERM", async () => {
  await app.stop();
  process.exit(0);
});

As you can see, every function in App class is async. Now what is App?

  • App is the initializer and also the main thing that runs the core instance to run the methods, etc. When initialzing the App, you have to provide two parameters, one is the path to the rage.config.json file, while the other one is to toggle logger on or off.

    • Setup - You have to run setup() function before starting the app or doing anything else. Because that function will read the configuration file and setup it up as class variables for other functions to access later. If you ran start() before this function, then it shall throw an error to run setup() before starting the application.

    • Start - As the name suggests, this function starts the the App instance and also method instances as well. Basically the App will run a method instance loop that runs until stop() is called.

    • Stop - As mentioned above, this function stops the App instance and also method instances as well, but it also finally pushes the local json data back to the cloud database and deletes the json data files. It is recommended to add this code block below to run this function when the application is about to terminate, by the user or itself.

      process.on("exit" || "SIGINT" || "SIGTERM", async () => {
        await app.stop();
        process.exit(0);
      });

Made with 💢 and Node.js