Using output Hype 3 in a Cordova/PhoneGap project

While we don't support any modifications, you can export unminified versions if you enter this command into the Terminal:

defaults write com.tumult.Hype2 UseFullHypeJSTemplate -bool YES 

I highly recommend setting it to the default NO for any production output.

There's nothing explicitly wrong in doing this; in fact I believe an advance export option to inline will do the same. do note that this is including the "thin" version; Hype has a smaller file size one ("thin") and one that includes support for IE6-9 and Physics. The loader file determines at runtime which to use; I never recommend using thin in a static context, especially because we may change the feature set of thin vs. full later.

If you have a callback for the right time to run the Hype javascript, then instead I would recommend using head injection for the script tag. This means you would not need to hack the hype javascript or make any changes to the Hype export. You also would not need to include the HYPE-552.thin.min.js manually.

Head injection literally just adds the <script> tag to the head; when this happens the browser will load this.

So the code would look something like:

function CallHype() {
	var headElement = document.getElementsByTagName('head')[0];
	var scriptElement = document.createElement('script');
	scriptElement.type = 'text/javascript';
	scriptElement.src = "test1intro.hyperesources/test1intro_hype_generated_script.js";
	headElement.appendChild(scriptElement);
}

Hype uses this method itself to inject the HYPE-552.thin.min.js :slight_smile:. Does this work for you?

2 Likes