Skip to content

Clarification around registerJSModule #4346

Answered by hoodmane
WebReflection asked this question in Q&A
Discussion options

You must be logged in to vote

Yes this is the intended behavior. We should update the docs to be more clear about it.

I think the perspective we took was as follows:

  1. It's useful to be able to have submodules but not clear how to decide which things should be treated like submodules vs like attributes
  2. It's convenient to be able to do e.g. from js.document import addEventListener but there's no way to know ahead of time that document should be treated as a submodule
  3. Different stuff is in node vs the various web global scopes vs other runtimes, how would we pick which ones are useful to treat as submodules?
  4. I'm not aware of any downside to allowing this.

So I don't expect we'll ever want to change this. It's a bit weir…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@WebReflection
Comment options

@hoodmane
Comment options

@hoodmane
Comment options

@WebReflection
Comment options

@WebReflection
Comment options

Answer selected by WebReflection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants