From 2c468208b640826b1785813677d0edd79aa09d0e Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 4 Jun 2015 12:39:40 -0600 Subject: [PATCH] [added] `createSelectedEvent` for consistent onSelect handling Related to #419 --- src/utils/createSelectedEvent.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/utils/createSelectedEvent.js diff --git a/src/utils/createSelectedEvent.js b/src/utils/createSelectedEvent.js new file mode 100644 index 0000000000..a16add6b94 --- /dev/null +++ b/src/utils/createSelectedEvent.js @@ -0,0 +1,15 @@ +export default function createSelectedEvent(eventKey) { + let selectionPrevented = false; + + return { + eventKey, + + preventSelection() { + selectionPrevented = true; + }, + + isSelectionPrevented() { + return selectionPrevented; + } + }; +}