@@ -37,33 +37,33 @@ document.addEventListener('DOMContentLoaded', () => {
37
37
// Actual editor and transpilation
38
38
let example = `/** @noSelfInFile */
39
39
40
- // Declare exposed API
41
- type Vector = [number, number, number];
42
-
43
- declare interface OnSpellStartEvent {
44
- caster: Unit;
45
- targetLocation: Vector;
46
- }
47
-
48
- declare class Unit {
49
- getLevel(): number;
50
- isEnemy(other: Unit): boolean;
51
- kill(): void;
52
- }
53
-
54
- declare function print(...messages: any[]): void;
55
- declare function FindUnitsInRadius(location: Vector, radius: number): Unit[];
56
-
57
- // Use declared API in code
58
- function onSpellStart(event: OnSpellStartEvent): void {
59
- const units = FindUnitsInRadius(event.targetLocation, 500);
60
- const enemies = units.filter(unit => event.caster.isEnemy(unit));
61
-
62
- for (const unit of enemies) {
63
- print(unit, unit.getLevel());
64
- unit.kill();
65
- }
66
- }`;
40
+ // Declare exposed API
41
+ type Vector = [number, number, number];
42
+
43
+ declare interface OnSpellStartEvent {
44
+ caster: Unit;
45
+ targetLocation: Vector;
46
+ }
47
+
48
+ declare class Unit {
49
+ getLevel(): number;
50
+ isEnemy(other: Unit): boolean;
51
+ kill(): void;
52
+ }
53
+
54
+ declare function print(...messages: any[]): void;
55
+ declare function FindUnitsInRadius(location: Vector, radius: number): Unit[];
56
+
57
+ // Use declared API in code
58
+ function onSpellStart(event: OnSpellStartEvent): void {
59
+ const units = FindUnitsInRadius(event.targetLocation, 500);
60
+ const enemies = units.filter(unit => event.caster.isEnemy(unit));
61
+
62
+ for (const unit of enemies) {
63
+ print(unit, unit.getLevel());
64
+ unit.kill();
65
+ }
66
+ }` ;
67
67
68
68
var queryStringSrcStart = window . location . hash . indexOf ( "#src=" ) ;
69
69
if ( queryStringSrcStart == 0 ) {
0 commit comments