load-standalone

1.1.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

3

Version

1.1.0

License

MIT

Unpacked Size

3.65 kB

Total Files

4

Last publish

Collaborators

  • u-rogel