jcubic / gaiman

Gaiman: Text based game engine and programming language
https://gaiman.js.org
GNU General Public License v3.0
138 stars 11 forks source link

Broken automated jargon demo #100

Closed jcubic closed 1 month ago

jcubic commented 1 month ago

Recent changes to jQuery Terminal (probably escape of XML formatting) broken automated Jargon example.

https://gaiman.js.org/?gaiman=automated_jargon_file.gs

jcubic commented 1 month ago

This is not an upstream issue, animation of XML formatting works fine:

https://codepen.io/jcubic/pen/MWNePvp?editors=0010

jcubic commented 1 month ago

The problem is a combination of async figlet.preloadFonts and implicit exit.

This is the proper figlet code:

## import JavaScript objects into Gaiman
import figlet from "https://cdn.jsdelivr.net/npm/figlet/lib/figlet.js"
import Array
import Promise

figlet.defaults({
    "fontPath" => "https://unpkg.com/figlet/fonts/"
})

new Promise(lambda(resolve)
  figlet.preloadFonts(Array.from(["Standard"]), resolve)
end)
jcubic commented 1 month ago

The link to this demo is used in an issue for jQuery Terminal

jcubic commented 1 month ago

Created a PR in figlet.js project to make the API promise based:

Turns out that figlet.text() is already promise based, so you can use it without preloading the fonts.