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

Packaging: do not trigger load() when importing it #152

Open
humitos opened this issue Mar 13, 2023 · 0 comments
Open

Packaging: do not trigger load() when importing it #152

humitos opened this issue Mar 13, 2023 · 0 comments
Labels
Bug A bug

Comments

@humitos
Copy link
Member

humitos commented Mar 13, 2023

It seems this logic is failing:

ethical-ad-client/index.js

Lines 683 to 690 in c63d6e0

/* If importing this as a module, do not automatically process DOM and fetch the
* ad placement. Only do this if using the module directly, from a `script`
* element. This will allow for future extension and packaging as a module.
*
* This also replicates JQuery `$(document).ready()`, with added protection for
* usage of `async` -- the DOM ready event can fire before the script is loaded..
*/
if (require.main !== module && check_dependencies()) {

Once the module is imported, it automatically calls load_placements(). I'd like to call it by myself once I added the correct data-ea HTML tag.

@humitos humitos added the Bug A bug label Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug
Projects
None yet
Development

No branches or pull requests

1 participant