Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 390fb3e

Browse filesBrowse files
authored
Merge pull request #1095 from nevkontakte/master
Clarify in which runtimes `js.Module` variable is available.
2 parents ec9572f + baf5037 commit 390fb3e
Copy full SHA for 390fb3e

File tree

Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed

‎js/js.go

Copy file name to clipboardExpand all lines: js/js.go
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ func (err *Error) Stack() string {
9797
// Global gives JavaScript's global object ("window" for browsers and "GLOBAL" for Node.js).
9898
var Global *Object
9999

100-
// Module gives the value of the "module" variable set by Node.js. Hint: Set a module export with 'js.Module.Get("exports").Set("exportName", ...)'.
100+
// Module gives the value of the "module" variable set by Node.js. Hint: Set a
101+
// module export with 'js.Module.Get("exports").Set("exportName", ...)'.
102+
//
103+
// Note that js.Module is only defined in runtimes which support CommonJS
104+
// modules (https://nodejs.org/api/modules.html). NodeJS supports it natively,
105+
// but in browsers it can only be used if GopherJS output is passed through a
106+
// bundler which implements CommonJS (for example, webpack or esbuild).
101107
var Module *Object
102108

103109
// Undefined gives the JavaScript value "undefined".

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.