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

tson-rpc

v0.0.4

Published

Connect objects anywhere in pairs like quantum entanglement.

Downloads

6

Readme

TSON-RPC

Connect objects anywhere in pairs like quantum entanglement.

🧪 Experimental Technology. ❌ DO NOT USE IF YOU DON'T KNOW WHAT YOU'RE DOING. ❗It may expose your system to danger or attack.

Example



class Test{
    constructor(public name:string){}
    call(obj:Test,...args:any){
        console.log(this.name,'call()',obj, args);
        obj.print(args)
    }

    print(args:[]){
        console.log(this.name,'print', args);
        console.log(this.name,'print length', args.length);
        console.log(this.name,'print', args.map(x=>`${x}!`));
    }
    push(array:any[]){
        console.log(this.name,'push() before',array)
        array.push('pushed data');
        console.log(this.name,'push() after',array)
        console.log(this.name,'set',array)
        console.log(this.name,'set length',array.length)
        console.log(this.name,'set iter..',[...array])
        console.log(this.name,'set iter',array[Symbol.iterator])
    }
};
let client:WrappedHandler;

const test=new Test("[Remote]");

const erase=(data:any)=>JSON.parse(JSON.stringify(data));

const server=new WrappedHandler(req=>client.handle(erase(req)));
const id=server.new(test);



client=new WrappedHandler(req=>server.handle(erase(req)));
const remote=client.remote<Test>({id,type:typeOf(test)});


const localArray:string[]=[];

const local=new Test("[Local]");
remote.call(local,"local string");
remote.push(localArray);
console.log('localArray',localArray)

// [Remote] call() {} [ 'local string' ]
// [Local] print []
// [Local] print length 1
// [Local] print []
// [Remote] push() before []
// [Remote] push() after [] <--You can't see the remote object.
// [Remote] set []
// [Remote] set length 1
// [Remote] set iter.. [ 'pushed data' ]
// [Remote] set iter [Function (anonymous)]
// localArray [ 'pushed data' ]