Skip to content
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

add-on javascript context #3554

Merged

Conversation

cwisniew
Copy link
Member

@cwisniew cwisniew commented Aug 18, 2022

Identify the Bug or Feature request

resolves #3551
resolves #3552
resolves #3553

Description of the Change

Adds JavaScript for each add-on, and allows add-ons to run JavaScript files for the add-on 'onFirstInit' and 'onInit' events.
Also adds the macro script command js.listNS to list available JavaScript contexts. This will not list the contexts created for add-ons.

The onInit/onFirstInit + add-on javascript context can be tested with the following add on, adding it should print to the log (there is not really a way to access it yet so the log output is best way)
test-add-on.zip

Possible Drawbacks

None foreseeable.

Documentation Notes

For JavaScript Add-On contexts
https://docs.rptools.info/docs/add-ons/java-script#javascript-context

For running JavaScript on events
https://docs.rptools.info/docs/add-ons/creation/#format-of-the-events-configuration-file

For js.listNS

usage: [r: js.listNS()]

Release Notes

  • Added js.listNS() MTScript command
  • Each Add-On now creates a private JavaScript context
  • The Add-On 'onFirstInit' and 'inInit' events can now run a JavaScript script from the Add-On

This change is Reviewable

@cwisniew cwisniew changed the base branch from develop to feature-maptool-1.13 August 18, 2022 13:52
Copy link
Contributor

@Phergus Phergus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @cwisniew)

@Phergus Phergus merged commit 7ed37ea into RPTools:feature-maptool-1.13 Aug 18, 2022
@cwisniew cwisniew added the feature Adding functionality that adds value label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding functionality that adds value
Projects
Status: Merged
2 participants