mapbox / streambot

DEPRECATED (SEE README) Robot-assisted deploys to Lambda
ISC License
39 stars 7 forks source link

bind context to this during execution #36

Closed rclark closed 8 years ago

rclark commented 8 years ago

Fixes #35 by binding context to the function when it gets executed. This makes context functions and attributes accessible:

var streambot = require('streambot');

streambot(function(event, callback) {
  console.log(this.getRemainingTimeInMillis());
  console.log(this.invokedFunctionArn);
  callback();
});

cc @emilymcafee @zmully I know at some point you folks were looking for this.

rclark commented 8 years ago

Also, for the sake of logging, added a setTimeout that will log a message when the function has about 200ms of execution time remaining.