Back to Top

Hype DataMagic master

Allows you to easily add and handle data in your Hype documents (with live preview)

setData(data, source)

This function allows to set data

Parameters

Name Type Description
data Object

This parameter needs to be an object but it can hold nested values of any type. To use JSON data parse the data before you set it.

source String

The source is a optional name to store the data. It defaults to the string "shared".

Returns

Void

getData(source)

This function allows to get data

Parameters

Name Type Description
source String

Th is the name of the data you want to access. It defaults to the string "shared".

Returns

Returns the object Hype Data Magic currently has stored under the given source name.

hypeDocument.refresh(element)

This function allows to refresh the data in the current scene

Parameters

Name Type Description
element HTMLDivElement

The element (including descendants) to refresh. This defaults to the scene element.

Returns

Void

hypeDocument.refreshDescendants(element)

This function allows to refresh the data of all descendant of a given element

Parameters

Name Type Description
element HTMLDivElement

The element to start the descendants refresh. This defaults to the scene element.

Returns

Void

hypeDocument.refreshElement(element)

This function allows to refresh a specific element

Parameters

Name Type Description
element HTMLDivElement

The element to refresh.

Returns

Void

hypeDocument.disableChangeObserver()

This function allows to disable observer based refresh calls when updating a data-magic-* attribute

Returns

Void

hypeDocument.enableChangeObserver()

This function allows to (re)enable observer based refresh calls when updating a data-magic-* attribute

Returns

Void

hypeDocument.setContentIfNecessary(content)

This function is a simple helper function that checks if the content provided differs from the content found in element.innHTML and only refreshes if needed

Parameters

Name Type Description
content HTMLDivElement

The content to set in innerHTML if it differs

Returns

Void