Client-Side API
ohyay provides a powerful Javascript API for making realtime modifications to Users, Elements, and Rooms in realtime. To get started, add a Website/iframe element, turn on Allow API Access and set an Asset URL. When you edit the Asset URL, you can use the 'Create Script Asset' button at the bottom to create a starter script:
![Screen Shot 2022-05-20 at 3.53.31 PM.png 215](https://files.readme.io/e322565-Screen_Shot_2022-05-20_at_3.53.31_PM.png)
This will create a boilerplate file and launch a code editor for your script:
![Screen Shot 2022-05-20 at 3.55.30 PM.png 802](https://files.readme.io/c046c35-Screen_Shot_2022-05-20_at_3.55.30_PM.png)
To make sure the script is running properly, you should open your browsers Dev Tools and make sure the following console logs appear:
![Screen Shot 2022-05-20 at 3.56.34 PM.png 374](https://files.readme.io/c801f35-Screen_Shot_2022-05-20_at_3.56.34_PM.png)
The first entry can be expanded to see a list of available API's. For more API's, you can download a Typescript definitions file from https://ohyay.co/ohyay.d.ts.
For easy access to editing your script, you can use the Edit Script Asset action:
![Screen Shot 2022-05-20 at 3.58.22 PM.png 178](https://files.readme.io/ecb6dd7-Screen_Shot_2022-05-20_at_3.58.22_PM.png)
And if you need to force reload your script, you can use the Reload actions:
![Screen Shot 2022-05-20 at 3.59.12 PM.png 195](https://files.readme.io/28b8fb5-Screen_Shot_2022-05-20_at_3.59.12_PM.png)
For questions, please use the #api_support channel on Discord.
Updated over 2 years ago