-
This commit is contained in:
@@ -5,6 +5,7 @@ local trigCHN=love.thread.getChannel('CLIP_trig')
|
|||||||
JS=require'Zframework.js'
|
JS=require'Zframework.js'
|
||||||
love.timer=require'love.timer'
|
love.timer=require'love.timer'
|
||||||
|
|
||||||
|
local retrieving=false
|
||||||
while true do
|
while true do
|
||||||
if trigCHN:getCount()>0 then
|
if trigCHN:getCount()>0 then
|
||||||
trigCHN:pop()
|
trigCHN:pop()
|
||||||
@@ -22,22 +23,26 @@ while true do
|
|||||||
))
|
))
|
||||||
end
|
end
|
||||||
-- Get Clipboard
|
-- Get Clipboard
|
||||||
JS.newPromiseRequest(
|
if not retrieving then
|
||||||
JS.stringFunc[[
|
JS.newPromiseRequest(
|
||||||
window.navigator.clipboard
|
JS.stringFunc[[
|
||||||
.readText()
|
window.navigator.clipboard
|
||||||
.then((text) => _$_(text))
|
.readText()
|
||||||
.catch((e)=>{});
|
.then((text) => _$_(text))
|
||||||
]],
|
.catch((e)=>{});
|
||||||
function(data)
|
]],
|
||||||
while getCHN:getCount()>0 do print('getCHN count:', getCHN:getCount()); getCHN:pop() end
|
function(data)
|
||||||
print('Clipboard:', data)
|
while getCHN:getCount()>0 do print('getCHN count:', getCHN:getCount()); getCHN:pop() end
|
||||||
getCHN:push(data)
|
print('Clipboard:', data)
|
||||||
end,
|
getCHN:push(data)
|
||||||
function(id,error) print(id, error) end,
|
retrieving=false
|
||||||
2,
|
end,
|
||||||
'getClipboardText'
|
function(id,error) print(id, error) end,
|
||||||
)
|
2,
|
||||||
|
'getClipboardText'
|
||||||
|
)
|
||||||
|
retrieving=true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
JS.retrieveData(.0626)
|
JS.retrieveData(.0626)
|
||||||
love.timer.sleep(.0626)
|
love.timer.sleep(.0626)
|
||||||
|
|||||||
Reference in New Issue
Block a user