In a smartphone-based logic, JavaScript supports accelerometer and/or gyroscope measures for device motion and device orientation. The
devicemotion
anddeviceorientation
events are devoted to this task.Example Google_cardboard_three_js.zip
Rule(s)
- Geolocation in JavaScript is a native facility of browsers to get the device's latitude and longitude. While smartphones has a devoted chip for that using the American or European (a.k.a. Galileo) Global Positioning System (GPS), desktop computers have (non-normalized) proprietary implementations like IP address triangulation.
Geolocation facility availability
Rule(s)
- Geolocation is associated with Web data freely offered ou sold by data providers like Google Maps Platform (paying) or OpenStreetMap (free). Data access is based on JavaScript APIs, respectively Google Maps Platform APIs and Leaflet.
Geolocation, opening facility (OpenStreetMap)
Example Geolocation.js.zip
![]()
Geolocation, closing facility (OpenStreetMap)
Example Geolocation.js.zip
![]()
In a standardization logic, JavaScript lets access to device equipment with the capability of testing presence and availability. Typically, the Vibration API may enact the vibrator, if any, in a software manner.
Example Vibration_API.ts.zip
The Web Audio API benefits from being used through high-end devoted libraries, notably SOUNDJS.
Example Theo_is_crying.ts.zip
WebRTC standing for Web Real-Time Communications allows the direct access to input device, namely webcams and microphones.
Rule(s)
- One may test the available multimedia capabilities of a given machine and its associated browser from, for instance, here…
- One may also specifically test the launching of the camera here…
Example (finding available devices)
Rule(s)
- Because of privacy issues, the browser requires a user's agreement before going on… Note that Chrome requires the user's agreement only once (and records it for future sessions) while Firefox, for instance, asks for this agreement several times.
Example Selfie.ts.zip
Rule(s)
- Web services are server-side programs accessible throughout the Web. By appropriate calls in JavaScript, one is able to get any data and to reduce computations on the client side.
- The way by which Web services may, for some categories of Web services, be attained and called is documented through the Web Service Description Language (WSDL).
Example
- Documentation access: https://www.w3schools.com/xml/tempconvert.asmx?WSDL
- Browser-based test: https://www.w3schools.com/xml/tempconvert.asmx?op=CelsiusToFahrenheit
Get
Web_Services.ts.zip![]()
Post
Web_Services.ts.zip![]()
Post
usingfetch
Web_Services.ts.zip![]()
Note(s)
- There is a useful Web site from which requests may be tested against several parameters: here… as, for example, https://httpbin.org/get?lang=fr&prenom=Franck&nom=Barbier.
WebSockets is a technology that promotes bi-directional full-duplex communication between (not exclusively) browsers and WebSockets servers. The general way of dealing with WebSockets in JavaScript is described here…
Example WebSockets_Tyrus_1_17.Java.zip
![]()
Web Workers is a support for dealing with a kind of multithreading. More precisely, some JavaScript code may run outside the browser so that this code lightens the load on the browser. Web Workers mainly consist in facilities to assign background tasks from a browser to a given Web Worker that runs in parallel.
Rule(s)
- A Web Worker does not access to common JavaScript stuff,
window
in particular. Theself
keyword then refers to the Web Worker's own resources.Example (“main” thread in the browser) Web_Workers.ts.zip
Example (“parallel” thread outside the browser) Web_Workers.ts.zip
The Speech synthesis mainly works with Chrome, intro. here….
The Speech recognition mainly works with Chrome, intro. here….