diff --git a/source/captionator.header.js b/source/captionator.header.js index b4e489a..e622183 100644 --- a/source/captionator.header.js +++ b/source/captionator.header.js @@ -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; \ No newline at end of file + +// 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; +}