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

node-red-contrib-web-components

v0.6.0

Published

Expose useful functionality to Node-RED developers through the magic of Web Components

Downloads

30

Readme

node-red-contrib-web-components

Some Node-red nodes and web components that make integrating some aspects of web sites with Node-red a little easier.

How does it work?

Each Node-RED node has a corresponding web component that handles the UI and interaction between the two across the network.

The rationale for this can be found here.

For example, if you want to use a camera in a web page, you can drag the component-camera node onto your Node-RED flow, configure it to have a unique name (camera1), and then add the following piece of markup to your page

<node-red-camera data-nr-name="camera1" data-nr-type="still"></node-red-camera>

These two nodes are now linked by way of the unique name. When the web page is loaded, and the component initialised, any data created by that node (in this instance a video or still image) will be passed to the specific node in the Node-RED.

Quickstart

Having installed the node-red-contrib-web-components in your Node-RED instance through to Manage Pallete UI, follow the next steps.

  1. Copy the content of the demo-flow.json file in this repo.
  2. Head to your Node-RED instance and create a new flow.
  3. Click on the hamburger nenu at the top-right corner of the screen and go to import > Clipboard and paste the code you copied from demo-flow.json
  4. Click on deploy and head to https://YOUR_NODE_RED_INSTANCE_URL.com/wcdemo

Prerequisites for usage

Polyfill

Not all browsers support web components natively, but you can include the following shim/polyfills in the <head> of each web page that you use your components in to increase the availability of your chosen web components.

<script src="https://unpkg.com/@webcomponents/custom-elements"></script>
<script src="https://unpkg.com/@webcomponents/shadydom"></script>

Script Tags

To use each component, you need to first include a <script> tag in the <head> of your HTML document that contains the code for that component. For each component you wish to use there is an individual <script> tag required.

For example, the camera component will require

<script src="/web-components/camera"></script>

You can also have an absolute URL if you have a cloud-based Node-RED instance, but that's not required <script src="http://node-red.blah/web-components/camera"></script>

<script src="/web-components/camera"></script>

Available Nodes

Camera

component-camera

Chatbot nodes

Chatbot

component-chatbot

Chatbot nodes

Additional Nodes

Only the camera-component is currently complete, but I think the following as a minimum set will make it much easier to build web apps that integrate well with Node-RED nodes.

  1. A file selector
  2. An audio capture node for recording sound
  3. An output node for the server to send data to a client from within a Node-RED flow