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

obvious-import-html

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obvious-import-html

the obvious middleware to load resources from html entry

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

import-html

the middleware to load resources from html

Installation

npm install obvious-import-html

or

yarn add obvious-import-html

Usage

You can specify the html entry when you use the middleware

import { touchBus } from 'obvious-core'
import importHtml from 'obvious-import-html'

const [bus, isHost] = touchBus()

if (isHost) {
  bus.use(importHtml({
    'host-app': 'https://cdn.yours.com/host-app/index.html',
    'react-app': 'https://cdn.yours.com/react-app/index.html',
    'vue-app': 'https://cdn.yours.com/vue-app/index.html'
  }))
}

bus.activateApp('host-app')

Or you can use the loadHtml in the next middleware

import { touchBus } from 'obvious-core'
import importHtml from 'obvious-import-html'

const [bus, isHost] = touchBus()

if (isHost) {
  bus.use(importHtml()).use(async (ctx, next) => {
    const success = await ctx.loadHtml(`https://cdn.yours.com/${ctx.name}/index.html`)
    if (!success) {
      await next()
    }
  })
}

bus.activateApp('host-app')

License

obvious-import-html is MIT Licensed

FAQs

Package last updated on 06 Sep 2021

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