From babbb20fb3569ee3cbdf3dae2145afea9a5212b9 Mon Sep 17 00:00:00 2001 From: Daniel Brain Date: Fri, 26 Feb 2016 17:43:29 -0800 Subject: [PATCH] Update docs --- README.md | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 68e3fdb9..40f8d5d3 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,29 @@ and fail gracefully if it does not. // In one window +postRobot.on('getCart', function(err, data, callback) { + return callback({ + amount: 1 + }); +}); + +// In another window + +postRobot.send(window, 'getCart', function(err, data) { + console.log(data); +}); +``` + +## Long form + +```javascript + +// In one window + postRobot.listen({ + window: window.opener, + name: 'getCart', handler: function(data, callback) { @@ -60,17 +81,3 @@ postRobot.request({ }); ``` - -## Shortcuts - -``` -postRobot.on('getCart', function(err, data, callback) { - return callback({ - amount: 1 - }); -}); - -postRobot.send(window, 'getCart', function(err, data) { - console.log(data); -}); -``` \ No newline at end of file