mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-12-24 19:49:35 +08:00
feat: 添加clipboard-event不同平台源代码
This commit is contained in:
24
public/node_modules/clipboard-event/platform/clipboard-event-handler-mac.swift
generated
vendored
Normal file
24
public/node_modules/clipboard-event/platform/clipboard-event-handler-mac.swift
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// main.swift
|
||||
// clipboard-event
|
||||
//
|
||||
// Created by Joonhee Lee on 2021/01/30.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
let pasteboard: NSPasteboard = NSPasteboard.general
|
||||
var count: Int = pasteboard.changeCount
|
||||
var saved: String = pasteboard.string(forType: .string) ?? "null"
|
||||
|
||||
repeat{
|
||||
usleep(500000)
|
||||
if(count < pasteboard.changeCount && saved != pasteboard.string(forType: .string)){
|
||||
usleep(100000)
|
||||
count = pasteboard.changeCount
|
||||
saved = pasteboard.string(forType: .string) ?? "null"
|
||||
print("CLIPBOARD_CHANGE")
|
||||
fflush(stdout)
|
||||
}
|
||||
}while true
|
||||
Reference in New Issue
Block a user