### Initial Build with ReScript Source: https://rescript-lang.github.io/experimental-rescript-webapi/01-getting-started This command installs project dependencies and compiles the ReScript bindings. Ensure you have ReScript installed before running this. ```bash npm install rescript build -with-deps ``` -------------------------------- ### Start Rendering in Web Audio API Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/offline-audio-context Starts the rendering of an OfflineAudioContext. This function processes the audio graph and returns a promise that resolves with the resulting AudioBuffer. ```rescript WebAPI.WebAudioAPI.offlineAudioContext->WebAPI.WebAudioAPI.startRendering() ``` -------------------------------- ### WebAudioAPI startRendering Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/offline-audio-context Starts rendering the audio context. Read more on MDN. ```APIDOC ## POST /websites/rescript-lang_github_io_experimental-rescript-webapi/startRendering ### Description Starts the rendering of the offline audio context. ### Method POST ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/startRendering ### Parameters #### Request Body - **context** (WebAPI.WebAudioAPI.offlineAudioContext) - Required - The offline audio context to render. ### Response #### Success Response (200) - **audioBuffer** (WebAPI.WebAudioAPI.audioBuffer) - The rendered AudioBuffer. #### Response Example { "audioBuffer": "" } ``` -------------------------------- ### start OscillatorNode Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/oscillator-node Starts the oscillation of the OscillatorNode at a specified time. If no time is provided, it starts immediately. This method is crucial for initiating sound playback. ```rescript WebAPI.WebAudioAPI.start(oscillatorNode, Js.Nullable.undefined) ``` ```rescript WebAPI.WebAudioAPI.start(oscillatorNode, Js.Nullable.fromOption(startTime)) ``` -------------------------------- ### Start ConstantSourceNode playback in ReScript Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/constant-source-node Starts the playback of a ConstantSourceNode. It can optionally take a time parameter to specify the start time. This function is a binding to the Web Audio API. ```rescript let start: WebAPI.WebAudioAPI.constantSourceNode -> option -> unit; ``` -------------------------------- ### play Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmlaudio-element Loads and starts playback of a media resource. ```APIDOC ## play ### Description Loads and starts playback of a media resource. ### Method POST (Assumed for side-effect operation) ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi ### Parameters ### None ### Response #### Success Response (200) - **playbackStatus** (promise) - A promise that resolves when playback starts. ### Response Example ```json { "playbackStatus": "Playback started" } ``` ``` -------------------------------- ### Attribute and Property Management Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/shadow-root APIs for getting and setting HTML content and managing namespaces. ```APIDOC ## GET getHTML ### Description Retrieves the HTML content of an element. Read more on MDN ### Method GET ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi ### Parameters #### Query Parameters - **shadowRoot** (WebAPI.DOMAPI.shadowRoot) - Required - The element to get HTML from. - **options** (WebAPI.DOMAPI.getHTMLOptions) - Optional - Options for retrieving HTML. ### Response #### Success Response (200) - **html** (string) - The HTML content as a string. #### Response Example ```json { "html": "

Title

Content

" } ``` ``` ```APIDOC ## POST setHTMLUnsafe ### Description Sets the HTML content of an element. This method is unsafe as it bypasses sanitization. Read more on MDN ### Method POST ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi ### Parameters #### Request Body - **shadowRoot** (WebAPI.DOMAPI.shadowRoot) - Required - The element to set HTML for. - **htmlString** (string) - Required - The HTML content to set. ### Response #### Success Response (200) - **unit** - Indicates successful setting of HTML. #### Response Example ```json { "status": "success" } ``` ``` ```APIDOC ## GET lookupNamespaceURI ### Description Returns the namespace URI of the given element or null if no namespace is present. Read more on MDN ### Method GET ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi ### Parameters #### Path Parameters - **prefix** (string) - Required - The prefix for which to find the namespace. #### Query Parameters - **shadowRoot** (WebAPI.DOMAPI.shadowRoot) - Required - The element to query. ### Response #### Success Response (200) - **namespaceURI** (string) - The namespace URI or null. #### Response Example ```json { "namespaceURI": "http://www.w3.org/1999/xhtml" } ``` ``` ```APIDOC ## GET lookupPrefix ### Description Returns the namespace prefix associated with the given namespace URI, or null if no prefix is found. Read more on MDN ### Method GET ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi ### Parameters #### Path Parameters - **namespaceURI** (string) - Required - The namespace URI for which to find the prefix. #### Query Parameters - **shadowRoot** (WebAPI.DOMAPI.shadowRoot) - Required - The element to query. ### Response #### Success Response (200) - **prefix** (string) - The namespace prefix or null. #### Response Example ```json { "prefix": "html" } ``` ``` -------------------------------- ### CanvasRenderingContext2D: beginPath Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/canvas-rendering-context2d Starts a new path on the canvas. This method does not take any parameters. ```rescript let beginPath: (canvasRenderingContext2D) => unit ``` -------------------------------- ### Media Element - play Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmlvideo-element Loads and starts playback of a media resource for video elements. ```APIDOC ## POST play ### Description Loads and starts playback of a media resource. ### Method POST ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi ### Response #### Success Response (200) - **playbackResult** (promise< unit >) - A promise that resolves when playback starts. ``` -------------------------------- ### Update and Push Fork with ReScript Commands Source: https://rescript-lang.github.io/experimental-rescript-webapi/01-getting-started These commands update your local repository with the latest changes from the main repository and push those updates to your remote fork. It's a concise way to manage contributions. ```bash git checkout main git pull upstream main git checkout - git merge main ``` ```bash git checkout main && git pull upstream main && git checkout - git merge main ``` -------------------------------- ### Get start time of a TimeRanges range (ReScript) Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/time-ranges Retrieves the start time of a specified range within a TimeRanges object. It takes an integer index and returns a float representing the time. An 'IndexSizeError' is thrown if the index is out of bounds. ```rescript let startTime = WebAPI.DOMAPI.TimeRanges.start(timeRanges, index) ``` -------------------------------- ### Get Substring from DOM Node Data (ReScript) Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/character-data Extracts a portion of the data from a DOM node as a string. Requires the node, starting offset, and length of the substring. ```rescript WebAPI.DOMAPI.substringData(node, offset, length) ``` -------------------------------- ### Create DynamicsCompressorNode (ReScript) Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/dynamics-compressor-node Creates a new DynamicsCompressorNode. This is the entry point for instantiating the compressor within the Web Audio API. ```rescript /** * Creates a DynamicsCompressorNode. * Note: This is a placeholder, actual creation would likely involve AudioContext. * @return WebAPI.WebAudioAPI.dynamicsCompressorNode */ let make = (): WebAPI.WebAudioAPI.dynamicsCompressorNode => { // Placeholder for actual DynamicsCompressorNode creation, typically via AudioContext failwith("DynamicsCompressorNode creation not implemented in this snippet.") } ``` -------------------------------- ### PushSubscriptionOptionsInit API Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/push-api Provides initialization options for creating a push subscription. ```APIDOC ## PushSubscriptionOptionsInit ### Description Used to initialize `PushSubscriptionOptions`. ### Fields * **userVisibleOnly** (option< bool >) - Optional flag for user-visible notifications. * **applicationServerKey** (option< applicationServerKey >) - Optional application server key. ### Module This type is used for initializing subscription options. ``` -------------------------------- ### Range: setStartBefore Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/range Sets the start boundary of a DOM Range to be before a given node. The start point will be set to the beginning of the specified node. This is useful for creating ranges that start precisely at the beginning of an element. ```rescript let setStartBefore = (range: WebAPI.DOMAPI.range, node: WebAPI.DOMAPI.node) => { range.setStartBefore(node) } ``` -------------------------------- ### Web Audio API - AudioContext Creation Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/audio-context Provides methods for creating and managing an AudioContext, the main entry point for the Web Audio API. ```APIDOC ## make ### Description Creates a new AudioContext object. ### Method POST (or similar, depending on framework) ### Endpoint /audioContext/make ### Parameters #### Query Parameters - **options** (option) - Optional - Configuration options for the AudioContext. ### Response #### Success Response (200) - **audioContext** (WebAPI.WebAudioAPI.audioContext) - The created AudioContext object. ### Response Example ```json { "audioContext": { ... } } ``` ``` -------------------------------- ### Start Animation on HTMLTrackElement Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmltrack-element Starts an animation on an HTMLTrackElement. It accepts an animation definition and optional keyframe animation options. ```rescript let animate = ( node: WebAPI.DOMAPI.htmlTrackElement, definition: WebAPI.Prelude.any, options: option, ) => { /* ... implementation ... */ }; let animateWithKeyframes = ( node: WebAPI.DOMAPI.htmlTrackElement, definition: WebAPI.Prelude.any, options: option, ) => { /* ... implementation ... */ }; ``` -------------------------------- ### PushSubscriptionOptionsInit Record Fields Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/push-api Provides the structure for initializing PushSubscriptionOptions, allowing optional specification of user visibility and the application server key. ```rescript type pushSubscriptionOptionsInit = { userVisibleOnly: option, applicationServerKey: option } ``` -------------------------------- ### Opening an IndexedDB Database Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/indexed-dbapi Demonstrates how to open an IndexedDB database using IDBFactory. Includes event handlers for success and error scenarios. ```rescript let request = WebAPI.IndexedDB.idbFactory->open("myDatabase", Some(1)); request->WebAPI.EventTarget.addEventListener("success", event => { let db = event->WebAPI.IDBOpenDBRequest.result; Js.log("Database opened successfully"); }); request->WebAPI.EventTarget.addEventListener("error", event => { Js.log("Error opening database"); }); ``` -------------------------------- ### Start AudioScheduledSourceNode (ReScript) Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/audio-scheduled-source-node Starts or unschedules an amount of time from the AudioScheduledSourceNode. This function is part of the ReScript bindings for the Web API. ```rescript WebAPI.WebAudioAPI.start(audioScheduledSourceNode, when) ``` -------------------------------- ### AudioBufferOptions Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api Options for creating an AudioBuffer. ```APIDOC ## AudioBufferOptions ### Description Options used to specify the properties of an audio buffer to be created. ### Record Fields - **numberOfChannels** (option) - Optional number of channels. - **length** (int) - The length of the audio buffer in samples. - **sampleRate** (float) - The sample rate of the audio buffer. ``` -------------------------------- ### TimeRanges - start Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/time-ranges Retrieves the start time for a given time range index. Throws an error if the index is invalid. ```APIDOC ## GET /websites/rescript-lang_github_io_experimental-rescript-webapi/TimeRanges/start ### Description Returns the time for the start of the range with the given index. Throws an "IndexSizeError" DOMException if the index is out of range. ### Method GET ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/TimeRanges/start ### Parameters #### Query Parameters - **index** (int) - Required - The index of the time range. ### Response #### Success Response (200) - **returnValue** (float) - The start time of the specified range. #### Response Example ```json { "returnValue": 10.5 } ``` ``` -------------------------------- ### RequestInit Fields Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/fetch-api Details the fields available for configuring a RequestInit object, used for initializing requests. ```APIDOC ## RequestInit Configuration ### Description Configuration options for initializing a Fetch API request. ### Method N/A (Configuration documentation) ### Endpoint N/A ### Parameters #### Record fields - **method** (option< string >) - Description: A string to set request's method. - **headers** (option< headersInit >) - Description: A Headers object, an object literal, or an array of two-item arrays to set request's headers. - **body** (option< bodyInit >) - Description: A BodyInit object or null to set request's body. - **referrer** (option< string >) - Description: A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. - **referrerPolicy** (option< referrerPolicy >) - Description: A referrer policy to set request's referrerPolicy. - **mode** (option< requestMode >) - Description: A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. - **credentials** (option< requestCredentials >) - Description: A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. ### Request Example N/A ### Response N/A ``` -------------------------------- ### Get Animations - ReScript Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmlsource-element Retrieves an array of animations associated with an element, optionally using get animations options. ```rescript let getAnimations = (element: WebAPI.DOMAPI.htmlSourceElement, options: option) => { /* ... */ } ``` -------------------------------- ### ReScript DOMMatrix: Transformation with Initializer Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/dommatrix Demonstrates creating DOMMatrix objects from a DOMMatrixInit object. ```rescript // Example: Create DOMMatrix from DOMMatrixInit let matrixInit = { "a": 1.0, "b": 0.0, "c": 0.0, "d": 1.0, "e": 0.0, "f": 0.0, } let matrixFromInit = WebAPI.DOMAPI.fromMatrix(~matrixInit=Some(matrixInit), ()) // Example: Create DOMMatrix from DOMMatrixInit (mutable) let matrixInitMutable = { "a": 1.0, "b": 0.0, "c": 0.0, "d": 1.0, "e": 0.0, "f": 0.0, } let matrixFromInitMutable = WebAPI.DOMAPI.fromMatrixD(~matrixInit=Some(matrixInitMutable), ()) ``` -------------------------------- ### Get HTML Content (getHTML) Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmldata-list-element Retrieves the HTML content of the element. The options parameter can specify how to get the HTML. ```rescript let getHTML = (element: WebAPI.DOMAPI.htmlDataListElement, options: WebAPI.DOMAPI.getHTMLOptions) => { /* ... implementation ... */ } ``` -------------------------------- ### CompositionEventInit Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/uievents-api Initialization options for CompositionEvent. ```APIDOC ## CompositionEventInit ### Description Initialization options for creating a CompositionEvent. ### Record fields - **bubbles** (option< bool >) - **cancelable** (option< bool >) - **composed** (option< bool >) - **view** (option< Null.t< WebAPI.DOMAPI.window > >) - **detail** (option< int >) - **which** (option< int >) - **data** (option< string >) ``` -------------------------------- ### Get Bounding Client Rectangle Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmlolist-element Gets the size and position of an element relative to the viewport. This method takes an `htmloListElement` and returns a `domRect`. ```rescript WebAPI.DOMAPI.getBoundingClientRect(element: WebAPI.DOMAPI.htmloListElement): WebAPI.DOMAPI.domRect ``` -------------------------------- ### AudioContextOptions Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api Options for configuring an AudioContext. ```APIDOC ## AudioContextOptions ### Description Options for creating an AudioContext. ### Record Fields - **latencyHint** (option) - Hint for latency. - **sampleRate** (option) - Optional sample rate. ``` -------------------------------- ### Start Audio Playback Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/audio-buffer-source-node Starts or schedules the playback of an audio buffer. It can take an optional offset and duration for precise control over playback. ```rescript let start = (node: WebAPI.WebAudioAPI.audioBufferSourceNode, offset: option) => WebAPI.Unit.t; ``` ```rescript let startA = (node: WebAPI.WebAudioAPI.audioBufferSourceNode, offset: option, duration: option, when: option) => WebAPI.Unit.t; ``` -------------------------------- ### AnalyserOptions Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api Options for configuring an AnalyserNode. ```APIDOC ## AnalyserOptions ### Description Options for creating or updating an AnalyserNode. ### Record Fields - **channelCount** (option) - Optional channel count. - **channelCountMode** (option) - Optional channel count mode. - **channelInterpretation** (option) - Optional channel interpretation. - **fftSize** (option) - Optional FFT size. - **maxDecibels** (option) - Optional maximum decibel value. - **minDecibels** (option) - Optional minimum decibel value. - **smoothingTimeConstant** (option) - Optional smoothing time constant. ``` -------------------------------- ### Get computed style of an element Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/global Retrieves the computed styles for a given DOM element. Optionally, a specific CSS property name can be provided to get only that property's value. ```rescript let getComputedStyle = (element: WebAPI.DOMAPI.element, propertyName: option = Js.undefined): WebAPI.DOMAPI.cssStyleDeclaration => { /* ... implementation details ... */ } ``` -------------------------------- ### AudioParam: setValueCurveAtTime Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/audio-param Schedules a sequence of linearly connected, arbitrary values starting at a specific time. It takes the AudioParam, an array of float values, the time at which to start, and the duration of the curve. ```rescript WebAPI.WebAudioAPI.audioParam array< float > float float ``` -------------------------------- ### SpeechSynthesisUtterance Instantiation Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-speech-api/speech-synthesis-utterance Methods for creating and configuring SpeechSynthesisUtterance objects. ```APIDOC ## POST /websites/rescript-lang_github_io_experimental-rescript-webapi/SpeechSynthesisUtterance/make ### Description Creates a new SpeechSynthesisUtterance object. Optional parameters can be provided during creation. ### Method POST ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/SpeechSynthesisUtterance/make ### Parameters #### Request Body - **options** (option< string >) - Optional - Configuration options for the SpeechSynthesisUtterance object. ### Response #### Success Response (200) - **utterance** (WebAPI.WebSpeechAPI.speechSynthesisUtterance) - The newly created SpeechSynthesisUtterance object. ### Response Example ```json { "utterance": "[SpeechSynthesisUtterance object representation]" } ``` ``` -------------------------------- ### Range: setStartAfter Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/range Sets the start boundary of a DOM Range to be after a given node. The start point will be set to the end of the specified node. This is useful for creating ranges that begin just after an element. ```rescript let setStartAfter = (range: WebAPI.DOMAPI.range, node: WebAPI.DOMAPI.node) => { range.setStartAfter(node) } ``` -------------------------------- ### ResponseInit Record Fields Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/fetch-api This section details the fields of the ResponseInit record. ```APIDOC ## ResponseInit Record Fields ### Description Fields available in the ResponseInit record for constructing a response. ### Method N/A (Fields of ResponseInit record) ### Endpoint N/A (Fields of ResponseInit record) ### Parameters #### ResponseInit Fields - **status** (option< int >) - Description: The HTTP status code. - **statusText** (option< string >) - Description: The status message. - **headers** (option< headersInit >) - Description: The response headers. ``` -------------------------------- ### Get Attribute by Name and Namespace Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmltable-cell-element Retrieves an attribute's value by its qualified name, or by its namespace and local name. Also provides methods to get all attribute names and attribute nodes. ```rescript WebAPI.DOMAPI.getAttribute(~element: WebAPI.DOMAPI.htmlTableCellElement, ~qualifiedName: string) ``` ```rescript WebAPI.DOMAPI.getAttributeNames(~element: WebAPI.DOMAPI.htmlTableCellElement) ``` ```rescript WebAPI.DOMAPI.getAttributeNode(~element: WebAPI.DOMAPI.htmlTableCellElement, ~qualifiedName: string) ``` ```rescript WebAPI.DOMAPI.getAttributeNodeNS(~element: WebAPI.DOMAPI.htmlTableCellElement, ~namespace: string, ~localName: string) ``` ```rescript WebAPI.DOMAPI.getAttributeNS(~element: WebAPI.DOMAPI.htmlTableCellElement, ~namespace: string, ~localName: string) ``` -------------------------------- ### AudioNodeOptions API Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api Options for configuring an AudioNode. ```APIDOC ## AudioNodeOptions API ### Description Options for configuring an AudioNode. ### Record fields - **channelCount** (option) - Optional channel count for the node. - **channelCountMode** (option) - Optional channel count mode for the node. - **channelInterpretation** (option) - Optional channel interpretation for the node. ``` -------------------------------- ### AudioProcessingEventInit API Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api Initialization options for an AudioProcessingEvent. ```APIDOC ## AudioProcessingEventInit API ### Description Initialization options for an AudioProcessingEvent. ### Record fields - **bubbles** (option) - Optional: whether the event bubbles. - **cancelable** (option) - Optional: whether the event is cancelable. - **composed** (option) - Optional: whether the event is composed. - **playbackTime** (float) - The time at which the event occurred. - **inputBuffer** (audioBuffer) - The input buffer for the event. - **outputBuffer** (audioBuffer) - The output buffer for the event. ``` -------------------------------- ### Range: setStart Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/range Sets the start boundary of a DOM Range. This method adjusts the start point of the range to a specific node and offset. It allows precise control over the range's beginning. ```rescript let setStart = (range: WebAPI.DOMAPI.range, node: WebAPI.DOMAPI.node, offset: int) => { range.setStart(node, offset) } ``` -------------------------------- ### AudioBufferSourceOptions Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api Options for configuring an AudioBufferSourceNode. ```APIDOC ## AudioBufferSourceOptions ### Description Options for creating or updating an AudioBufferSourceNode. ### Record Fields - **buffer** (option>) - Optional audio buffer. - **detune** (option) - Optional detune amount in cents. - **loop** (option) - Optional loop flag. - **loopEnd** (option) - Optional loop end time. - **loopStart** (option) - Optional loop start time. - **playbackRate** (option) - Optional playback rate. ``` -------------------------------- ### Range: collapse Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/range Collapses a DOM Range to a single point. This operation can either collapse the range to its start or end point, depending on the boolean argument. If no argument is provided, it defaults to collapsing to the start. ```rescript let collapse = (range: WebAPI.DOMAPI.range, ?toStart: bool=?) => { range.collapse(toStart) } ``` -------------------------------- ### ServiceWorkerContainer startMessages Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/service-worker-api/service-worker-container Starts the message channel for the ServiceWorkerContainer. ```APIDOC ## ServiceWorkerContainer startMessages ### Description Starts the message channel for the ServiceWorkerContainer. Read more on MDN ### Method POST ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/ServiceWorkerContainer ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **container** (WebAPI.ServiceWorkerAPI.serviceWorkerContainer) - Description not provided ### Request Example ```json { "container": "exampleContainer" } ``` ### Response #### Success Response (200) - **unit** (unit) - Indicates success, no specific data returned. #### Response Example ```json {} ``` ``` -------------------------------- ### Prelude Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs Core functionalities and basic types used across ReScript. ```APIDOC ## Prelude ### Description Contains fundamental types, functions, and modules that form the basis of ReScript programming. ### Method N/A (Module definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### WebAPI.DOMAPI.element Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmlbutton-element Gets an element by its ID. ```APIDOC ## GET /websites/rescript-lang_github_io_experimental-rescript-webapi/element ### Description Gets an element by its ID. ### Method GET ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/element ### Parameters #### Query Parameters - **id** (string) - Required - The ID of the element to retrieve. ### Response #### Success Response (200) - **element** (WebAPI.DOMAPI.element) - The found HTML element. #### Response Example ```json { "element": "
...
" } ``` ``` -------------------------------- ### startViewTransition DOMAPI Document with Callback Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/document Initiates a view transition for the document, optionally accepting a callback function to update the view. This is useful for smooth UI updates. ```rescript WebAPI.DOMAPI.startViewTransition(document, Js.undefined) ``` ```rescript WebAPI.DOMAPI.startViewTransition(document, Js.some(updateCallback)) ``` -------------------------------- ### getLineDash Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/canvas-rendering-context2d Gets the current line dash pattern. ```APIDOC ## getLineDash ### Description Gets the current line dash pattern. ### Method Not specified (typically a function call in ReScript) ### Endpoint Not applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` // Example for getLineDash ``` ### Response #### Success Response (200) - **array** - An array of numbers representing the line dash pattern. #### Response Example ```json { "example": "[2, 5, 3]" } ``` ``` -------------------------------- ### DynamicsCompressorNode Creation Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/dynamics-compressor-node Method for creating a new DynamicsCompressorNode. ```APIDOC ## POST /websites/rescript-lang_github_io_experimental-rescript-webapi/DynamicsCompressorNode/make ### Description Creates a new DynamicsCompressorNode. ### Method POST ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/DynamicsCompressorNode/make ### Response #### Success Response (200) - **dynamicsCompressorNode** (WebAPI.WebAudioAPI.dynamicsCompressorNode) - The newly created DynamicsCompressorNode. #### Response Example ```json { "nodeId": "dynCompressor1", "nodeType": "DynamicsCompressorNode" } ``` ``` -------------------------------- ### ShadowRoot Initialization Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi Defines the structure for initializing a ShadowRoot. ```APIDOC ## ShadowRoot Initialization ### shadowRootInit #### Record fields - **mode** (`shadowRootMode`) - Required - The mode of the shadow root ('open' or 'closed'). - **delegatesFocus** (`option< bool >`) - Optional - Whether focus should be delegated to the shadow root. - **slotAssignment** (`option< slotAssignmentMode >`) - Optional - The mode for slot assignment. - **serializable** (`option< bool >`) - Optional - Whether the shadow root should be serializable. ``` -------------------------------- ### ReScript: Set Selection Range for HTML Input Elements Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmlinput-element Binds to the DOM API's setSelectionRange method for HTML input elements. This function sets the start and end positions of a selection in a text field. It takes an HTMLInputElement, start and end positions, and an optional direction. ```rescript let setSelectionRange: (WebAPI.DOMAPI.htmlInputElement, int, int, option) => unit ``` -------------------------------- ### OscillatorNode Methods Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api/oscillator-node Provides documentation for various methods of the OscillatorNode interface, including event listener management, periodic wave setting, and audio start/stop operations. ```APIDOC ## OscillatorNode removeEventListener ### Description Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN ### Method POST (example - actual method may vary based on ReScript bindings) ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/oscillatorNode/removeEventListener ### Parameters #### Path Parameters - **oscillatorNode** (WebAPI.WebAudioAPI.oscillatorNode) - Required - The oscillator node. - **eventType** (WebAPI.EventAPI.eventType) - Required - The type of event to remove. - **eventListener** (WebAPI.EventAPI.eventListener) - Required - The listener function to remove. #### Query Parameters - **options** (option< WebAPI.EventAPI.eventListenerOptions >) - Optional - Options for the event listener. ### removeEventListener_useCapture ### Description Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN ### Method POST (example - actual method may vary based on ReScript bindings) ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/oscillatorNode/removeEventListener_useCapture ### Parameters #### Path Parameters - **oscillatorNode** (WebAPI.WebAudioAPI.oscillatorNode) - Required - The oscillator node. - **eventType** (WebAPI.EventAPI.eventType) - Required - The type of event to remove. - **eventListener** (WebAPI.EventAPI.eventListener) - Required - The listener function to remove. ### setPeriodicWave ### Description Read more on MDN ### Method POST (example - actual method may vary based on ReScript bindings) ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/oscillatorNode/setPeriodicWave ### Parameters #### Path Parameters - **oscillatorNode** (WebAPI.WebAudioAPI.oscillatorNode) - Required - The oscillator node. - **periodicWave** (WebAPI.WebAudioAPI.periodicWave) - Required - The periodic wave to set. ### start ### Description Read more on MDN ### Method POST (example - actual method may vary based on ReScript bindings) ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/oscillatorNode/start ### Parameters #### Path Parameters - **oscillatorNode** (WebAPI.WebAudioAPI.oscillatorNode) - Required - The oscillator node. #### Query Parameters - **when** (option< float >) - Optional - The time at which to start the oscillator. ### stop ### Description Read more on MDN ### Method POST (example - actual method may vary based on ReScript bindings) ### Endpoint /websites/rescript-lang_github_io_experimental-rescript-webapi/oscillatorNode/stop ### Parameters #### Path Parameters - **oscillatorNode** (WebAPI.WebAudioAPI.oscillatorNode) - Required - The oscillator node. #### Query Parameters - **when** (option< float >) - Optional - The time at which to stop the oscillator. ``` -------------------------------- ### fillText Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/canvas-rendering-context2d Draws a text string at the specified starting point. ```APIDOC ## fillText ### Description Draws a text string at the specified starting point. ### Method Not specified (typically a function call in ReScript) ### Endpoint Not applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` // Example for fillText ``` ### Response #### Success Response (200) Not applicable #### Response Example ``` // No explicit response body, operation modifies the canvas ``` ``` -------------------------------- ### ReScript DOMMatrix: Create and Transform Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/dommatrix Demonstrates creating and applying transformations to a DOMMatrix. Includes methods for rotation, scaling, and translation, with options for self-modification. ```rescript // Example: Create a new DOMMatrix and rotate it let matrix = WebAPI.DOMAPI.make(~matrixInit=None, ()) // Creates a new DOMMatrix let rotatedMatrix = WebAPI.DOMAPI.rotate(~matrix=matrix, ~angle=Some(45.0), ()) // Example: Scale a DOMMatrix in place let matrixToScale = WebAPI.DOMAPI.make(~matrixInit=None, ()) // Creates a new DOMMatrix let scaledMatrix = WebAPI.DOMAPI.scaleSelf(~matrix=matrixToScale, ~scaleX=Some(2.0), ~scaleY=Some(0.5), ()) // Example: Translate a DOMMatrix let matrixToTranslate = WebAPI.DOMAPI.make(~matrixInit=None, ()) // Creates a new DOMMatrix let translatedMatrix = WebAPI.DOMAPI.translate(~matrix=matrixToTranslate, ~tx=Some(10.0), ~ty=Some(5.0), ()) // Example: Skew a DOMMatrix let matrixToSkew = WebAPI.DOMAPI.make(~matrixInit=None, ()) // Creates a new DOMMatrix let skewedMatrix = WebAPI.DOMAPI.skewX(~matrix=matrixToSkew, ~skewX=Some(15.0), ()) ``` -------------------------------- ### Get Attribute Node Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmldlist-element Retrieves the attribute node associated with the given name. ```rescript /* getAttributeNode - Retrieves the attribute node associated with the given name. Read more on MDN */ let getAttributeNode = (element: WebAPI.DOMAPI.htmldListElement, name: string) => { /* ... implementation ... */ } ``` -------------------------------- ### ChannelSplitterOptions Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/web-audio-api Options for configuring a ChannelSplitterNode. ```APIDOC ## ChannelSplitterOptions ### Description Configuration options for creating a ChannelSplitterNode. ### Record fields - **channelCount** (option) - Optional: The number of channels. - **channelCountMode** (option) - Optional: The channel count mode. - **channelInterpretation** (option) - Optional: The channel interpretation. - **numberOfOutputs** (option) - Optional: The number of outputs. ``` -------------------------------- ### Storage APIs: localStorage, location, locationbar, menubar, navigator Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/global Provides access to browser storage (localStorage) and information about the browser window, location, and user agent (navigator). ```APIDOC ## GET /browser/info ### Description Accesses browser storage and information. ### Method GET ### Endpoint /browser/info ### Parameters None ### Request Example ```javascript localStorage.setItem("key", "value") let currentUrl = location.href let menuVisible = menubar.visible ``` ### Response #### Success Response (200) - **localStorage** (WebAPI.StorageAPI.storage) - Interface for accessing local storage. - **location** (WebAPI.LocationAPI.location) - Interface for accessing the window's location. - **locationbar** (WebAPI.BarProp.barProp) - Indicates if the location bar is visible. - **menubar** (WebAPI.BarProp.barProp) - Indicates if the menu bar is visible. - **navigator** (WebAPI.NavigatorAPI.navigator) - Interface for the user's browser. #### Response Example ```json { "localStorage": "", "location": "", "locationbar": {"visible": true}, "menubar": {"visible": false}, "navigator": "" } ``` ``` -------------------------------- ### Get Attribute by Name Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmldlist-element Returns the value of the attribute with the specified name, or null if not found. ```rescript /* getAttribute - Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise. Read more on MDN */ let getAttribute = (element: WebAPI.DOMAPI.htmldListElement, qualifiedName: string) => { /* ... implementation ... */ } ``` -------------------------------- ### fetch Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/window Initiates a request to the network and returns a promise that resolves with the response. ```APIDOC ## POST /fetch ### Description Starts the process of fetching a resource from the network. ### Method POST ### Endpoint /fetch ### Parameters #### Request Body - **window** (WebAPI.DOMAPI.window) - Required - The window context. - **url** (string) - Required - The URL of the resource to fetch. - **init** (option) - Optional - Initialization options for the request. ### Response #### Success Response (200) - **response** (promise) - A promise that resolves with the Response object. ### Request Example ```json { "window": "window_object", "url": "https://example.com", "init": { "method": "GET" } } ``` ### Response Example ```json { "response": "response_object" } ``` ``` -------------------------------- ### CanvasRenderingContext2D: createLinearGradient Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/canvas-rendering-context2d Creates a linear gradient. Requires start and end coordinates for the gradient. ```rescript let createLinearGradient: (canvasRenderingContext2D, float, float, float, float) => canvasGradient ``` -------------------------------- ### PointerEvent Initialization Options Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/uievents-api Fields for initializing a PointerEvent. ```APIDOC ## PointerEvent Initialization Options ### Description Fields for configuring the PointerEvent. ### Fields - **bubbles** (option) - Description: Not specified. - **cancelable** (option) - Description: Not specified. - **composed** (option) - Description: Not specified. - **view** (option>) - Description: Not specified. - **detail** (option) - Description: Not specified. - **which** (option) - Description: Not specified. - **ctrlKey** (option) - Description: Not specified. - **shiftKey** (option) - Description: Not specified. - **altKey** (option) - Description: Not specified. - **metaKey** (option) - Description: Not specified. - **modifierAltGraph** (option) - Description: Not specified. - **modifierCapsLock** (option) - Description: Not specified. - **modifierFn** (option) - Description: Not specified. - **modifierFnLock** (option) - Description: Not specified. - **modifierHyper** (option) - Description: Not specified. - **modifierNumLock** (option) - Description: Not specified. - **modifierScrollLock** (option) - Description: Not specified. - **modifierSuper** (option) - Description: Not specified. - **modifierSymbol** (option) - Description: Not specified. - **modifierSymbolLock** (option) - Description: Not specified. - **screenX** (option) - Description: Not specified. - **screenY** (option) - Description: Not specified. - **clientX** (option) - Description: Not specified. - **clientY** (option) - Description: Not specified. - **button** (option) - Description: Not specified. - **buttons** (option) - Description: Not specified. - **relatedTarget** (option>) - Description: Not specified. - **movementX** (option) - Description: Not specified. - **movementY** (option) - Description: Not specified. - **pointerId** (option) - Description: Not specified. - **width** (option) - Description: Not specified. - **height** (option) - Description: Not specified. - **pressure** (option) - Description: Not specified. - **tangentialPressure** (option) - Description: Not specified. - **tiltX** (option) - Description: Not specified. - **tiltY** (option) - Description: Not specified. - **twist** (option) - Description: Not specified. - **altitudeAngle** (option) - Description: Not specified. - **azimuthAngle** (option) - Description: Not specified. - **pointerType** (option) - Description: Not specified. - **isPrimary** (option) - Description: Not specified. - **coalescedEvents** (option>) - Description: Not specified. - **predictedEvents** (option>) - Description: Not specified. ``` -------------------------------- ### TouchInit Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/uievents-api Defines the properties that can be used to create or initialize a Touch object. ```APIDOC ## TouchInit ### Description Defines the properties that can be used to create or initialize a Touch object. ### Record Fields - **identifier** (int) - **target** (WebAPI.EventAPI.eventTarget) - **clientX** (option< float >) - **clientY** (option< float >) - **screenX** (option< float >) - **screenY** (option< float >) - **pageX** (option< float >) - **pageY** (option< float >) - **radiusX** (option< float >) - **radiusY** (option< float >) - **rotationAngle** (option< float >) - **force** (option< float >) - **altitudeAngle** (option< float >) - **azimuthAngle** (option< float >) - **touchType** (option< touchType >) ``` -------------------------------- ### CanvasRenderingContext2D: createConicGradient Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/canvas-rendering-context2d Creates a conic gradient. Requires the center coordinates and the start angle. ```rescript let createConicGradient: (canvasRenderingContext2D, float, float, float) => canvasGradient ``` -------------------------------- ### Get Client Rectangles Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmldlist-element Returns a DOMRectList of all the rectangles that describe the element's bounding box. ```rescript /* getClientRects - Returns a DOMRectList of all the rectangles that describe the element's bounding box. Read more on MDN */ let getClientRects = (element: WebAPI.DOMAPI.htmldListElement) => { /* ... implementation ... */ } ``` -------------------------------- ### TouchEvent: make Constructor Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/uievents-api/touch-event Creates a new TouchEvent instance. It accepts an optional initialization object for configuring the event. ```rescript let make: (string, option) => WebAPI.UIEventsAPI.touchEvent ``` -------------------------------- ### Get Attribute with Namespace Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmldlist-element Returns the value of the attribute within the specified namespace, or null if not found. ```rescript /* getAttributeNS - Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise. Read more on MDN */ let getAttributeNS = (element: WebAPI.DOMAPI.htmldListElement, namespaceURI: string, localName: string) => { /* ... implementation ... */ } ``` -------------------------------- ### Get All Attribute Names Source: https://rescript-lang.github.io/experimental-rescript-webapi/apidocs/domapi/htmldlist-element Returns an array of all attribute names for the element. May contain duplicates. ```rescript /* getAttributeNames - Returns the qualified names of all element's attributes. Can contain duplicates. Read more on MDN */ let getAttributeNames = (element: WebAPI.DOMAPI.htmldListElement) => { /* ... implementation ... */ } ```