deno_core Extension with Global Access
Is there a way to make a Deno Extension be accessed by
Extension.op()
instead of Deno.core.ops.op()
?38 Replies
Does this work?
Of course that does work, but that'd require asking everyone to add that, I'm looking for a way to make it so whenever
deno_core::JsRuntime::execute_script
is run, it'll just work.currently it's not possible OOTB, you need to handle it yourself
So how do extensions like
console
and fetch
have their stuff globally?
I'm willing to add a JS file to the extension.the global scope is assembled in a file called
99_main.js
that is executed after all extensions have been loaded and added their relevant stuff to different window.__bootstrap
namespacesSo is there no way to implement a similar functionality as that into my own project without forking?
you certainly can, which crates do you use? do you use
deno_runtime
crate?Yes, runtime.
if you use
deno_runtime
it will be harder right now - @crowlkats and I are working on a PR that will make it much easier (https://github.com/denoland/deno/pull/16597) that will allows to extend global scope as you see fitall in all you should still be able to assign whatever you want to
globalThis
after all JS code from crates executesWhat's the goal for that pr? (If any)
to allow creating V8 snapshots from existing V8 snapshots
so you can extend what's already in
deno_runtime
and change it as you see fit
mainly useful for a windowing project Leo is working onAround how long should I expect to wait for that
a week probably
So next patch?
Alright. I appreciate all of this work. Thanks for the knowledge.