forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Submodule initialization & functions (init; getBidRequestData) skelet…
…ons (#2)
- Loading branch information
Showing
1 changed file
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
// Constants | ||
const MODULE_NAME = '' | ||
import { submodule } from "../src/hook" | ||
// Constants | ||
const REAL_TIME_MODULE = 'realTimeData' | ||
const MODULE_NAME = '1plusX' | ||
|
||
// Functions | ||
const getBidRequestDataAsync = async (reqBidsConfigObj, config, userConsent) => { | ||
// Maybe treat the case where we already have the audiences & segments in local storage | ||
// Get the required config | ||
// Call PAPI | ||
// -- Then : | ||
// ---- extract relevant data | ||
// ---- set the data to the bid | ||
// -- Catch : print err & do nothing | ||
} | ||
|
||
// Functions exported in submodule object | ||
const init = () => { } | ||
const getBidRequestData = () => { } | ||
const init = (config, userConsent) => { | ||
// We prolly get the config again in getBidRequestData | ||
return true; | ||
} | ||
|
||
const getBidRequestData = (reqBidsConfigObj, callback, config, userConsent) => { | ||
getBidRequestDataAsync(reqBidsConfigObj, config, userConsent) | ||
.then(() => callback()) | ||
.catch((err) => { | ||
console.error(err); | ||
callback(); | ||
}) | ||
} | ||
|
||
// The RTD submodule object to be exported | ||
export const onePlusXSubmodule = { | ||
name: MODULE_NAME, | ||
init, | ||
getBidRequestData | ||
} | ||
} | ||
|
||
// Register the onePlusXSubmodule as submodule of realTimeData | ||
submodule(REAL_TIME_MODULE, MODULE_NAME); |