Skip to content

Continuation policy

jmarnold edited this page Jul 7, 2012 · 6 revisions

Overview

Continuation policies are objects that are invoked during the Continuation Pipeline. They conform to a simple data structure that requires two methods:

  1. matches(continuation) : bool
  2. execute(continuation) : void

matches

This function is used to evaluate whether the policy applies to the continuation by returning true or false.

Example:

matches: function(continuation) { return continuation.statusCode == 200; }

execute

This function is used to perform anything and everything using the continuation.

Example:

execute: function(continuation) { console.log(continuation.message); }

More examples and defaults

Default policies are included out of the box and serve as a baseline to show what can be done. Check them out here.

Clone this wiki locally