Main Page: Difference between revisions

From Virtujoy Documentation
No edit summary
 
No edit summary
Line 1: Line 1:
<strong>MediaWiki has been installed.</strong>
<h2>Web Sensor API</h2>
'''Sensor API''' mengekspos fungsionalitas sensor device hardware.[https://developer.mozilla.org/en-US/docs/Web/API/Sensor_APIs] Mungkin kita bisa mengembangkan web app yang mengumpulkan data sensor dan mengirimkannya ke server game?


Consult the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents User's Guide] for information on using the wiki software.
Catatan: Sensor API hanya didukung browser tertentu (misalnya Chrome).


== Getting started ==
<syntaxhighlight lang="html" line>
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list]
<ul>
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ]
  <li id="gyroscope-x"></li>
* [https://lists.wikimedia.org/postorius/lists/mediawiki-announce.lists.wikimedia.org/ MediaWiki release mailing list]
  <li id="gyroscope-y"></li>
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language]
  <li id="gyroscope-z"></li>
* [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Learn how to combat spam on your wiki]
</ul>
</syntaxhighlight>
 
<syntaxhighlight lang="javascript" line>
if (typeof Gyroscope === "undefined") {
  alert("Gyroscope API not supported on this device/browser.")
}
else {
  const gyroscope = new Gyroscope({ frequency: 60 });
 
  const gyroscopeLabelX = document.querySelector("#gyroscope-x");
  const gyroscopeLabelY = document.querySelector("#gyroscope-y");
  const gyroscopeLabelZ = document.querySelector("#gyroscope-z");
 
  gyroscope.addEventListener("reading", (e) => {
    gyroscopeLabelX.innerText = `Angular velocity along the X-axis ${gyroscope.x}`;
    gyroscopeLabelY.innerText = `Angular velocity along the Y-axis ${gyroscope.y}`;
    gyroscopeLabelZ.innerText = `Angular velocity along the Z-axis ${gyroscope.z}`;
  });
 
  gyroscope.start();
}
</syntaxhighlight>

Revision as of 11:26, 13 September 2025

Web Sensor API

Sensor API mengekspos fungsionalitas sensor device hardware.[1] Mungkin kita bisa mengembangkan web app yang mengumpulkan data sensor dan mengirimkannya ke server game?

Catatan: Sensor API hanya didukung browser tertentu (misalnya Chrome).

<ul>
  <li id="gyroscope-x"></li>
  <li id="gyroscope-y"></li>
  <li id="gyroscope-z"></li>
</ul>
if (typeof Gyroscope === "undefined") {
  alert("Gyroscope API not supported on this device/browser.")
}
else {
  const gyroscope = new Gyroscope({ frequency: 60 });

  const gyroscopeLabelX = document.querySelector("#gyroscope-x");
  const gyroscopeLabelY = document.querySelector("#gyroscope-y");
  const gyroscopeLabelZ = document.querySelector("#gyroscope-z");

  gyroscope.addEventListener("reading", (e) => {
    gyroscopeLabelX.innerText = `Angular velocity along the X-axis ${gyroscope.x}`;
    gyroscopeLabelY.innerText = `Angular velocity along the Y-axis ${gyroscope.y}`;
    gyroscopeLabelZ.innerText = `Angular velocity along the Z-axis ${gyroscope.z}`;
  });

  gyroscope.start();
}