Skip to content

Commit

Permalink
Check if devtools.subscribe is a function
Browse files Browse the repository at this point in the history
  • Loading branch information
unlocomqx committed Feb 23, 2021
1 parent eaa9989 commit 08f0632
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ function subscribeToDevTools(store, devTools) {
// JUMP_TO_STATE: timeline Slider changed
// ACTION: action sent from Dispatcher
// dispatched action could be either state json or store function
if (typeof devTools.subscribe !== "function") {
console.warn("Svelte Reduxify: could not subscribe to devtools events (devtools.subscribe is not a function)");
return;
}
devTools.subscribe(function (message) {
if (message.type === "DISPATCH" && (message.payload.type === "JUMP_TO_ACTION" || message.payload.type === "JUMP_TO_STATE") && message.state) {
// set send to false to avoid logging dispatched action
Expand Down Expand Up @@ -107,7 +111,8 @@ export function reduxify(store) {
store[prop] = function () {
lastAction = (dispatched ? "dispatched " : "") + prop;
return fn.apply(store, arguments);
};;
};
;
}
}
}
Expand Down

0 comments on commit 08f0632

Please sign in to comment.