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

@manga-js/manga-js-client

v1.2.1

Published

Manga JS Client

Downloads

56

Readme

Manga Client

Node.js SDK client to Manga Server

Usage

const MangaClient = require("@manga-js/manga-js-client")
var config = {
    ip:"http://localhost",
    port:9293,
    appName:"My client name",
    auth:{
        username: 'abc',
        password: '123'
    }
};
var reciver = new MangaClient(config);
reciver.onDisconnect.add(()=>{console.log('disconnected')});
reciver.onConnect.add(()=>{
    console.log("=== RECIVER CONNECTED");
    reciver.addListenerOnChange("test.onchanges.value1", (value)=>{
        console.log("addListenerOnChange 1", value) ;
    }) ;
    reciver.addListenerOnChange("test.onchanges.value2", (value)=>{
        console.log("addListenerOnChange 2", value) ;
    }) ;
    reciver.addListenerOnSet("test.onset.value1", (value)=>{
        console.log("addListenerOnSet ", value) ;
    }) ;
    reciver.addListenerOnChangeLenth("test.onchangeLength.list1", (value)=>{
        console.log("addListenerOnChangeLenth ", value) ;
    }) ;
})
console.log("trying connect");
reciver.connect();

General Information

All path need to be passed using like a variable, becouse they will be transformed in variable in the server.

//ok:
{
    "path":"a.b.c"
}
//wrong:
{
    "path":"a b c"
}

If your path use integer numbers between points like { path:a.2, value:"passed value"}, they will be transformed to array:

{
    "a":[
        null,
        null,
        "passed value"
    ]
}

But it would to be avoid, do not do that! Prefere to use names and objects, not list.

Methods

checkin

{
    name:"Sofia System"
}

set

{
    path:"semantic.path.here",
    value: {
        "wharever":{
            "you":"whant",
            "exemple": 3.2,
            "orList":[1,2,3]
        }
    }
}

reset

{ path, value}

message

Message is the most quickly method to send a message.

{ path, value, save, reset }

get

{path}

addListener

| Just to socket.io clients.

Cause you're connected so is better to recive data when that changes than need to keep asking every time to check it, are you agree? Thinking about it manga-js create addListener with the same objective than actions in C# or Signals events.

You can add listener to property when that changes or are setted.

{
    listener:
        {
            property,
            updateMode
        },
    handler:
        {
            method
        }
}

example:

socket.emit("addListener", {
        listener:{
            property:"users.id_23423.nickName",
            updateMode:"onChange"
        },
        handler:{
            method:"myLocalMethodName"
        }
    }, (r)=>{
        console.log("addListener callback recived after save listener intemption", r ) ;
    }) ;

listener.updateMode:

updateMode is the trigger to start events to send message to the listener


`onChange|onSet|onInterval|onChangeLength`

`onChange` : when the value change something
`onSet` : when the value is setted, changing or not
`onInterval` : every time interval
`onChangeLength` : when some object or array change the length property if it exists

handler.method

Is the method in client-side socket connection that will be called after event is trigger

handler.filter

Filter is used to handle data before is sent to listener client
{
    "listener":{
        "property":"user.id_23423.birthday",
        "updateMode":"onInterval",
        "frequency":1000
    },
    "handler":{
        "method":"myMethod",
        "filter":{
            "mode":"full|change", //if change, get just data that was changed, if full, get full data
            "data":"user.id_23423.profile" //data to recive after listener is trigger
        }
    }
}