summaryrefslogtreecommitdiff
path: root/deno_typescript/amd_runtime.js
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2019-09-10 14:54:32 +1000
committerRyan Dahl <ry@tinyclouds.org>2019-09-10 00:54:32 -0400
commit377966764636350c524b526da50c055243ab3005 (patch)
treeb77998fe56e5f41f210d29c99ce1b177163e8f1f /deno_typescript/amd_runtime.js
parent46cbc6e0e96750cd2e3ba7e0d80bb9c48b66caf2 (diff)
Add JSDoc to deno_typescript (#2890)
Diffstat (limited to 'deno_typescript/amd_runtime.js')
-rw-r--r--deno_typescript/amd_runtime.js30
1 files changed, 22 insertions, 8 deletions
diff --git a/deno_typescript/amd_runtime.js b/deno_typescript/amd_runtime.js
index fda850c5c..dac8b46fb 100644
--- a/deno_typescript/amd_runtime.js
+++ b/deno_typescript/amd_runtime.js
@@ -1,20 +1,34 @@
+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+
// A very very basic AMD preamble to support the output of TypeScript outFile
// bundles.
-let require, define;
+
+/**
+ * @type {(name: string) => any}
+ */
+let require;
+
+/**
+ * @type {(name: string, deps: ReadonlyArray<string>, factory: (...deps: any[]) => void) => void}
+ */
+let define;
(function() {
+ /**
+ * @type {Map<string, { name: string, exports: any }>}
+ */
const modules = new Map();
- function println(first, ...s) {
- Deno.core.print(first + " " + s.map(JSON.stringify).join(" ") + "\n");
- }
-
+ /**
+ * @param {string} name
+ */
function createOrLoadModule(name) {
- if (!modules.has(name)) {
- const m = { name, exports: {} };
+ let m = modules.get(name);
+ if (!m) {
+ m = { name, exports: {} };
modules.set(name, m);
}
- return modules.get(name);
+ return m;
}
require = name => {