Back to Top

Hype SymbolCache master

Allows Tumult Hype symbols to be extended in a persistent way

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 Type 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.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 Type 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.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 Type Description
refreshImmediately Boolean

If this is set to true it will fire HypeSymbolInit rather then only deleting the symbol cache.

Returns

Void

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 Type 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.

Returns

Void

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 Type Description
id String

The id your trying to get the symbolinstace from

Returns

Void

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 Type Description
id String

The id your trying to get the symbol instance from

Returns

Void

hypeDocument.refreshSymbolCacheForId(id)

This function refreshes the symbol cache by requesting a fresh copy of the symbol instance APi from the Hype Runtime and firing the custom event HypeSymbolInit afterwards

Parameters

Name Type Description
id String

The id your trying to refresh the symbol instance for

Returns

Void

hypeDocument.refreshSymbolCacheForIdIfNecessary(id)

This function refreshes the symbol cache by requesting a fresh copy of the symbol instance API from the Hype Runtime and firing the custom event HypeSymbolInit afterwards but only if the system cache isn't already set for the id

Parameters

Name Type Description
id String

The id your trying to refresh the symbol instance for

Returns

Void

HypeSymbolCache()

Properties

Name Type Description
version String

Version of the extension

Returns

Void