diff options
author | Sonny Piers <sonny@fastmail.net> | 2021-04-23 13:29:34 +0000 |
---|---|---|
committer | Sonny Piers <sonny@fastmail.net> | 2021-04-23 13:29:34 +0000 |
commit | b9c507d1ef01bbf8a1a0b012bb92d8886846bd2b (patch) | |
tree | c38ac1d8e5641ec4dba106cbd22a852aabb0a0ee /doc | |
parent | 9bfc6a0a4b6bce207e2d87b00b9a92f2d2878f7f (diff) | |
download | gjs-b9c507d1ef01bbf8a1a0b012bb92d8886846bd2b.tar.gz |
doc: document shebang for ESModules
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ESModules.md | 17 |
1 files changed, 17 insertions, 0 deletions
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 |