Multiple User Script Worlds proposal polish #691
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces 3 clarifications to the Allow multiple user script worlds proposal.
Clarify behavior of omitting
RegisteredUserScript.worldId
Currently the comment on the
RegisteredUserScript.worldId
property states:This phrasing is ambiguous. The "if omitted, …" that begins the last sentence could refer to either the
world
property or theworldId
property. This PR addresses the ambiguity by rewording the start of this sentence to, "ifworldId
is omitted, …"Add type definitions for methods on
RegisteredUserScript
Currently the proposal states
This is inaccurate. The original User Scripts API proposal does not define an interface used by the
configureWorld()
method in the Types section or declare theconfigureWorld()
method in the Methods section. Instead, the definition ofconfigureWorld()
appears in a sub-section of Requirements and uses an object literal to define it's parameter.The methods introduced in the Multiple User Script Worlds proposal user a different declaration pattern than the previous proposal.
In order to more clearly communicate what has and has not changed in the Multiple User Script Worlds proposal, this PR adds type definitions for the methods on the
userScripts
namespace that match the pattern used by this proposal. I also clarifies that the object literal used in the original definition ofconfigureWorld()
is analogous to theWorldProperties
object that is first defined in the Multiple User Script Worlds proposal.Clarify how
userScripts
methods are affectedAfter the diff of "Relevant methods and types", the following paragraph appears in the current text.
While it is accurate to say that the function signature are unchanged in a static language, it's applicable in a dynamic language like JavaScript that rely heavily on duck typing. Generally speaking, I would say that the type signature of a JavaScript function changes if the shape of the object it accepts changes. While the names of the types are the same (except for
configureWorld()
as previously described), a different set of ducks would pass these checks.In order to be more clear about what did and did not change, this PR revises the line to be more explicit about how method signatures are affected by this proposal.