clipboard-event
Advanced tools
Comparing version 1.5.0 to 1.6.0
18
index.js
@@ -1,4 +0,6 @@ | ||
const { EventEmitter } = require('events'); | ||
const path = require('path'); | ||
const { execFile } = require('child_process'); | ||
import { EventEmitter } from 'events'; | ||
import path from 'path' | ||
import { execFile } from 'child_process'; | ||
import {fileURLToPath} from 'node:url'; | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
@@ -15,9 +17,9 @@ class ClipboardEventListener extends EventEmitter { | ||
if (platform === 'win32') { | ||
this.child = execFile(path.join(__dirname, 'platform/clipboard-event-handler-win32.exe')); | ||
this.child = execFile(path.join(__dirname,'platform/clipboard-event-handler-win32.exe')); | ||
} | ||
else if (platform === 'linux') { | ||
this.child = execFile(path.join(__dirname, 'platform/clipboard-event-handler-linux')); | ||
this.child = execFile(path.join(__dirname,'platform/clipboard-event-handler-linux')); | ||
} | ||
else if (platform === 'darwin') { | ||
this.child = execFile(path.join(__dirname, 'platform/clipboard-event-handler-mac')); | ||
this.child = execFile(path.join(__dirname,'platform/clipboard-event-handler-mac')); | ||
} | ||
@@ -42,7 +44,7 @@ else { | ||
module.exports = new ClipboardEventListener(); | ||
export default new ClipboardEventListener(); | ||
// Sample usage | ||
/* | ||
const clipboardListener = require('clipboard-event'); | ||
import clipboardListener from 'clipboard-event' | ||
@@ -49,0 +51,0 @@ // To start listening |
{ | ||
"name": "clipboard-event", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Clipboard change event for Node.js/Electron.js/NW.js", | ||
@@ -21,2 +21,7 @@ "main": "index.js", | ||
"license": "MIT", | ||
"exports": { | ||
"import": "./index.js", | ||
"require": "./index.cjs" | ||
}, | ||
"type": "module", | ||
"bugs": { | ||
@@ -23,0 +28,0 @@ "url": "https://github.com/sudhakar3697/node-clipboard-event/issues" |
@@ -11,4 +11,7 @@ # node-clipboard-event | ||
``` | ||
const clipboardListener = require('clipboard-event'); | ||
import clipboardListener from 'clipboard-event' | ||
// In case of CommonJS | ||
// const clipboardListener = require('clipboard-event'); | ||
// To start listening | ||
@@ -15,0 +18,0 @@ clipboardListener.startListening(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
106919
12
92
39
Yes
2