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

how to export src/common/event-typedefs.js #7

Open
jimdigriz opened this issue Oct 12, 2019 · 2 comments
Open

how to export src/common/event-typedefs.js #7

jimdigriz opened this issue Oct 12, 2019 · 2 comments

Comments

@jimdigriz
Copy link

When using Google Closure compiler with ADVANCED_OPTIMIZATIONS, the @typedef properties in src/common/event-typedefs.js get renamed which means things break.

There looks to be nothing relevant for us VerificationClient users in src/externs and there is no documented advice so it is unclear how this should be handled.

My awful solution is to concatenate constants.js and event-typedefs.js as a make shift externs file but either I am missing something or everyone has to manually do something like this?

Can we have an externs file for VerificationClient users please that preserves the the properties appearing in the events from OMID.registerSessionObserver or alternatively advise on what we all should be doing?

@jimdigriz
Copy link
Author

jimdigriz commented Oct 12, 2019

For reference, this is what I use:

https://github.com/corememltd/Open-Measurement-JSClients/blob/externs/src/externs/omid-events.js

Then my call out to the closure compiler is:

java -jar closure-compiler-v20190929.jar \
  --warning_level=VERBOSE \
  --language_in=ECMASCRIPT6 --language_out=ECMASCRIPT5 \
  --strict_mode_input --dependency_mode=STRICT \
  --entry_point=main.js \
  --externs='Open-Measurement-JSClients/src/externs/omid-events.js' \
  --js='Open-Measurement-JSClients/src/common/**.js' \
  --js='Open-Measurement-JSClients/src/verification-client/**.js' \
  --js=main.js \
  --js_output_file=main.min.js \
  --isolation_mode=IIFE --assume_function_wrapper \
  --create_source_map=main.min.js.map \
  --define NDEBUG=true \
  --compilation_level=ADVANCED_OPTIMIZATIONS

With this things like evt.data.verificationParameters and evt.adSessionId (as well as all the other event properties) are retained correctly.

@jimdigriz
Copy link
Author

Incase anyone else needs this, how I generate this file and the copy I am using can be found at:

https://github.com/corememltd/Open-Measurement-JSClients/commit/b41379221321e23fbe42be298985f6b1613e1df4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant