load-standalone
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Load-Standalone

Loading standalone web applications / components to the dom on demand. Load React, Vue, Angular or any other modern framework application to the DOM.

Install

yarn add load-standalone

or:

npm install load-standalone

Usage

The standard load function needs to be tweaked a bit. Instead of letting the application to load when it's bundle is first executed, it will await a certain id to show up on the DOM.

React-Example

import loadStandalone from 'load-standalone'

import App from 'App'

loadStandalone({
  injectTarget: 'on-demand-app',
  appLoader: () => {
    ReactDOM.render(
      <React.StrictMode>
        <App />
      </React.StrictMode>,
      document.getElementById('on-demand-app'),
    )
  },
})

Vue-Example

import loadStandalone from 'load-standalone'
import Vue from 'vue'

import App from 'App'

loadStandalone({
  injectTarget: 'on-demand-app',
  appLoader: () => {
    new Vue({
      render: h => h(
        App,
      ),
    }).$mount('#on-demand-app')
  }
})

Readme

Keywords

none

Package Sidebar

Install

npm i load-standalone

Weekly Downloads

1

Version

1.2.0

License

MIT

Unpacked Size

3.86 kB

Total Files

5

Last publish

Collaborators

  • u-rogel