From 9dba5ae8cdd2cb1178f1da9e43ac0114efc7d83c Mon Sep 17 00:00:00 2001 From: Arthur Klepchukov Date: Thu, 12 May 2011 21:07:36 -0700 Subject: [PATCH] Updating README for prettier display with Github Flavored Markdown --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 78c00aa..435ce43 100644 --- a/README.md +++ b/README.md @@ -5,25 +5,37 @@ jQuery Chrono provides syntactic sugar around JavaScript's native `setTimeout` and `setInterval` functions. To execute some code in 5 minutes, instead of writing: + +```js setTimeout(function() { ... }, 300000); // how many zeros is that? +``` + or the slightly more readable: + +```js setTimeout(function() { ... }, 5 * 60 * 1000); // 5... (multiplies in head) min +``` + now you can just write: + +```js $.after(5, "minutes", function() { ... }); // :) +```` `setTimeout` becomes `$.after` and `setInterval` becomes `$.every`. -*** - Usage ----- These are all valid calls: + +```js $.after(100, function() { ... }); // 100 milliseconds $.after("9.7", function() { ... }); // 9.7 milliseconds $.after("50sec", function() { ... }); // 50 seconds $.after(7, "mins", function() { ... }); // 7 minutes $.after("33", "hours", function() { ... }); // 33 hours +``` `$.every`, for creating intervals, has the same exact syntax as `$.after`. @@ -41,8 +53,6 @@ Valid time units include: along with all their common abbreviations and pluralizations. -*** - Meta ----