Skip to content

Commit

Permalink
decouples register from init
Browse files Browse the repository at this point in the history
  • Loading branch information
karimMourra committed Dec 9, 2022
1 parent f5fb7b6 commit faeafbb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion libraries/video/shared/parentModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export function SubmoduleBuilder(submoduleDirectory_, sharedUtils_) {
}

const submodule = submoduleFactory(config, sharedUtils);
submodule && submodule.init && submodule.init();
return submodule;
}

Expand Down
6 changes: 6 additions & 0 deletions modules/videoModule/coreVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ export function VideoCore(parentModule_) {
} catch (e) {}
}

function initProvider(divId) {
const submodule = parentModule.getSubmodule(divId);
submodule && submodule.init && submodule.init();
}

/**
* @name VideoCore#getOrtbVideo
* @summary Obtains the oRTB Video params for a player's current video session.
Expand Down Expand Up @@ -208,6 +213,7 @@ export function VideoCore(parentModule_) {

return {
registerProvider,
initProvider,
getOrtbVideo,
getOrtbContent,
setAdTagUrl,
Expand Down
1 change: 1 addition & 0 deletions modules/videoModule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function PbVideo(videoCore_, getConfig_, pbGlobal_, pbEvents_, videoEvent
const divId = provider.divId;
videoCore.registerProvider(provider);
adQueueCoordinator.registerProvider(divId);
videoCore.initProvider(divId);
videoCore.onEvents(videoEvents, (type, payload) => {
pbEvents.emit(getExternalVideoEventName(type), payload);
}, divId);
Expand Down

0 comments on commit faeafbb

Please sign in to comment.