### PlayVlay.onInit(fn) Source: https://playvlay.com/creators Host-to-game event handler. Called once before start, providing context with level, difficultyParams, muted, and seed. ```APIDOC ## PlayVlay.onInit(fn) ### Description Registers a handler for the init event, called once before the game starts. ### Parameters - **fn** (function) - Required - Callback that receives a context object with properties: level, difficultyParams, muted, seed. ### Returns None ``` -------------------------------- ### PlayVlay.ready() Source: https://playvlay.com/creators Required. Tells the host that the game has loaded and registered its handlers, allowing the host to start the game. ```APIDOC ## PlayVlay.ready() ### Description Required. Called after registering all event handlers to signal the host that the game is ready to start. ### Method ready ### Parameters None ### Returns None ``` -------------------------------- ### PlayVlay.onRestart(fn) Source: https://playvlay.com/creators Host-to-game event handler. Called to reset and start the game again. ```APIDOC ## PlayVlay.onRestart(fn) ### Description Registers a handler for the restart event, called to reset and start the game again. ### Parameters - **fn** (function) - Required - Callback to execute on restart. ### Returns None ``` -------------------------------- ### PlayVlay.onStart(fn) Source: https://playvlay.com/creators Host-to-game event handler. Called when the run begins. ```APIDOC ## PlayVlay.onStart(fn) ### Description Registers a handler for the start event, called when the run begins. ### Parameters - **fn** (function) - Required - Callback to execute on start. ### Returns None ``` -------------------------------- ### Minimal PlayVlay Starter Template Source: https://playvlay.com/creators A complete HTML/JS template for a tap-to-score game. It includes basic styling, game logic, and integration with the PlayVlay API for reporting scores and managing game states. ```html My PlayVlay Game
0
Tap anywhere to score
``` -------------------------------- ### PlayVlay.haptic('success') Source: https://playvlay.com/creators Optional. Triggers a haptic feedback effect on the host device. ```APIDOC ## PlayVlay.haptic('success') ### Description Optional. Requests haptic feedback from the host device. ### Parameters - **type** (string) - Required - The type of haptic effect (e.g., 'success'). ### Returns None ``` -------------------------------- ### PlayVlay.onPause(fn) / onResume(fn) Source: https://playvlay.com/creators Host-to-game event handlers. Called to freeze or unfreeze the game. ```APIDOC ## PlayVlay.onPause(fn) / onResume(fn) ### Description Registers handlers for pause and resume events, used to freeze or unfreeze the game. ### Parameters - **fn** (function) - Required - Callback to execute on pause or resume. ### Returns None ``` -------------------------------- ### PlayVlay.onSetMuted(fn) Source: https://playvlay.com/creators Host-to-game event handler. Called to mute or unmute audio. ```APIDOC ## PlayVlay.onSetMuted(fn) ### Description Registers a handler for the setMuted event, called to mute or unmute audio. ### Parameters - **fn** (function) - Required - Callback that receives a boolean `muted`. ### Returns None ``` -------------------------------- ### PlayVlay.track(name, props) Source: https://playvlay.com/creators Optional. Sends an analytics event to the host. ```APIDOC ## PlayVlay.track(name, props) ### Description Optional. Sends an analytics event with a name and properties. ### Parameters - **name** (string) - Required - The event name. - **props** (object) - Required - Additional properties for the event. ### Returns None ``` -------------------------------- ### PlayVlay.reachedLevel(n) Source: https://playvlay.com/creators Optional. Tells the host that the player unlocked a level without ending the run. Advances the user's per-game Rank. ```APIDOC ## PlayVlay.reachedLevel(n) ### Description Optional. Notifies the host that the player reached a new level, advancing the user's rank. ### Parameters - **n** (integer) - Required - The level number that was unlocked. ### Returns None ``` -------------------------------- ### PlayVlay.gameOver(n) Source: https://playvlay.com/creators Required. Called exactly once when the run ends, passing the final score. ```APIDOC ## PlayVlay.gameOver(n) ### Description Required. Signals the end of the game run with the final score. ### Parameters - **n** (integer) - Required - The final score. ### Returns None ``` -------------------------------- ### PlayVlay.reportScore(n) Source: https://playvlay.com/creators Required. Called whenever the score changes. The score must be a plain integer. ```APIDOC ## PlayVlay.reportScore(n) ### Description Required. Reports the current score to the host. Should be called whenever the score changes. ### Parameters - **n** (integer) - Required - The current score value. ### Returns None ``` -------------------------------- ### PlayVlay.reportHighScore(n) Source: https://playvlay.com/creators Optional. Submits a high-score attempt without ending the run. Safe to call repeatedly for endless or continuous games. ```APIDOC ## PlayVlay.reportHighScore(n) ### Description Optional. Submits a high-score attempt without ending the run. The host records it against the user's best and the game continues. ### Parameters - **n** (integer) - Required - The high-score value to report. ### Returns None ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.