1.0.3 • Published 9 years ago

electron-clipboardmanager v1.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

electron-clipboardmanager

This is a simply utility for electron apps to monitor the clipboard and handle clipboard data.

example

import ClipboardManager from 'electron-clipboardmanager'
const clipboardManager = new ClipboardManager({
  interval: 100 //will check the clipboard for changes every 100 milliseconds
})

clipboardManager
  .subscribe((data) => console.log(data)) //whenever the clipboard changes, listener will be called
clipboardManager
  .start() //start monitoring the clipboard

API

clipboardManager.subscribe(callback)

Subscribe to changes to the clipboard. Callback will receive a ClipBoardData Object:

//defaults:
{
  formats: [] //array of formats the data fits (['text/html','text/plain','text/rtf','image/png'])
  
  //data:
  HTML: null,
  text: null,
  RTF: null,
  image: null,

  time: new Date().getTime()
}

clipboardManager.pause()

Stops notifying subscribers

clipboardManager.resume()

Resumes notifying subscribers

clipboardManager.write(data, type)

Writes provided ClipBoardData to the clipboard. If a type is provided, it will write it as that type, else it will analyse the formats property of the data and chose an appropriate type.

clipboardManager.start()

start monitoring the clipboard

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago