Skip to content

Commit

Permalink
support phet global in buildStandalone phetsims/utterance-queue#6 phe…
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 20, 2019
1 parent 47fc2be commit 1e13cde
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/grunt/buildStandalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ module.exports = async function( repo, minifyOptions ) {
}

// include globals assignment
fullSource += Object.keys( packageObject.phet.assignGlobals ).sort().map( function( global ) {
// For each key=>value in packageObject.phet.assignGlobals, we want to set window.key = require( 'value' ), to initialize our globals
return `\n window.${global} = require( '${packageObject.phet.assignGlobals[ global ]}' );`;
} ).join( '' );
if ( packageObject.phet.assignGlobals ) {
fullSource += '\n window.phet = window.phet || {};\n';
fullSource += Object.keys( packageObject.phet.assignGlobals ).sort().map( global => {

// For each key=>value in packageObject.phet.assignGlobals, we want to set window.key = require( 'value' ), to initialize our globals
return `\n window.${global} = require( '${packageObject.phet.assignGlobals[ global ]}' );`;
} ).join( '' );
}

if ( packageObject.phet.finalizeJS ) {
fullSource += packageObject.phet.finalizeJS;
Expand Down

0 comments on commit 1e13cde

Please sign in to comment.