- Wait until data is available

This commit is contained in:
ParticleG
2024-10-31 16:23:07 +08:00
parent 881d43c56d
commit 9ec2182252

View File

@@ -93,7 +93,10 @@ SFX= require'Zframework.sfx'
IMG= require'Zframework.image'
BGM= require'Zframework.bgm'
VOC= require'Zframework.voice'
JS= SYSTEM == 'Web' and require'Zframework.js' or NULL
if SYSTEM=='Web' then
JS=require'Zframework.js'
end
local ms,kb=love.mouse,love.keyboard
local KBisDown=kb.isDown
@@ -197,7 +200,7 @@ if JS then
end
love.system.getClipboardText = function ()
local res=""
local res
JS.newPromiseRequest(JS.stringFunc(
[[
window.navigator.clipboard
@@ -209,6 +212,7 @@ if JS then
});
]]
), function(data) print("In callback: " .. data); res=data end)
repeat love.timer.sleep(0.01) until res
print("In lua: " .. res)
return res
end
@@ -742,10 +746,6 @@ function love.run()
local dt=time-lastFrame
lastFrame=time
if JS and JS.retrieveData(dt) then
return
end
-- EVENT
PUMP()
for N,a,b,c,d,e in POLL() do