toggle-selection

1.0.6 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i toggle-selection

      Weekly Downloads

      4,627,645

      Version

      1.0.6

      License

      MIT

      Last publish

      Collaborators

      • sudodoki