selection-event

1.0.0 • Public • Published

selection-event Build Status

value-event handler that transmits input selection state

Install

$ npm install --save selection-event

Usage

var selectionEvent = require('selection-event')
var h = require('virtual-dom/h')
 
var vtree = h('input', {
  type: 'text',
  'ev-event': selectionEvent(handler)
})
// handler({selection: {start, end}})

API

selectionEvent(handler, [data]) -> function

handler

Required
Type: function
Arguments: data

A function called with the selection (and custom) data any time the configured event fires.

{
  selection: {
    start: 1,
    end: 3
  },
  // ...
}
data

Type: object
Default: {}

Additional custom data to extend the default {selection} object.

License

MIT © Ben Drucker

Package Sidebar

Install

npm i selection-event

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker