Skip to content

Instantly share code, notes, and snippets.

local co
local fetch = function(url)
local promise = js.global:fetch(url)
promise["then"](promise, function(_, res)
local jsonPromise = res:json()
jsonPromise["then"](jsonPromise, function(_, json)
co(json)
end)
end)