Skip to content

Commit 2ed7779

Browse files
srujzsCommit Queue
authored andcommitted
[dart:js_interop] Improve globalContext documentation
Fixes #60900 "globalContext.name" is confusing because it implies that's the code it's executing rather than getting the property 'name' off of the globalContext getter. Also adds a library annotation with no @js annotation in the example to make it clear there's no library renaming (because otherwise we'd be fetching the rename first off of globalContext). CoreLibraryReviewExempt: Doc-only change. Change-Id: I77cac4b9fd7c29f06c1c579879126031ad6b8dac Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434523 Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Srujan Gaddam <[email protected]>
1 parent 265a970 commit 2ed7779

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sdk/lib/js_interop/js_interop.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,11 +1388,14 @@ extension JSAnyOperatorExtension on JSAny? {
13881388
/// For example:
13891389
///
13901390
/// ```
1391+
/// library;
1392+
///
13911393
/// @JS()
13921394
/// external String get name;
13931395
/// ```
13941396
///
1395-
/// Reading `name` will execute JavaScript code like `globalContext.name`.
1397+
/// Reading the top-level member `name` will execute JavaScript code like
1398+
/// `<globalContext>.name`.
13961399
///
13971400
/// There are subtle differences depending on the compiler, but in general,
13981401
/// [globalContext] can be treated like JavaScript's `globalThis`.

0 commit comments

Comments
 (0)