Skip to content

Style Guide

David Scrobonia edited this page Sep 17, 2017 · 5 revisions

Promises

Promises should be styled according to this guide by Dave Atchley

Javascript

jslint

jslint will run on all pull requests.

Tools

All tools require:

  • a label for the button
  • an icon for the button
  • initializeStorage function that saves tool data to indexeddb
  • listener for activate event that calls initializeStorage
  • listener for message events
  • using the module pattern
    • exposing the name
    • add the module to the service worker's self.tools object using the name as the key

postMessages

When sending postMessages between components they typically follow the same structure. The action property is what the receiving componet will use to determine what function to call, and the field properites are used to pass along any other information needed for that function.

var message = {
  action: "nameOfAction",
  field1: "fieldData1",
  field2: "fieldData2"
}