JSPM

hyperdom-zeroclipboard

1.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q21098F
  • License MIT

zeroclipboard for hyperdom

Package Exports

  • hyperdom-zeroclipboard

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hyperdom-zeroclipboard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ZeroClipboard for hyperdom

A hyperdom component for ZeroClipboard.

var hyperdom = require('hyperdom');
var h = hyperdom.html;

function render(model) {
  return h('div',
    h('input', {type: 'text', binding: [model, 'text']}),
    zeroClipboard(model.text, h('button', 'copy'))
  );
}

hyperdom.append(document.body, render, {});

api

var vdom = zeroClipboard([options], data, buttonVdom);
  • options.oncopy - function that is called after the copy has finished.

  • options.onerror - function that is called when an error occurs, usually if flash isn't available. See the error event in ZeroClipboard documentation.

  • data - either a string, a function that returns a string, or an object containing a string or function for each mime-type, e.g.:

    {
      'text/plain': 'some text',
      'text/html': function () { return '<h1>some html</h1>'; }
    }
  • buttonVdom - a vdom element, usually a h('button'), to act as the copy button.

options

zeroClipboard.options({...});

A way to configure ZeroClipboard, just delegates straight to ZeroClipboard.options({...}), see options.

Most often you'll want to do this:

zeroClipboard.options({swfPath: '/path/to/ZeroClipboard.swf'});