Hype SymbolCache (master) doxdox documentation

Allows Tumult Hype symbols to be extended in a persistent way

# hypeDocument.getSymbolInstanceById(id)

This function overrides the original Hype document API and returns the symbol instance from the cache lookup instead. The original function is still available and aliased as hypeDocument._getSymbolInstanceById.

Parameters

Name Types Description
id String The id your trying to get the symbolinstace from

# hypeDocument.getSymbolInstanceForElement(element)

This helper does a backwards treewalk from the element it is started on and returns the symbolInstance if one is found. This function was originally written by Stephen Decker from Tumult Inc. but has been tweaked to use the Hype Symbol Cache. The cache is also used to return save the search result for child elements of symbols. Hence, a repeated symbol won't be a treewalk but rather a simple lookup.

Parameters

Name Types Description
element HTMLElement The element to start the treewalk on

Returns

Object

Returns the first found symbolInstance while tree walking or null if no symbolInstance is found

# hypeDocument.getSymbolInstancesByName(id)

This function overrides the original Hype document API and returns the symbol instances requested by name from the cache lookup instead. The original function is still available and aliased as hypeDocument._getSymbolInstancesByName.

Parameters

Name Types Description
id String The id your trying to get the symbol instance from

# hypeDocument.notifyEvent(event, element)

This function is an copy of the function found in the Hype Runtime. As that is an IIFE it isn't available and hence we need to redifine it for custom event handling following the official Hype Event schema.

Parameters

Name Types Description
event Object This object contains at least the event type (name of event) and in some cases some additional information (key, value) or nested structures
element HTMLElement This is the element the current tagert of the event or null if the event doesn't require or was called without an target

Returns

Returns the result of the event. Mostly this is an Boolean in case of Hype as it uses the events in an Observer pattern.

# hypeDocument.purgeSymbolCache(refreshImmediately)

This function reset the entire symbol cache and purging the entire symbol cache. This resets the return values for getSymbolInstanceById an getSymbolInstancesByName for all symbol instances.

Parameters

Name Types Description
refreshImmediately Boolean If this is set to true it will fire HypeSymbolInit rather then only deleting the symbol cache.

# hypeDocument.purgeSymbolCacheForId(id, refreshImmediately)

This function reset the symbol cache of an single symbol by purging its symbol instance from the symbol cache. This resets the return values for getSymbolInstanceById an getSymbolInstancesByName for the symbol instance with the given id.

Parameters

Name Types Description
id String This is the id of the symbol cache that should be reseted
refreshImmediately Boolean If this is set to true it will fire HypeSymbolInit rather then only deleting the symbol cache.

# HypeSymbolCache()