Examples on how to use the tacitact
library in different environments.
Before you install the different examples as documented in the subsequent paragraphs, you have to provide the tacitact
dependency. This is necessary because tacitact
lives in a private GitHub repository that can not be installed with npm directly. Instead npm installs it as a file dependency, which means that you have to clone and build the repository yourself before npm can install it.
Clone the tacitact
repo into the same directory where this tacitact-examples
repo is located:
common_root
├─ tacitact
└─ tacitact-examples
After that, you can cd
into the tacitact
directory and run
$ npm install
$ npm run build
to build tacitact
. For more options for building the library, see its readme file.
cd
back into the tacitact-examples
directory and you're ready to install the examples as documented in the folowing paragraphs.
config.json
configures the wiring between client and server. It works as it is but you can change values if you want to use different ports.
See source code in server-mjs.
Inside the directory you need to install the dependencies and then start the server:
$ cd server-mjs
$ npm install
$ npm run serve
See source code in server-cjs.
Inside the directory you need to install the dependencies and then start the server:
$ cd server-cjs
$ npm install
$ npm run serve
See source code in client-web.
Start one of the server examples (it will work with both). The server will serve the client JS files as well as the index.html
page, which you can open in your web browser via:
http://localhost:<port>
(where <port>
is the port that was logged to the console when starting the server)
You will see how the time is being synced. For more detailed output open the developer console by pressing F12.