Frontier Software

Javascript

I’m in the process of figuring out pointer events after originally doing the games for mouse events.

Add the event handlers to a specific target element (rather than the entire document or nodes higher up in the document tree). — Best Practices

This means add listeners to canvas rather than document?

Hit Test

Pointer Capture

function downHandler(ev) {
  const el = document.getElementById("target");
  // Element "target" will receive/capture further events
  el.setPointerCapture(ev.pointerId);
}

function cancelHandler(ev) {
  const el = document.getElementById("target");
  // Release the pointer capture
  el.releasePointerCapture(ev.pointerId);
}

function init() {
  const el = document.getElementById("target");
  // Register pointerdown and pointercancel handlers
  el.onpointerdown = downHandler;
  el.onpointercancel = cancelHandler;
}

pointercancel event

https://developer.mozilla.org/en-US/docs/Web/API/Element/gotpointercapture_event

https://developer.mozilla.org/en-US/docs/Web/API/Element/lostpointercapture_event

https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture

https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture

https://developer.mozilla.org/en-US/docs/Web/API/Element/releasePointerCapture

https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_view/Coordinate_systems

e.clientX

jsdoc

To install, as root: npm install -g jsdoc jsdoc -d jsdoc ../assets/js/ggp-eventLoop.js ../content/tictactoe/board.js Website Github

jasmine

Documentation git clone https://github.com/jasmine/jasmine.git The key files are in jasmine/lib/jasmine-core. Behaviour Driven Development Jargon Given When Then G i v e n W h e n T h e n Design by Contract Client must ensure precondition. Supplier may assume precondition. R e q u i r e D o E n s u r e Arrange Act Assert A r r a n g e A c t A s s e r t

node

After gaining some experience at using Bash’s associative arrays to handle JSON, I decided a better approach would be to rather write Unix filters in JavaScript which read JSON from stdin and write the munged JSON to stdout while logging problems to stderr. Courtesy of node, that can be done, though it required deciphering its jargon. For instance what I’d call a remote procedure call to, say, date, involves using Node’s child_process module.

browser