From 5e517176b52335e8e6e65d96a2880826e4ae71f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Rivet?= Date: Mon, 27 Jan 2020 11:17:58 -0500 Subject: [PATCH 1/3] - add standard dash interface for location change --- @plotly/dash-component-plugins/src/History.js | 13 +++++++++++++ @plotly/dash-component-plugins/src/index.js | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 @plotly/dash-component-plugins/src/History.js diff --git a/@plotly/dash-component-plugins/src/History.js b/@plotly/dash-component-plugins/src/History.js new file mode 100644 index 0000000000..94fedfc5e7 --- /dev/null +++ b/@plotly/dash-component-plugins/src/History.js @@ -0,0 +1,13 @@ +const ON_CHANGE = '_dashprivate_onhistorychange'; + +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 From b4281f04b2cc889a4d36aebae822ad1cc3e4faf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Rivet?= Date: Mon, 27 Jan 2020 12:10:50 -0500 Subject: [PATCH 2/3] remove`on` in event name --- @plotly/dash-component-plugins/src/History.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@plotly/dash-component-plugins/src/History.js b/@plotly/dash-component-plugins/src/History.js index 94fedfc5e7..7b34bc0e14 100644 --- a/@plotly/dash-component-plugins/src/History.js +++ b/@plotly/dash-component-plugins/src/History.js @@ -1,4 +1,4 @@ -const ON_CHANGE = '_dashprivate_onhistorychange'; +const ON_CHANGE = '_dashprivate_historychange'; export default class History { static dispatchChangeEvent() { From 6afc7d9f8e57ec86bbe285ca522d031ec13617b5 Mon Sep 17 00:00:00 2001 From: Marc-Andre-Rivet Date: Tue, 28 Jan 2020 20:12:03 -0500 Subject: [PATCH 3/3] bump dcp version --- @plotly/dash-component-plugins/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",