@@ -106,6 +106,39 @@ declare namespace Scratch {
106106 const ROUND : 2 ;
107107 const SQUARE : 3 ;
108108 }
109+ namespace external {
110+ /**
111+ * Import an ES module, like import().
112+ * May be inlined at build-time.
113+ * @param url Must be absolute and constant.
114+ */
115+ function importModule < T = unknown > ( url : string ) : Promise < T > ;
116+ /**
117+ * Returns the contents of a resource, like fetch(). Response headers may be missing.
118+ * May be inlined at build-time.
119+ * @param url Must be absolute and constant.
120+ */
121+ function fetch ( url : string ) : Promise < Response > ;
122+ /**
123+ * Returns the contents of a resource as a data: URL.
124+ * May be inlined at build-time.
125+ * @param url Must be absolute and constant.
126+ */
127+ function dataURL ( url : string ) : Promise < string > ;
128+ /**
129+ * Returns the contents of a resource as a Blob.
130+ * May be inlined at build-time.
131+ * @param url Must be absolute and constant.
132+ */
133+ function blob ( url : string ) : Promise < Blob > ;
134+ /**
135+ * Fetch a script and then evaluate it in an IIFE, returning an expression of your choice.
136+ * May be inlined at build-time.
137+ * @param url Must be absolute and constant.
138+ * @param returnExpression JS expression to return, usually a variable name but could be an object instead. Must be constant.
139+ */
140+ function evalAndReturn < T = unknown > ( url : string , returnExpression : string ) : Promise < T > | T ;
141+ }
109142
110143 // Note that the 'B' in the BOOLEAN enums are capitalized in Scratch. It is not a typo in this file.
111144
0 commit comments