1.0.6 • Published 7 years ago

toggle-selection v1.0.6

Weekly downloads
3,211,038
License
MIT
Repository
github
Last release
7 years ago

Toggle Selection

Simple module exposing function that deselects current browser selection and returns function that restores selection.

var deselect = require('toggle-selection');
var reselect = deselect(); // remove all selection
// … 
// do something with current selection, text, etc;
// …
reselect(); // restore selection

All credits go to @shvaikalesh.

Example

example recording