Skip to content

Add examples #446

Closed
Closed

Description

@Razican

Current situation
We currently have no code examples to use the API externally both in the API documentation and in the nonexistent examples folder.

What do we need?
As mentioned in #445, we should be creating a new API, but in any case, we would need to create examples for some common use cases of Boa. I'm extracting here part of that discussion:

When a user wants to use Boa for their projects, I can imagine the following use cases:

  • They want to interpret JavaScript from a file or a stored String and get the result.
  • They want to interpret JavaScript that is coming from a socket with a Read interface and get the result by streaming the bytes.
  • They want to extend our engine by providing new global functions and objects, so that with the JavaScript they can either perform more rich things in their setup (for example by providing an API for a browser window), or because they want to add JavaScript helpers for common actions in their setup. This also includes things as being the scripting language of a complex platform.
  • They want to change the global object, for example, because they want it to be the window or a frame.

I think we need at least one example of each, that gets tested on each commit, in the examples directory of the boa crate. Then, I would add parts of those examples to the library-level documentation, in order to make life easier for our users.

Activity

  1. added
    A-Enhancement
    Help Wanted
    C-Documentation
    A-API
    Good First Issue
    on Jun 2, 2020
  2. elasmojs commented on Aug 13, 2020

    @elasmojs
    Contributor

    @Razican I can help with this.

  3. Razican commented on Aug 13, 2020

    @Razican
    MemberAuthor

    @Razican I can help with this.

    Go ahead! Thanks :)

  4. added a commit that references this issue on Aug 14, 2020
  5. elasmojs commented on Aug 14, 2020

    @elasmojs
    Contributor

    @Razican the examples are completed except for point 4, i am not sure if I have figured that out. I will raise a pull request now

  6. jasonwilliams commented on Sep 28, 2020

    @jasonwilliams
    Member

    @Razican should this be on hold until we know what the public API will look like?

  7. Razican commented on Sep 28, 2020

    @Razican
    MemberAuthor

    I think so, yes. But the public API is already pretty good, so some examples can be added.

  8. 1 remaining item

  9. added a commit that references this issue on Mar 7, 2021
  10. added a commit that references this issue on Apr 5, 2021
  11. added a commit that references this issue on May 22, 2021
  12. modified the milestones: v0.12.0, v0.13.0 on May 22, 2021
  13. modified the milestones: v0.13.0, v0.14.0 on Sep 25, 2021
  14. added a commit that references this issue on Dec 15, 2021
  15. added a commit that references this issue on Mar 3, 2022
  16. added a commit that references this issue on Mar 8, 2022
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

    A-APIA-EnhancementC-DocumentationGood First IssueHelp Wanted

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions