Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Commit

Permalink
don't pollute the global namespace unless absolutely required
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Mathieson committed Feb 11, 2013
1 parent 751b681 commit 992da00
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion source/captionator.header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,17 @@ var cueBackgroundColour = [0,0,0,0.5]; // R,G,B,A
var objectsCreated = false; // We don't want to create objects twice, or instanceof won't work

var captionator = {};
window.captionator = captionator;

// browserify, node, etc.
if (typeof module === 'object' && typeof module.exports === 'object') {
// node-style module
module.exports = captionator;
} else if (typeof define === 'function' && define.amd) {
// amd
define('captionator', function () {
return captionator;
});
} else {
// everything else
window.captionator = captionator;
}

0 comments on commit 992da00

Please sign in to comment.