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

Create module registry #6562

Closed
bretg opened this issue Apr 9, 2021 · 2 comments
Closed

Create module registry #6562

bretg opened this issue Apr 9, 2021 · 2 comments

Comments

@bretg
Copy link
Collaborator

bretg commented Apr 9, 2021

Type of issue

enhancement

Description

We have a new scenario where our bid adapter needs to know whether or not our analytics adapter is in use on the page. There have been other scenarios where groups of modules work together or do something differently based on what other modules are present.

#6117 innovated a step in this direction. When you run

gulp build --modules=uid2IdSystem,rubiconAnalyticsAdapter,rubiconBidAdapter,prebidServerBidAdapter,currency

It puts a comment in the resulting prebid.js file:

Updated : 2021-04-09
Modules: userId, uid2IdSystem, rubiconAnalyticsAdapter, rubiconBidAdapter, prebidServerBidAdapter, currency */

The proposal is that we drop the comments and instead create a machine readable format:

GLOBAL.installedModules = [userId, uid2IdSystem, rubiconAnalyticsAdapter, rubiconBidAdapter, prebidServerBidAdapter, currency]

Then modules can stop doing hacky things and just check the array of installedModules.

@smenzer
Copy link
Collaborator

smenzer commented Apr 9, 2021

I love the idea. As long as the machine readable array is also easily readable by a human I'm fine dropping the comments...otherwise I'd like to leave them in as they're incredibly useful for debugging.

@antlauzon
Copy link
Contributor

I like this idea a lot. We might ultimately use this functionality with our id and rtd module at some point in the future. Another nice to have that is somewhat related would be having place for vendor specific library code to go that might be shared between modules. For instance, I imagine a scenario where an analytics adapter would need to potentially duplicate library code present in a bid adapter. If the analytics adapter could check if the bid adapter were present and dynamically load the library code accordingly, that might prove helpful in certain circumstances. I think I maybe have seen something similar to this in a bid adapter, but I can't recall exactly where.

@bretg bretg closed this as completed Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants