Skip to content

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

@humitos

Description

@humitos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions