Hype Document Loader

Had been using this again to take advantage of the built-in preloader. There is so much good stuff in here like the headAdditions and reference preloading for dynamic data (pushing your own resources into the loader que). I am amazed that some of it is not in the GUI … I mean I came up with addToHead for a project, but Hype has it built in. Just it doesn't expose it… really a shame for the wasted potential.

Preload your dynamic data assets:

<script>
	HypeDocumentLoader.setBuild('728');
	function documentDataAddPreloadResource(hypeDocument, element, event){
		event.data.resources[-3]={r: 1, p: 1, n: 'https://images.unsplash.com/photo-1605271470409-107ccaf9012f'};
		return event.data;
	}
	
	if("HYPE_eventListeners" in window === false) { 
		window.HYPE_eventListeners = Array();
	}
	window.HYPE_eventListeners.push({"type":"HypeDocumentData", "callback":documentDataAddPreloadResource});
</script>

I am using negative indices to avoid any collisions… see event.data.resources[-3]. For the resource properties consult: