From e6c9f03e3d88a8d2ab9b063aba66469b914b0750 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Fri, 20 Mar 2015 15:22:34 -0400 Subject: [PATCH] added more info --- doc/API.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/API.md b/doc/API.md index 67ff46e..6151ca5 100644 --- a/doc/API.md +++ b/doc/API.md @@ -107,26 +107,28 @@ torqueLayer.setSQL("SELECT * FROM table LIMIT 100"); ### Events Events in Torque follow the format: ```js -torqueLayer.on('event-type', function() { +torqueLayer.on('event-type', function([callback_obj]) { // do something }); ``` -| Events | options | callback object | Description | -|-----------|:-----------|:----------|:---------------------------------------| -| ```change:steps```| | current step | When a map changes steps, this event is triggered | -| ```change:bounds```| | current bounds | ?? | -| ```change:time```| | current time, step number | When a map changes time, this event is triggered | -| ```pause```| none | ?? | Pauses the animation at current time and step | -| ```stop```| none | ?? | Stops the animation, returns the time and step to the beginning | -| ```play```| none | ?? | Plays the animation from the current time and step | +| Events | callback object | Description | +|-----------|:----------|:---------------------------------------| +| ```change:steps```| current step | When a map changes steps, this event is triggered | +| ```change:bounds```| current bounds | ?? | +| ```change:time```| current time, step number | When a map changes time, this event is triggered | +| ```play```| none?? | Triggered when the Torque layer is played | +| ```pause```| none?? | Triggered when the Torque layer is paused | +| ```stop```| none?? | Triggered when the Torque layer is stopped | +| ```load```| none?? | Triggered when the Torque layer is loaded | ##### SQL Example Limit the data used in the Torque map. ```js -torqueLayer.on('change:steps', function() { - +torqueLayer.on('change:steps', function(step) { + // do something with step + console.log("Current step is " + step); }); ```