Skip to content
Browse files

[docs] changed readme a bit

  • Loading branch information...
1 parent 8bcc43d commit 93618237fe66cee9cb55bac4b0edf12c8a8669a5 @dscape committed Feb 17, 2012
Showing with 32 additions and 10 deletions.
  1. +2 −6 README.md
  2. +15 −4 pattern.js
  3. +15 −0 samples/nodetuts.js
View
8 README.md
@@ -5,7 +5,7 @@
``` js
var insertAll = require('p');
-insertAll([], cb, cb);
+insertAll([], Function, function (cb) { cb(); });
insertAll(function (l,cb) {
var elem = l.shift(); // head
insertElement(elem, function(err, elem) {
@@ -15,7 +15,7 @@ insertAll(function (l,cb) {
});
});
-insertAll([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function() {
+insertAll([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function () {
console.log('done');
});
```
@@ -35,10 +35,6 @@ when you used to do [this].
1. minimize p.js
2. load it into your webpage
-## samples
-
-some [samples] are available to help you get started. one that creates a list of top npm contributors, and another that gets a bunch of data from twitter and generates valid json.
-
# roadmap
check [issues]
View
19 pattern.js
@@ -1,5 +1,16 @@
-;(function (pattern) {
- pattern = function pattern() {
- console.log('a');
+(function () {
+ var stack = [];
+
+ function p(a) {
+ stack.push(a);
+ console.log(stack);
};
-})(typeof exports === "undefined" ? pattern = {} : exports);
+
+ if(typeof exports !== 'undefined') { // node
+ // dont cache, each require is a new inst.
+ if(require.cache[module.id])
+ delete require.cache[module.id];
+ // export
+ module.exports = exports = p;
+ } else window.pattern = p;
+})();
View
15 samples/nodetuts.js
@@ -0,0 +1,15 @@
+var insertAll = require('../pattern');
+
+insertAll([], cb, cb);
+insertAll(function (l,cb) {
+ var elem = l.shift(); // head
+ insertElement(elem, function(err, elem) {
+ if(err) { return cb(err); }
+ console.log(elem + ' inserted');
+ insertAll(l, cb);
+ });
+});
+
+insertAll([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function() {
+ console.log('done');
+});

0 comments on commit 9361823

Please sign in to comment.
Something went wrong with that request. Please try again.