Skip to content

A client for communicating with hot module replacement (HMR)

License

Notifications You must be signed in to change notification settings

clayrisser/hmr-client

Repository files navigation

hmr-client

GitHub stars

A client for communicating with hot module replacement (HMR)

Please ★ this repo if you found it useful ★ ★ ★

Features

  • listen to connected event
  • listen to close event
  • listen to hash event
  • listen to still-ok event
  • listen to content-changed event
  • listen to warnings event
  • listen to errors event
  • listen to ok event

Installation

npm install --save hmr-client

Dependencies

Usage

import HRMClient from 'hmr-client';

const client = new HMRClient({ port: 3000 });
client.onConnected = () => {
  console.log('connected');
};
client.onHash = message => {
  console.log('hash', message.data)
};
client.onStillOk = () => {
  console.log('still-ok');
};
client.onOk = () => {
  console.log('ok');
};
client.onContentChanged = () => {
  console.log('content-changed');
};
client.onWarnings = message => {
  console.log('warnings', message);
};
client.onErrors = message => {
  console.log('errors', message);
};
client.onClose = () => {
  console.log('close');
  console.log(
    'The development server has disconnected.\n' +
      'Refresh the page if necessary.'
  );
};

Support

Submit an issue

Screenshots

Contribute a screenshot

Contributing

Review the guidelines for contributing

License

MIT License

Jam Risser © 2018

Changelog

Review the changelog

Credits

Support on Liberapay

A ridiculous amount of coffee ☕ ☕ ☕ was consumed in the process of building this project.

Add some fuel if you'd like to keep me going!

Liberapay receiving Liberapay patrons

About

A client for communicating with hot module replacement (HMR)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published