- Use callbacks instead of await
This commit is contained in:
@@ -187,11 +187,10 @@ if JS then
|
|||||||
love.system.setClipboardText = function (str)
|
love.system.setClipboardText = function (str)
|
||||||
JS.callJS(JS.stringFunc(
|
JS.callJS(JS.stringFunc(
|
||||||
[[
|
[[
|
||||||
try {
|
window.navigator.clipboard
|
||||||
await window.navigator.clipboard.writeText(%s);
|
.writeText('')
|
||||||
} catch (e) {
|
.then(() => console.log('Copied to clipboard'))
|
||||||
console.warn(e);
|
.catch((e) => console.warn(e));
|
||||||
}
|
|
||||||
]],
|
]],
|
||||||
str
|
str
|
||||||
))
|
))
|
||||||
@@ -201,12 +200,13 @@ if JS then
|
|||||||
local res=""
|
local res=""
|
||||||
JS.newPromiseRequest(JS.stringFunc(
|
JS.newPromiseRequest(JS.stringFunc(
|
||||||
[[
|
[[
|
||||||
try {
|
window.navigator.clipboard
|
||||||
_$_(await window.navigator.clipboard.readText());
|
.readText()
|
||||||
} catch (e) {
|
.then(async (text) => _$_(text))
|
||||||
console.warn(e);
|
.catch((e) => {
|
||||||
_$_("");
|
console.warn(e);
|
||||||
}
|
_$_('');
|
||||||
|
});
|
||||||
]]
|
]]
|
||||||
), function(data) res=data end)
|
), function(data) res=data end)
|
||||||
return res
|
return res
|
||||||
|
|||||||
Reference in New Issue
Block a user