Skip to content
This repository was archived by the owner on Apr 11, 2022. It is now read-only.
This repository was archived by the owner on Apr 11, 2022. It is now read-only.

Interface improvements: Reader instead of File and multiple scripts #43

Description

@benmccann

I'm trying to port some code over to JS Engine and have run into trouble in a couple cases

One of the scripts I have is a String, but JS Engine only takes a File. Internally, JS Engine takes this File and turns it into a FileReader. It'd be nice if it just took a Reader to start because then I could pass it a FileReader, StringReader, InputStreamReader, etc. The only thing here that we'd have to account for is taking a File gives us a script name, so we'd also want to add a parameter for an optional script name.

The second thing I've run into is that my code currently executes multiple scripts on the same engine. There's not a really good way to do that with JS Engine because a new engine is created for each script. I could probably just concatenate the scripts, but then it'd be harder to debug any errors because you'd get the line number for the concatenated script instead of the original file name and line number. Of course I'm doing this with the Javax engine. I don't know if there's a way to run multiple scripts in the same Node engine or not...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions