README
@kirei/hmr-api
Hot Module Replacement API for Kirei Component. This only includes the API and does not offer any automatic instrumentation. Consider using the babel plugin instead (babel-plugin-kirei).
Installation
npm i @kirei/hmr-api
or if you use yarn
yarn add @kirei/hmr-api
API
import * as hmr from '@kirei/hmr-api';
hmr.create( filename, opts )
Solely creates a new component, if component already exists, it will return its constructor.
Returns: Component constructor
Parameters:
filename {string}
- Filename where component was definedopts {ComponentOptions}
- Options to define component with
hmr.update( filename, opts )
Updates element options and all of its instances.
Returns: Component constructor
Parameters:
filename {string}
- Filename where component was definedopts {ComponentOptions}
- Options to update component with
hmr.createOrUpdate( filename, opts )
Stores a component to cache or updates it and all of its active instances
Returns: Component constructor
Parameters:
filename {string}
- Filename where component was definedopts {ComponentOptions}
- Options to update
hmr.has( filename, opts )
Checks if HMR already has component with the same id stored.
Returns: True if instance is already in the cache.
Parameters:
filename {string}
- Filename where component was definedopts {ComponentOptions}
- Component options