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

@flatmax/lit-jrpc-swig

v1.0.2

Published

Microapp to connect Lit and node to c++ with swig and jrpc-oo. This is a microapp starter.

Downloads

5

Readme

lit-jrpc-swig : lit-jrpc to jrpc-node to node-C++

Basic microapp infrastructure for Lit web components which interface other web-components or nodejs using jrpc-oo.

In this microapp, lit eventually interfaces C++ over the network through jrpc then locally from js to C++ using swig.

This infrastructure can be easily cloned and updated for your own microapp which allows you to call objects using JRPC2 over the network between browsers, node or both.

Local Demo with nodjes and web-dev-server

First compile the C++ with swig. Then setup the network and run.

compile C++

Follow the README.md in C++

cd C++
./autogen.sh
./configure
make
# test if you like
cd test
./RunTest.js

setup the network and webapp

We will use secure websockets (although you don't have to), so first generate the certificate :

./jrpc-node.genCert.sh

Install the requirements :

npm i

Start jrpc-node

Start the nodejs JRPC-OO side :

./jrpc-node.js

Start lit-jrpc

Start the web dev server :

npm start

If the browser doesn't open to the demo, manually copy the url from the command line to the browser.

Note : for the first time, look at the console, as you have to clear the browser to use the private cert in this example due to the browser's "privacy error".

In the browser

Click the Test.sayHello button to execute the Test::sayHello C++ code on the other side of the network.

Customise this microapp

We will clone and take ownership of the webcomponent and node class. We will use vanilla in place of lit.

  • First clone the repo : git clone https://github.com/flatmax/lit-jrpc-node.git
  • Rename the repo : mv lit-jrpc-node vanilla-jrpc-node

Rename the webcomponent

Steps to create your own web component :

  • Choose a name for your component : I will choose VanillaJRPC (vanilla-jrpc)
  • Rename some files in the repo :
    • mv lit-jrpc.js vanilla-jrpc.js
    • mv src/LitJRPC.js src/VanillaJRPC.js
  • Find and replace the component name :
    • Replace "LitJRPC" for "VanillaJRPC"
    • Replace "lit-jrpc" for "vanilla-jrpc"

Customise your OO class

  • Choose a name for your class : I will choose VanillaNode
  • Rename the class file :
    • mv TestClass.js VanillaNode.js
  • Find and replace the class name :
    • Replace "TestClass" for "VanillaNode"