From b19a83ac23f15bae8aef97606f69e975229506d5 Mon Sep 17 00:00:00 2001 From: ParticleG Date: Thu, 31 Oct 2024 20:52:09 +0800 Subject: [PATCH] - Update sources --- Zframework/init.lua | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index 6d3a2f5a..c60a7b9d 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -201,21 +201,21 @@ if JS then love.system.getClipboardText = function () local res - JS.newPromiseRequest(JS.stringFunc( - [[ - window.navigator.clipboard - .readText() - .then((text) => {console.log('In Javascript: ' + text); _$_(text);}) - .catch((e) => { - console.warn(e); - _$_(''); - }); - ]] - ), function(data) print("In callback: " .. data); res=data end) - repeat - love.timer.sleep(1) - JS.retrieveData(1) - until res + JS.newPromiseRequest( + JS.stringFunc( + [[ + window.navigator.clipboard + .readText() + .then((text) => _$_(text)) + .catch((e) => { + console.warn(e); + _$_(''); + }); + ]] + ), + function(data) res=data end, + function(id, error) print(id, error) res="" end + ) return res end end @@ -766,6 +766,7 @@ function love.run() -- UPDATE STEP() + if JS then JS.retrieveData(dt) end if mouseShow then mouse_update(dt) end if next(jsState) then gp_update(jsState[1],dt) end VOC.update()