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

window.pbjs check before loading other modules #36

Merged
merged 1 commit into from
Aug 31, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/prebid.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/** @module pbjs */

// if pbjs already exists in global dodcument scope, use it, if not, create the object
window.pbjs = (window.pbjs || {});
window.pbjs.que = window.pbjs.que || [];
var pbjs = window.pbjs;
var CONSTANTS = require('./constants.json');
var utils = require('./utils.js');
var bidmanager = require('./bidmanager.js');
Expand All @@ -13,14 +16,11 @@ var objectType_object = 'object';
var objectType_string = 'string';
var objectType_number = 'number';

//if pbjs already exists in global dodcument scope, use it, if not, create the object
pbjs = typeof pbjs !== objectType_undefined ? pbjs : {};

var pb_preBidders = [],
pb_placements = [],
pb_bidderMap = {},
pb_targetingMap = {};


/* Public vars */
//default timeout for all bids
Expand All @@ -30,9 +30,6 @@ pbjs.logging = pbjs.logging || false;
//let the world know we are loaded
pbjs.libLoaded = true;

//if pbjs.anq command queue already exists, use it, if not create it
pbjs.que = pbjs.que || [];

//create adUnit array
pbjs.adUnits = pbjs.adUnits || [];

Expand Down Expand Up @@ -668,4 +665,4 @@ pbjs.removeCallback = function(cbId) {
//todo
};

processQue();
processQue();