You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/playground/README.md
+27-1Lines changed: 27 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
This is the JS tooling which powers the https://www.typescriptlang.org/play/
4
4
5
5
It is more or less vanilla DOM-oriented JavaScript with as few dependencies as possible. Originally based on the
6
-
work by [Artem Tyurin](https://github.com/agentcooper/typescript-play) but now it's pretty far from that fork.
6
+
work by [Artem Tyurin](https://github.com/agentcooper/typescript-play) but now it's diverged far from that fork.
7
7
8
8
## Architecture
9
9
@@ -17,3 +17,29 @@ The playground library sits above the [TypeScript sandbox](../Sandbox), and prov
17
17
When deciding where to add a feature to the TypeScript playground, consider if it would be useful to anyone showing
18
18
TypeScript in a REPL. If yes, add it to the playground and expose a function for this library to use. For example
19
19
Automatic Type Acquisition is a feature which lives in the sandbox and not the playground.
20
+
21
+
## Link Syntax
22
+
23
+
The Playground supports a set of query inputs from the URL. The hash is used to reflect the code:
24
+
25
+
-`#code/PRA` - A base64 and zipped version of the code which should live in the editor
26
+
-`#src/The%20code` - URLEncoded way to have the code for the editor
27
+
-`#example/generic-functions` - Grab the code from an example with the id generic-functions
28
+
29
+
Or to trigger some action by default:
30
+
31
+
-`#show-examples` - When the app is loaded, show the examples popover
32
+
-`#show-whatisnew` - When the app is loaded, show the examples popover
33
+
34
+
Then queries tend to be about changing the state of the Playground setup from the default:
35
+
36
+
-`?ts=3.9.2` - Sets the TypeScript version, the list of supported versions is in these [two](https://typescript.azureedge.net/indexes/pre-releases.json)[json](https://typescript.azureedge.net/indexes/releases.json) files.
37
+
38
+
There are two special cases for the `ts` option:
39
+
40
+
-`ts=Nightly` where it will switch to most recently the nightly version.
41
+
-`ts=dev` where it uses your local developer's build of TypeScript (docs coming later)
42
+
43
+
-`?flag=value` - Any compiler flag referenced in can be set from a query
44
+
-`?useJavaScript=true` - Tells the Playground to treat the editor's code as a JS file instead of a TS one
45
+
-`?install-plugin=npm-module` - Checks to see if there is an installed playground plugin of that name, and if not offers to install it in a modal.
0 commit comments