HelloWorld Experience Provider

“Hello World” Experience Provider

Hello World Experience Provider is a sample skeleton provider that explicitly implements all the functions required. The implementation is contained in the JavaScript file “lib\HelloWorldExperience.js”. To use the Hello World Experience Provider, simply add the script reference to the script file in your HTML page. Refer to Incorporating the Custom Experience Providers into your HTML page.

Note: You can see the code and execute it on our RIN REPL. Try to edit the RIN so that the narrative runs for 30 seconds instead of the 20.

Let’s go through the structure of “HelloWorldExperience.js”. The entire script is encapsulated in the body of an anonymous function that creates and registers the provider under the name “HelloWorldExperienceProvider”:

 

The script sets up the  HelloWorldExperienceProvider object so that it inherits the methods expected by RIN:

 

This is all that is required to register an Experience Provider factory function with RIN. RIN calls this factory function each time it needs to play a narrative that contains an Experience with the named provider. The function is called with two parameters: orchestrator and esData. The orchestrator parameter is a proxy to the RIN core orchestrator and supports a number of methods that Experience Providers typically need to call while rendering the Experience. These methods are documented in here. The esData parameter is the actual Experience data as defined in the RIN data specification.

 

The full code of the HelloWorldExperienceProvider:

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s