Spike code for Javascript implementation of Pact