-
-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split WebAPI (environment) built-in objects from the ES builtin objects. #718
Comments
I understand that things like console shouldn’t be in the engine, but it is used for debugging purposes and is making lives easier right now. This will most likely be a low priority issue as I think Console is the only object that is external from the spec, and we benefit more from having it right now than we do by getting rid of it. |
OK, but I would at least think of separating the Console from the "/boa" JS engine folder, and would inject it somehow into the environment (for example from the "boa_cli" or something)? Doing this would also as a prerequisite require an API for putting external builtin objects into the execution context (or whatever is the proper terminology). |
Proposed changes:
impl ContextBuilder {
#[cfg(feature = "console")]
pub fn console<T>(&mut self, value: T) -> &mut Self
where
T: Into<Console>,
{
}
fn build() -> &mut Self {
// ...
}
} so we can do something like this: let mut context = Context::builder()
.console(MyConsole) // MyConsole implements Console as described in #551
.build();
// ... later on we will be able to extend the |
The way I see it, JavaScript has no notion of Note that the hook itself is needed for full Once we have that, we can move the console implementation to its own crate, something like |
If we go with "the inject on context creation" route, perhaps the following can be used. The current flow goes like this: boa_cli/src/main.rs
which calls Through this path I would pass a parameter which would contain the list of external Or use some other injection strategy through this path. |
Split WebAPI (environment) objects from the ES builtin objects.
Perhaps delegate the implementation of environment objects to some other library.
The text was updated successfully, but these errors were encountered: