0.1.8 â€ĸ Published 10 months ago

element-selector v0.1.8

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
10 months ago

Simple web element selector

Did you ever think about the ability to make your custom ⌘ ⇧ C (inspect element) in your extension or tool? Yeah, we did too. And, of course, browsers doesn't provide any API to use it. Fortunately, we were looking for the same solution and finally wrote a small library.

The benefits

  • 🛠 Compatible with <script> and import() usage
  • đŸĒļ Zero-dependent library, only native code
  • ☄ī¸ We use HTML5 Canvas to draw the selection, so it's fast
  • 🍩 We use modern JavaScript, yummy
  • đŸ’Ģ It's asynchronous, no callbacks needed

Installation

Use it with NPM

npm i element-selector

Use it with CDN

<script src="//cdn.jsdelivr.net/npm/element-selector@0.1.7/dist/main.js"></script>

How to use

There are only 2 public methods

let elementSelector = new ElementSelector();

/**
 * Toggle element selector interface
 * - use async/await
 * - use then callback
 */
let selectedElement = await elementSelector.togglePrompt();

/**
 * After you don't need it you can
 * destroy canvas and styles objects
 */
elementSelector.destroy();
0.1.8

10 months ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

1.0.0

3 years ago