PluginContext.Clipboard

Methods

clipboard.readText(type): Promise<String>

  • type String (optional)

clipboard.writeText(text, type)

  • text String
  • type String (optional)

clipboard.readHTML(type): Promise<String>

  • type String (optional)

clipboard.writeHTML(html, type)

  • html String
  • type String (optional)

clipboard.clear(type)

  • type String (optional)

Note
readText, readHTML returns Promise!

See Electron Documentation for clipboard for details

Example

'use strict'

module.exports = (pluginContext) => {
  const clipboard = pluginContext.clipboard;
  
  function startup() { ... }
  function search(query, res) { ... }
  
  function execute(id, payload) {
    clipboard.readText().then((result) => {
      console.log('Text from clipboard: ' + result);
    });
  }
  
  return { startup, search, execute };
};