[gjs: 1/2] doc: document shebang for ESModules
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/2] doc: document shebang for ESModules
- Date: Sat, 24 Apr 2021 04:32:53 +0000 (UTC)
commit b9c507d1ef01bbf8a1a0b012bb92d8886846bd2b
Author: Sonny Piers <sonny fastmail net>
Date: Fri Apr 23 13:29:34 2021 +0000
doc: document shebang for ESModules
doc/ESModules.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/doc/ESModules.md b/doc/ESModules.md
index 850c2602..6b4b163d 100644
--- a/doc/ESModules.md
+++ b/doc/ESModules.md
@@ -63,6 +63,23 @@ Because `import()` is asynchronous, you will need a mainloop running.
Using the C API in `gjs.h`, ES modules can be loaded from a file or
resource using `gjs_load_module_file()`. <!-- TODO -->
+### Shebang
+
+`example.js`
+
+```js
+#!/usr/bin/env -S gjs -m
+
+import GLib from 'gi://GLib';
+log(GLib);
+```
+
+```sh
+chmod +x example.js
+./example.js
+```
+
+
## `import` Specifiers
### Terminology
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]