question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The @JavaScript annotation should explain that it's included in a module scope

See original GitHub issue

In general, the following forum topic poses an interesting question:

https://vaadin.com/forum/thread/18116726/javascript-function-defined-in-jsfile-used-by-javascript-annotation-is-n

The question is: why does not @JavaScript() annotation run given javascript file in a global scope, but in a module scope? I think it’s really important to document this straight in the @JavaScript annotation javadoc, since Java developers are usually not JavaScript developers.

- Vaadin / Flow version: 14.1.27

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
mvysnycommented, Nov 5, 2020
1reaction
Legiothcommented, May 13, 2020

What would be needed (as a separate ticket) is a way of explicitly choosing whether a local script file should be included in the bundle or loaded as a standalone <script> (i.e. no module scoping, no strict mode). The current approach that chooses based on the structure of the string defined for the annotation is very confusing, and even making workarounds difficult because of https://github.com/vaadin/flow/issues/8290.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The @JavaScript annotation should explain that it's included in a ...
The @JavaScript annotation should explain that it's included in a module scope.
Read more >
Javascript Function defined in JsFile used by @JavaScript
Hi,. i have this js file in frontend/js/test.js function testFunction() { console.log("Here i am"); }. My view is doing at class level a...
Read more >
Why wouldn't you use explicit annotations when defining ...
I am new to AngularJS and learning about the two styles of writing controller functions. It seems as though the only reason someone...
Read more >
Scope hoisting - Parcel
In production builds, Parcel concatenates modules into a single scope. This is called "scope hoisting". Parcel also statically analyzes the imports and ...
Read more >
Documentation - Modules - TypeScript
The compiler detects whether each module is used in the emitted JavaScript. If a module identifier is only ever used as part of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found