Comments (3)
I see with tjs__bootstrap_globals
I have some options like EventTarget. I'm also wondering if I can do something like window.addEventListener
.
$ ./build/tjs
Welcome to txiki.js — The tiny JavaScript runtime
Type "\h" for help
> window.addEventListener('foo', (event) => console.log(event))
undefined
> window.dispatchEvent(new Event('foo'))
{ isTrusted: false }
true
from txiki.js.
Looks like from C I can pass an event like this:
/* Emit window 'load' event. */
if (!JS_IsException(ret) && is_main) {
static char emit_window_load[] = "window.dispatchEvent(new Event('load'));";
JSValue ret1 = JS_Eval(ctx, emit_window_load, strlen(emit_window_load), "<global>", JS_EVAL_TYPE_GLOBAL);
if (JS_IsException(ret1)) {
tjs_dump_error(ctx);
}
}
Now to find how to call C from JS.
Most likely going to need to compile tjs
executable as a shared library instead too...
from txiki.js.
TBH I never considered this use case so far.
The whole thing is not thread safe, so we'd need to add some new API to make is possible to call stuff from outside the thread running.
from txiki.js.
Related Issues (20)
- Add typescript declaration file ? HOT 2
- Add mbedtls to support https & crypto HOT 12
- fetch() from browser net::ERR_INVALID_HTTP_RESPONSE when testing tjs.listen() HOT 5
- utils.js is not found in build HOT 2
- v23.1.0 has unpredictable segfaults when running invalid JS files HOT 3
- Can not build in MAC HOT 4
- Support Uint32Array, other TypedArray's and ArrayBuffer parameter for stdin.read() (StdioInputStream)) HOT 8
- Add timeout for http imports
- Build problems on macOS 11.2.3 HOT 5
- Could this be used on an e.g. Pico Pi? HOT 2
- support indexedDB implement HOT 7
- [Question] Making JS Files a Built-in module HOT 6
- FFI does not support complex structures
- @types packet for txikijs HOT 3
- osx clang use -O3 parseFloat('Infinity') == 3 HOT 2
- Readline module
- tjs do not show any error message when import failed HOT 2
- .js extension and `run` cmd required HOT 5
- Support the Minimum Common Web Platform API HOT 7
- Failed to build on macOS 14 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from txiki.js.