From 9a9bc7f0e546841d348740f33ebc6ce579db253c Mon Sep 17 00:00:00 2001 From: Mike Flynn Date: Tue, 21 Apr 2015 10:46:20 -0700 Subject: [PATCH 1/2] Updated README with better descirption, chaining and added Rob to byline. --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2ad68ff..ee27afc 100644 --- a/README.md +++ b/README.md @@ -10,19 +10,20 @@ It's really easy to use. Just include the egg.js file on the page... ``` -...then use the `AddCode()` function to add in your easter eggs. You need to pass it the character sequence to trigger the easter egg callback, a function to trigger when it happens, and an optional set of metadata. Metadata can be anything from a string to an object. +...then use the `AddCode()` function to add in your easter eggs. You need to pass it the character sequence to trigger the easter egg callback (which can either be in plain English or Javascript key codes), a function to trigger when it happens, and an optional set of metadata. Metadata can be anything from a string to an object. ```js var egg = new Egg(); -egg.AddCode("up,up,down,down,left,right,left,right,b,a", function() { - jQuery('#egggif').fadeIn(500, function() { - window.setTimeout(function() { jQuery('#egggif').hide(); }, 5000); - }, "konami-code"); -}); -egg.AddHook(function(){ - console.log("Hook called for: " + this.activeEgg.keys); - console.log(this.activeEgg.metadata); -}); +egg + .AddCode("up,up,down,down,left,right,left,right,b,a", function() { + jQuery('#egggif').fadeIn(500, function() { + window.setTimeout(function() { jQuery('#egggif').hide(); }, 5000); + }, "konami-code"); + }) + .AddHook(function(){ + console.log("Hook called for: " + this.activeEgg.keys); + console.log(this.activeEgg.metadata); + }); egg.Listen(); ``` @@ -45,5 +46,5 @@ I put an easter egg in pretty much everything I make and after copying the same ### Credits -Created by Mike Flynn / [@thatmikeflynn](http://twitter.com/thatmikeflynn) +Created by Mike Flynn / [@thatmikeflynn](http://twitter.com/thatmikeflynn) and Rob McVey / [@negative_sleep](http://twitter.com/negative_sleep) From b04832298e33cbcf00cfc34bbd287f20e916071f Mon Sep 17 00:00:00 2001 From: Mike Flynn Date: Tue, 21 Apr 2015 10:52:39 -0700 Subject: [PATCH 2/2] Forgot to chain the Listen() call in the README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ee27afc..283f92c 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ egg .AddHook(function(){ console.log("Hook called for: " + this.activeEgg.keys); console.log(this.activeEgg.metadata); - }); -egg.Listen(); + }) + .Listen(); ``` You can also define the easter egg using the constructor: