- 20 Feb 2025
- 1 読む分
- 印刷する
Player Simulator - Basic
- 更新日 20 Feb 2025
- 1 読む分
- 印刷する
This is an introductory guide describes how to use the Player Simulator to test and debug environment for Dise templates. More information and detail can be found in the Player Simulator Advanced guide.
The Player Simulator is a light-weight implementation of the Dise Player API, suitable for running and debugging templates in a stand-alone environment, i.e. outside of the normal CMS/Player system. The dynamic data which would normally come from the CMS needs to be provided in local “mock” files.
Access the Player Simulator directly or use the below steps to set up a developer environment for Dise One templates:
Prerequisites
Install Visual Studio Code - https://code.visualstudio.com/.
Install the ‘Live Server’ extension from the VS Code marketplace.
Install the ‘JavaScript Debugger’ extension from the VS Code marketplace.
Install git - https://git-scm.com/downloads.
Install Node or ensure the latest version is installed - https://nodejs.org/en.
Clone the Dise Repository and Submodules
Open a terminal.
Run
git clone --recursive https://bitbucket.org/diseinc/sampletemplates.git
Navigate to the newly created ‘sampletemplates’ folder using
cd sampletemplates
Install TypeScript:
Open a terminal.
Run
npm install && npm install typescript -g
Run a Sample Project in the Dise Simulator
Select the ‘index.html’ file in the root of the ‘samplestemplates’ folder.
Locate
const template = templates.Samples.<sampleTemplate>
(usually found on line 36).The <sampleTemplate> should be replaced with the sample template to be run in the Dise Simulator.
The name of all available sample templates can be found just above
const template = templates.Samples.<sampleTemplate>
in the ‘index.html’.
Navigate to the sample template folder to be run in the Dise Simulator:
E.g.
cd .\Samples\Info\
Compile the template:
Run
tsc -p . -w
Start the Player Simulator by right-clicking on the ‘index.html’ and selecting ‘Open with Live Server’.