diff --git a/@plotly/dash-component-plugins/package.json b/@plotly/dash-component-plugins/package.json index f7324754c4..0d51938be5 100644 --- a/@plotly/dash-component-plugins/package.json +++ b/@plotly/dash-component-plugins/package.json @@ -1,6 +1,6 @@ { "name": "@plotly/dash-component-plugins", - "version": "1.0.2", + "version": "1.1.0", "description": "Plugins for Dash Components", "repository": { "type": "git", diff --git a/@plotly/dash-component-plugins/src/History.js b/@plotly/dash-component-plugins/src/History.js new file mode 100644 index 0000000000..7b34bc0e14 --- /dev/null +++ b/@plotly/dash-component-plugins/src/History.js @@ -0,0 +1,13 @@ +const ON_CHANGE = '_dashprivate_historychange'; + +export default class History { + static dispatchChangeEvent() { + window.dispatchEvent(new CustomEvent(ON_CHANGE)); + } + + static onChange(listener) { + window.addEventListener(ON_CHANGE, listener); + + return () => window.removeEventListener(ON_CHANGE, listener); + } +} \ No newline at end of file diff --git a/@plotly/dash-component-plugins/src/index.js b/@plotly/dash-component-plugins/src/index.js index 4a670ca381..4cff6b60a1 100644 --- a/@plotly/dash-component-plugins/src/index.js +++ b/@plotly/dash-component-plugins/src/index.js @@ -1,3 +1,5 @@ import { asyncDecorator, isReady } from './dynamicImport'; +import History from './History'; -export { asyncDecorator, isReady }; \ No newline at end of file +export { asyncDecorator, isReady }; +export { History }; \ No newline at end of file