https://github.com/doodlewind/minimal-js-runtime
A toy JavaScript runtime based on QuickJS and libuv.
https://github.com/doodlewind/minimal-js-runtime
engine javascript libuv quickjs runtime
Last synced: 3 months ago
JSON representation
A toy JavaScript runtime based on QuickJS and libuv.
- Host: GitHub
- URL: https://github.com/doodlewind/minimal-js-runtime
- Owner: doodlewind
- Created: 2020-01-31T10:05:54.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-08T10:06:02.000Z (over 5 years ago)
- Last Synced: 2024-10-11T22:48:18.789Z (12 months ago)
- Topics: engine, javascript, libuv, quickjs, runtime
- Language: C
- Size: 21.5 KB
- Stars: 67
- Watchers: 4
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minimal JS Runtime
A toy JavaScript runtime based on QuickJS and libuv.## Introduction
This project demonstrates how to build a simplest JavaScript runtime with QuickJS and libuv. Takeaway points include:* Native `fib` function implementation.
* `setTimeout` implementation.
* Support for running microtasks and macrotasks.See my Chinese blog post for technical details:
* [From JavaScript Engine to JavaScript Runtime - 1](https://ewind.us/2020/js-engine-to-js-runtime-1/)
* [From JavaScript Engine to JavaScript Runtime - 2](https://ewind.us/2020/js-engine-to-js-runtime-2/)## Getting Started
Please make sure [CMake](https://cmake.org/), [QuickJS](https://bellard.org/quickjs/) and [libuv](https://libuv.org/) are globally installed.Build the runtime:
``` bash
cd build
cmake .. && make
```Start the runtime:
``` bash
./runtime
```## Misc
To find out how to port the original event loop shipped with QuickJS, checkout commit [fce26e](https://github.com/doodlewind/minimal-js-runtime/commit/fce26ed2641ca9ff5ee3bad7dd1dc76caa679aa8).## License
MIT