This is a quick release of a nerdy extension to solve the inconsistent Symbol-API provided by the runtime. Background being that the runtime applies initial values including a fresh copy of the Symbol API multiple times including when HypeSceneLoad, HypePrepareSceneForDisplay and HypeDocumentLoad runs. Meaning the runtime makes it hard on using the Symbol API consistently to store Symbol specific values like possible with hypeDocument
. The symbol API stays constant in a scene but you have to redefine any additions on each “On Scene Load” or HypeSceneLoad. You can’t store a symbol specific counter or anything across scenes in the Symbol API.
This extension caches the Symbol API and always returns the first cached version. This way you can rely on it being stable and cached. Hence, the name. It also gives you a new callback “HypeSymbolInit” fired when a symbol is cached (so only fired once).
Documentation
There is a JSDoc based documentation of the functions at
Code repository on GitHub
Version-History:
1.0 Initial release under MIT-license
1.1 Bugfixes, additional API and immediate refresh
Content Delivery Network (CDN)
Latest version can be linked into your project using the following in the head section of your project:
<script src="https://cdn.jsdelivr.net/gh/worldoptimizer/HypeSymbolCache/HypeSymbolCache.min.js"></script>
Optionally you can also link a SRI version or specific releases.
Read more about that on the JsDelivr (CDN) page for this extension at https://www.jsdelivr.com/package/gh/worldoptimizer/HypeSymbolCache
Learn how to use the latest extension version and how to combine extensions into one file at