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

crosstabtalk

v0.1.10

Published

Javascript browser tab/window local message communication library.

Downloads

1

Readme

Cross-Tabtalk

npm version GitHub version

  • Javascript browser tab/window local message communication library.
  • Crossdomain networked comunication between 2 or more windows.

Todo

  • Navigation requests.
  • Cross window method invocation (RMI).
  • Establish comunication with already existing windows.

Build

  • Install NPM
  • Clone the repository to your computer
  • Run npm install && npm run build

Usage

  • If youre using the UMD bundle the namespace for the project is CTalk.
  var manager = new CTalk.WindowManager("A");
  • The WindowManager is the object reponsible for handling the comunication.
  • Each window/tab should have one of these objects, to discern the windows a string type indicator.
  • To declare a window as type "A" we can create the WindowManager object.
  var manager = new WindowManager("A");
  • To open another window use the manager.openSession method that returns a WindowSession object.
  • The WindowSession object is responsible for handling comunication to another window.
  • We can use the method session.sendMessage(data, authentication) to send data to another window.
  • The callbacks onReady, onMessage and onClose can be used to receive data from the other window.
  var session = manager.openSession("anotherwindow.html", "B");
  session.onReady = function()
  {
    console.log("Session B is ready.");
  };
  session.onMessage = function(data, authentication)
  {
    console.log("Session B message received", data, authentication);
  };
  session.onClose = function()
  {
    console.log("Session B closed");
  };
  
  ...

  if(manager.sessionExists("B"))
  {
    session = manager.getSession("B");
  }
  • Messages can be broadcasted to all known windows using the WindowManager object.
  • To send messages the broadcast(data, authentication) method can be used.
  • To process broadcasted messages the onBroadcastMessage callback can be used.
manager.broadcast({a:"something"}, "authenticationtoken");

manager.onBroadcastMessage = function(data, authentication)
{
  console.log("Broadcast Message received", data, authentication);
};
  • To close a session you can use the session.close() method.
  • The close method can receive a closeWindow parameter to indicate if the session window should be closed.
  • To handle message globally the manager object also contains an onMessage callback that receives the window type, data and authentication data as parameters.
manager.onMessage = function(type, data, auhentication)
{
  console.log("Message received", type, data, authentication);
}

Comunication Diagram

  • Bellow there is a simple comnunication diagram explaining the handshake process used to establish comunication.
  • In this example three windows exist the fist window is A, A is opens B.
  • B opens the window C, comunication from A to C has to be redirected by B.
           A              Open                 B
           | --------------------------------> |
           |                                   |
           |            (A waits)              |
           |                                   |
           |           Ready Message           |
           | <-------------------------------- |
           |     {                             |
A Knows B  |         action:READY,             |
   data    |         originUUID:...,           |
           |         originType:...            |
           |     }                             |
           |                                   |
           |           Ready Message           |
           | --------------------------------> |
           |     {                             |
           |         action:READY,             |  B Knows A
           |         originUUID:...,           |     data
           |         originType:...            |
           |     }                             |
           |                                   |
           | <-----------[Messages]----------> |
           |     {                             |
           |         action:MESSAGE,           | 
           |         originUUID:...,           |
           |         originType:...,           |
           |         destinationUUID:...,      |
           |         destinationType:...,      |
           |         authentication:...,       |
           |         data:{...}                |
           |     }                             | 
           |                                   |
           |          Lookup Window            |
           | --------------------------------> |                                   C
           |     {                             |                                   |
           |         action:LOOKUP,            | Lets assume                       |
           |         originUUID:...,           | B known C                         |
           |         originType:...,           | its sends a response              |
           |         destinationType:...,      | containing C data.                |
           |         url:...                   |                                   |
           |     }                             |                                   |
           |                                   |                                   |
           |          Lookup Response          |                                   |
           | <-------------------------------- |                                   |
           |     {                             |                                   |
A Known C  |         action:LOOKUP_FOUND   ,   | If B doesnot known C              |
 via B     |         originUUID:...,           | action is lookup_unknown          |
           |         originType:...,           | and data empty.                   |
           |         destinationType:...,      |                                   |
           |         destinationUUID:...,      |                                   |
           |         data:                     |                                   |
           |         {                         |                                   |
           |             uuid:...,             | UUID of C                         |
           |             type:...              | Type of C                         |
           |         }                         |                                   |
           |     }                             |                                   |
           |        Ready Message from A       |         Ready Message from A      |
           | --------------------------------> | --------------------------------> | 
           |                                   |                                   |
           |                                   |                                   |