TryAPL: Difference between revisions

Jump to navigation Jump to search
149 bytes added ,  15:45, 27 December 2021
Line 50: Line 50:
If the output begins with a backspace character (U+08) then the actual output only begins after the second backspace character, and the text between the two backspace characters describes the role of the text. As 27 Jun 2021, only one tag has been implemented, <source lang=js inline>"\bhelp\b"</source> for which the text is the URL of help page requested by <source lang=apl inline>]Help</source>
If the output begins with a backspace character (U+08) then the actual output only begins after the second backspace character, and the text between the two backspace characters describes the role of the text. As 27 Jun 2021, only one tag has been implemented, <source lang=js inline>"\bhelp\b"</source> for which the text is the URL of help page requested by <source lang=apl inline>]Help</source>


A minimal (no-state) TryAPL front-end can be implemented as follows:
==== XMLHttpRequest ====
A minimal (no-state) TryAPL front-end can be implemented as follows using the [[wikipedia:XMLHttpRequest|XMLHttpRequest]] API:
<source lang=js>
<source lang=js>
with(new XMLHttpRequest) {
with(new XMLHttpRequest) {
Line 59: Line 60:
}
}
</source>
</source>
 
==== Fetch ====
This is a function that uses Fetch API to send a request given as input a string code.
This is a function that uses the [[wikipedia:XMLHttpRequest#Fetch_alternative|Fetch]] API to send a request given as input a string code:
<source lang=js>
<source lang=js>
async function evaluateAPL(code) {
async function evaluateAPL(code) {

Navigation menu