Skip to content

Commit

Permalink
- Wait until data is available
Browse files Browse the repository at this point in the history
  • Loading branch information
ParticleG committed Oct 31, 2024
1 parent 881d43c commit 9ec2182
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Zframework/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -197,7 +200,7 @@ if JS then
end

love.system.getClipboardText = function ()
local res=""
local res
JS.newPromiseRequest(JS.stringFunc(
[[
window.navigator.clipboard
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9ec2182

Please sign in to comment.