Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 1.88 KB

README.md

File metadata and controls

78 lines (54 loc) · 1.88 KB

Trend Indicator

Trend Indicator is a chrome extension that displays a value and the current trend for that value on a BrowserAction! It's useful for things like temperature, inbox level, or anything else with a value < 1000. The indicator is updated in real time via a HTML5 EventStream.

Configuration

The extension must be pointed at a server that serves up a HTML5 EventSource and a static version of the last event served.

Click on the icon and enter the URL in the obvous box.

Server

An example server that generates random data can be found in eventsource.go.

The server must provide an HTML5 EventSource and a /last endpoint.

For example:

The only thing that's important in the URL is the /last suffix. /events isn't needed.

An appropriate Access-Control-Allow-Origin header must be sent, or Chrome will refuse to process the data.

For example, allow all origins:

Access-Control-Allow-Origin: *

Message Content

Messages should have EventSource type message and be the JSON representation of this go struct:

type pushMessage struct {
    // The value of the indicator.
    Value     string `json:"value"`
    // The timestamp of when the value was generated.
    Timestamp int64  `json:"timestamp"`
    // Offset into trend array.
	Trend     int    `json:"trend"`
}

For example:

{value: "204", timestamp: 1552878938, trend: 4}

Trend Values

  1. (nothing)
  2. ↑↑ (up fast)
  3. ↑ (up)
  4. ↗ (up slowly)
  5. → (steady)
  6. ↘ (down slowly)
  7. ↓ (down)
  8. ↓↓ (down fast)
  9. ❓ (unknown)
  10. ⚠️ (problem)

FAQ

  • Why only numbers < 1000? Because otherwise they're too small to read.

Disclaimer

This is not an official Google project.