Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ad4m-connect-common

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ad4m-connect-common

A web component to connect with AD4M

  • 0.0.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

AD4M Connect Web Component

Usage

Install AD4M Connect from npm,

npm install ad4m-connect-common

HTML

You need to include the bundled file as a script,

<script type="module" src="../dist/ad4m-connect.bundled.js"></script>

Then use the custom element,

<body>
  <ad4m-connect
    app='{"name":"kaichaoapp","description":"test app","url":"my-url"}'
    endpoint="ws://localhost:12000/graphql"
    capabilities='[{"with":{"domain":"*","pointers":["*"]},"can":["*"]}]'
  />
</body>

Listen to the custom jwt-received event for generated JWT,

<script>
  window.addEventListener('jwt-received', (e) => {
    console.log("jwt received");
    console.log(e.detail.jwt);
  });
</script>

Example

Vue

  1. Config vite by following the doc Vue and Web Components, adding one line of code tag === "ad4m-connect",
export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => {
            return (
              tag === "ad4m-connect"
            );
          },
        },
      },
    }),
    vueJsx(),
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
});
  1. Import ad4m-connect-common in the app root main.ts or app.ts,
import "ad4m-connect-common";
  1. Use the custom tag ad4m-connect wherever you want,
<ad4m-connect
  .app='{"name":"testapp","description":"test app","url":"my-url"}'
  endpoint="ws://localhost:12000/graphql"
  .capabilities='[{"with":{"domain":"*","pointers":["*"]},"can":["*"]}]'
/>

FAQs

Package last updated on 22 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc