Socket
Socket
Sign inDemoInstall

webpack-hot-middleware

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-hot-middleware - npm Package Compare versions

Comparing version 2.11.0 to 2.12.0

8

client.js

@@ -124,2 +124,3 @@ /*eslint-env browser*/

var customHandler;
var subscribeAllHandler;
function processMessage(obj) {

@@ -148,2 +149,6 @@ if (obj.action == "building") {

}
if (subscribeAllHandler) {
subscribeAllHandler(obj);
}
}

@@ -153,2 +158,5 @@

module.exports = {
subscribeAll: function subscribeAll(handler) {
subscribeAllHandler = handler;
},
subscribe: function subscribe(handler) {

@@ -155,0 +163,0 @@ customHandler = handler;

2

package.json
{
"name": "webpack-hot-middleware",
"version": "2.11.0",
"version": "2.12.0",
"description": "Webpack hot reloading you can attach to your own server",

@@ -5,0 +5,0 @@ "keywords": [

@@ -42,2 +42,32 @@ /* eslint-env mocha, browser */

});
it("should call subscribeAll handler on default messages", function() {
var spy = sinon.spy();
client.subscribeAll(spy);
var message = {
action: 'built',
time: 100,
hash: 'deadbeeffeddad',
errors: [],
warnings: [],
modules: []
};
var eventSource = window.EventSource.lastCall.returnValue;
eventSource.onmessage(makeMessage(message));
sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, message);
});
it("should call subscribeAll handler on custom messages", function() {
var spy = sinon.spy();
client.subscribeAll(spy);
var eventSource = window.EventSource.lastCall.returnValue;
eventSource.onmessage(makeMessage({
action: 'thingy'
}));
sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, { action: 'thingy' });
});
it("should call only custom handler on custom messages", function() {

@@ -51,2 +81,5 @@ var spy = sinon.spy();

}));
eventSource.onmessage(makeMessage({
action: 'built'
}));

@@ -53,0 +86,0 @@ sinon.assert.calledOnce(spy);

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