Skip to content

SDK Structure

Initialization

As soon as display SDK is loaded, global $cf object is created.

This global object holds all methods and attributes required to communicate with display editor and load data.

Event lifecycle

Display SDK follows lifecycle below.

config

As soon as page is loaded, $cf object emits a config event to inform display about current configuration state.

After emitting config event, SDK starts loading available data from contentfry API.

broadcasts

When the first data is received from contentfry, $cf emits broadcasts event and delivers available posts.

Continue reading events

Decorator

After receiving data, display can start rendering views with broadcasts data.

While rendering views, displays should follow users options.

User option settings define which attributes to show or hide in the display or how data should be formatted.

On this state, decorator functions are available for displays to check if they should show given data and if so delivers in modified formats.

Decorator methods are responsible for providing UI support, such as icons and translations. Decorator

Styles

While rendering views developers can add scss the way they prefer or import other libraries.

contentfry Display SDK adds classes for available features on the root element (<html> for websites) and delivers css variables. Explained in Styles.

Action Methods

When user interacts with display, possible action methods are available for interaction. Those could be clicking an image, link, description or share icon. Explaind in Methods.