Line 107:
Line 107:
== Wii U Scripting Functionality ==
== Wii U Scripting Functionality ==
−
In addition to W3C standard touch screen functionality, Internet Browser exposes many Wii U input and output functions to Javascript through the <tt>wiiu</tt> object.
+
In addition to W3C standard keyboard, touch screen, and motion tracking functionality, Internet Browser exposes many Wii U input and output functions to Javascript through the <tt>wiiu</tt> object.
+
+
=== W3C Events ===
+
+
Internet Browser supports the following W3C events:
+
+
{| class='wikitable'
+
! Event Name
+
! Callback Function
+
! W3C Documentation
+
|-
+
| <tt>"keydown"</tt>
+
| <i>element</i><tt>.onkeydown</tt>
+
| rowspan="3" | [http://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents DOM Level 3]
+
|-
+
| <tt>"keypress"</tt>
+
| <i>element</i><tt>.onkeypress</tt>
+
|-
+
| <tt>"keyup"</tt>
+
| <i>element</i><tt>.onkeyup</tt>
+
|-
+
| <tt>"touchstart"</tt>
+
| <i>element</i><tt>.ontouchstart</tt>
+
| rowspan="4" | [http://www.w3.org/TR/touch-events/ Touch Events]
+
|-
+
| <tt>"touchmove"</tt>
+
| <i>element</i><tt>.ontouchmove</tt>
+
|-
+
| <tt>"touchend"</tt>
+
| <i>element</i><tt>.ontouchend</tt>
+
|-
+
| <tt>"touchcancel"</tt>
+
| <i>element</i><tt>.ontouchcancel</tt>
+
|-
+
| <tt>"devicemotion"</tt>
+
| <tt>window.ondevicemotion</tt>
+
| rowspan="2" | [http://www.w3.org/TR/orientation-event/ DeviceOrientation Event Specification]
+
|-
+
| <tt>"deviceorientation"</tt>
+
| <tt>window.ondeviceorientation</tt>
+
|}
+
<b>TODO:</b> <i>Add non-input events like "load"</i>
+
+
Note that only the following buttons are recognized with the key events:
+
+
{| class='wikitable'
+
! Button
+
! keyCode
+
|-
+
| {{WiiUGamePadAButton}}
+
| 13
+
|-
+
| {{WiiUGamePadDPadLeft}}
+
| 37
+
|-
+
| {{WiiUGamePadDPadUp}}
+
| 38
+
|-
+
| {{WiiUGamePadDPadRight}}
+
| 39
+
|-
+
| {{WiiUGamePadDPadDown}}
+
| 40
+
|}
=== wiiu.gamepad ===
=== wiiu.gamepad ===