Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arjun-g/electron-clipboard-extended
Electron clipboard extended with event handler for Text and Image change
https://github.com/arjun-g/electron-clipboard-extended
electron electron-clipboard-api
Last synced: about 2 months ago
JSON representation
Electron clipboard extended with event handler for Text and Image change
- Host: GitHub
- URL: https://github.com/arjun-g/electron-clipboard-extended
- Owner: arjun-g
- License: mit
- Created: 2017-03-17T23:42:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-03T16:50:53.000Z (almost 5 years ago)
- Last Synced: 2024-11-14T10:55:29.370Z (3 months ago)
- Topics: electron, electron-clipboard-api
- Language: JavaScript
- Size: 14.6 KB
- Stars: 31
- Watchers: 3
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Electron Clipboard Extended
>Electron clipboard extended with event handler for Text and Image change```bash
npm install electron-clipboard-extended
```This library has all methods of electron's clipboard api with added functionalities for listening to changes in clipboard. As of now only Text and Image changes are captured.
## Usage
```javascript
const clipboard = require('electron-clipboard-extended')clipboard
.on('text-changed', () => {
let currentText = clipboard.readText()
})
.once('text-changed', () => {
console.log('TRIGGERED ONLY ONCE')
})
.on('image-changed', () => {
let currentIMage = clipboard.readImage()
})
.startWatching();clipboard.off('text-changed');
clipboard.stopWatching();
```
## Methods
All methods of electron's clipboard api plus the methods listed below
### startWatching()
Returns clipboard - Chainable method, Only after startWatching is called changes to clipboard will be watched.### stopWatching()
Returns clipboard - Chainable method, Changes to clipboard will not be watched after calling this### on(event, listener), once(event, listener)
* `event` String - Can be either `text-changed` or `image-changed`
* `listener` Function - Callback functionReturns clipboard - Chainable method
### off(event[, listener])
* `event` String - Can be either `text-changed` or `image-changed`
* `listener` Function (optional) - If `listener` is not passed all listeners of the event will be removedReturns clipboard - Chainable method