A skeleton HTML5 application built for Cortex.
npm install
make dist
The HTML5 application is set up to run in two environments: development and production. You need to rebuild the app to switch to an environment:
make dev # build the app in dev mode.
make build # build the app in prod mode.
The final HTML5 application will be saved under ./build. The app will start in simulation mode. Open ./build/index.html
in your browser (tested on Chrome / Chromium) to run the app. In simulation mode, the app will fire Cortex events
periodically and use the test data stored in ./src/test-data.js. This mode is useful for quickly building the UI.
Similar to the development mode, the final HTML5 application will be saved under ./build. However, you can build a final
zip file as well by running make dist. The application will only work on Cortex player.
./html/: Containsindex.html. You can put the app skeleton in this file or dynamically create the DOM elements in JavaScript../css/: Contains CSS files. You can include the CSS files under this folder byrequireing them in JavaScript. Seesrc/main.jsfor an example../assets/: All files under this directory will get copied to the final HTML5 app directory. You can place images, fonts and any other resources under this directory../src/: Source files.src/main.jsis the entry point. All source files will get compiled into./build/bundle.jsby webpack.
Search for TODOs in the code. Current TODO items for new apps are:
- Change the app name in
package.json. We use the app name in log messages. - Change the
DATASET_IDinsrc/main.jsto the production dataset id. - Update
src/test-data.jswith the test data. Make sure the test data is similar to the production data. - Update the placeholder view in
src/placeholder.js. Current implementation loadsassets/images/placeholder.jpg. You can simply replace this image with your version or updatesrc/placeholder.jsto create custom DOM elements. - Change the
TOKENinsrc/tracker.js. You can obtain a token from Cortex support. - Update
src/view.jsto handle data updates and rendering.- Set the
CAMPAIGNconstant. - Update View.setData() if you need to manipulate the incoming data or preload images.
- Update View._render() to present the data on screen.
- Update View.updateView() if you need to update the screen right before the app gets displayed.
- Use
Tracker.track()to track a view. Ideally, you should call this method inView.render().
- Set the
- Build the app in production mode and deploy.