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

@unio/union

v1.1.2

Published

A complete set of resources to add plugins as extension to any original application.

Downloads

3

Readme

Union

Quality Gate Status Coverage

PoC Vite Lib Version PoC Vite Lib License PoC Vite Lib Downloads jsDelivr Month PoC Vite Lib Downloads NPM PoC Vite Lib Dependencies PoC Vite Lib Size

semantic-release: angular

Union is a library that will help you build plugins, third party customizations and inject them into any application. It provides resources for both sides, you application and the plugins or third party applications, to communicate safely.

Want to be updated about this project changes? Just follow the CHANGELOG.

Install 📑

This module is published under NPM registry, so you can install using any Node.js package manager.

npm install @unio/union

Install from CDN

The bundles of this module are also available on JSDelivr and UNPKG CDNs.

<!-- Using bundle from JSDelivr -->
<script src="https://cdn.jsdelivr.net/npm/@unio/union"></script>

<!-- Or using bundle from UNPKG -->
<script src="https://unpkg.com/@unio/union"></script>

<script>
  /**
   * The bundle exposes @unio/union through `Union` object.
   */
  
  console.log(Union.app);
  // => Same app object from installation though npm.

  console.log(Union.plugin);
  // => Same plugin object from installation though npm.
</script>

Usage

@unio/union provides two kinds of resources:

  1. Consume plugins from an app
  2. Provide a plugin for an app

Consume plugins from an app

import { start, seek } from "@unio/union/app";

/**
 * You can use start to load many plugins inside your application.
 * Start function will resolve after plugins are loaded and then you can use seek to retrieve the elements.
 */
start({ plugins: ["https://some-plugin-url-here"] }).then(async () => {
  /**
   * After started, you can use seek to retrieve the elements from all plugins by some grouping key.
   */
  const currentPageKey = "login-page";
  const customElements = await seek(currentPageKey);
  // => [{ type: ElementType.Button, text: "Login with Google", href: "https://google.com" }]
});

Provide a plugin for an app

import { setup } from "@unio/union/plugin";
import { ElementType } from "@unio/union/enums";

/**
 * You can provide custom elements to be used inside another applications as well.
 * First you have to setup your plugin and wait until it resolves a gateway.
 */
setup().then(async (gateway) => {
  /**
   * Gateway is a gate to the application, providing methods to add elements by grouping keys.
   */
  const pageKey = "login-page";
  const elements = [{ type: ElementType.Button, text: "Login with Google", href: "https://google.com" }];
  
  gateway.addElements(pageKey, elements);
});

License

Released under MIT license.

Contact Us 📞

Azure Devops

E-mail

⬆ Back to Top