Comparing version 0.2.0 to 0.3.0
@@ -5,4 +5,10 @@ /* jshint node: true */ | ||
/** | ||
## defaults(target, *) | ||
## cog/defaults | ||
```js | ||
var defaults = require('cog/defaults'); | ||
``` | ||
### defaults(target, *) | ||
Shallow copy object properties from the supplied source objects (*) into | ||
@@ -13,4 +19,2 @@ the target object, returning the target object once completed. Do not, | ||
```js | ||
var defaults = require('cog/extend'); | ||
defaults({ a: 1, b: 2 }, { c: 3 }, { d: 4 }, { b: 5 })); | ||
@@ -17,0 +21,0 @@ ``` |
@@ -5,4 +5,10 @@ /* jshint node: true */ | ||
/** | ||
## extend(target, *) | ||
## cog/extend | ||
```js | ||
var extend = require('cog/extend'); | ||
``` | ||
### extend(target, *) | ||
Shallow copy object properties from the supplied source objects (*) into | ||
@@ -12,4 +18,2 @@ the target object, returning the target object once completed: | ||
```js | ||
var extend = require('cog/extend'); | ||
extend({ a: 1, b: 2 }, { c: 3 }, { d: 4 }, { b: 5 })); | ||
@@ -16,0 +20,0 @@ ``` |
@@ -7,7 +7,2 @@ /** | ||
[ | ||
![browser support] | ||
(https://ci.testling.com/DamonOehlman/cog.png) | ||
](https://ci.testling.com/DamonOehlman/cog) | ||
## Why would I want to use browserify? | ||
@@ -14,0 +9,0 @@ |
@@ -7,4 +7,10 @@ /* jshint node: true */ | ||
/** | ||
## listen(target, events, capture?) | ||
## cog/listen | ||
```js | ||
var listen = require('cog/listen'); | ||
``` | ||
### listen(target, events, capture?) | ||
The `listen` function of cog provides a mechanism for capturing specific | ||
@@ -11,0 +17,0 @@ events (named in the events array) and routing them through an |
@@ -7,2 +7,6 @@ /* jshint node: true */ | ||
```js | ||
var logger = require('cog/logger'); | ||
``` | ||
Simple browser logging offering similar functionality to the | ||
@@ -16,3 +20,2 @@ [debug](https://github.com/visionmedia/debug) module. | ||
```js | ||
var logger = require('cog/logger'); | ||
var debug = logger('phil'); | ||
@@ -41,3 +44,3 @@ ``` | ||
### logger reference | ||
### Reference | ||
**/ | ||
@@ -44,0 +47,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"tags": [], | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"dependencies": {}, | ||
@@ -20,3 +20,3 @@ "devDependencies": { | ||
"scripts": { | ||
"gendocs": "sourcecat | emu > README.md", | ||
"gendocs": "gendocs > README.md", | ||
"test": "$(npm bin)/tape test/all.js" | ||
@@ -23,0 +23,0 @@ }, |
117
README.md
@@ -6,7 +6,10 @@ # cog | ||
[ | ||
![browser support] | ||
(https://ci.testling.com/DamonOehlman/cog.png) | ||
](https://ci.testling.com/DamonOehlman/cog) | ||
[![NPM](https://nodei.co/npm/cog.png)](https://nodei.co/npm/cog/) | ||
[![Build Status](https://travis-ci.org/DamonOehlman/cog.png?branch=master)](https://travis-ci.org/DamonOehlman/cog) | ||
[![browser support](https://ci.testling.com/DamonOehlman/cog.png)](https://ci.testling.com/DamonOehlman/cog) | ||
## Why would I want to use browserify? | ||
@@ -53,4 +56,10 @@ | ||
## defaults(target, *) | ||
## cog/defaults | ||
```js | ||
var defaults = require('cog/defaults'); | ||
``` | ||
### defaults(target, *) | ||
Shallow copy object properties from the supplied source objects (*) into | ||
@@ -61,4 +70,2 @@ the target object, returning the target object once completed. Do not, | ||
```js | ||
var defaults = require('cog/extend'); | ||
defaults({ a: 1, b: 2 }, { c: 3 }, { d: 4 }, { b: 5 })); | ||
@@ -70,4 +77,10 @@ ``` | ||
## extend(target, *) | ||
## cog/extend | ||
```js | ||
var extend = require('cog/extend'); | ||
``` | ||
### extend(target, *) | ||
Shallow copy object properties from the supplied source objects (*) into | ||
@@ -77,4 +90,2 @@ the target object, returning the target object once completed: | ||
```js | ||
var extend = require('cog/extend'); | ||
extend({ a: 1, b: 2 }, { c: 3 }, { d: 4 }, { b: 5 })); | ||
@@ -85,4 +96,10 @@ ``` | ||
## listen(target, events, capture?) | ||
## cog/listen | ||
```js | ||
var listen = require('cog/listen'); | ||
``` | ||
### listen(target, events, capture?) | ||
The `listen` function of cog provides a mechanism for capturing specific | ||
@@ -97,2 +114,65 @@ events (named in the events array) and routing them through an | ||
## cog/logger | ||
```js | ||
var logger = require('cog/logger'); | ||
``` | ||
Simple browser logging offering similar functionality to the | ||
[debug](https://github.com/visionmedia/debug) module. | ||
### Usage | ||
Create your self a new logging instance and give it a name: | ||
```js | ||
var debug = logger('phil'); | ||
``` | ||
Now do some debugging: | ||
```js | ||
debug('hello'); | ||
``` | ||
At this stage, no log output will be generated because your logger is | ||
currently disabled. Enable it: | ||
```js | ||
logger.enable('phil'); | ||
``` | ||
Now do some more logger: | ||
```js | ||
debug('Oh this is so much nicer :)'); | ||
// --> phil: Oh this is some much nicer :) | ||
``` | ||
### Reference | ||
#### logger(name) | ||
Create a new logging instance. | ||
#### logger.reset() | ||
Reset logging (remove the default console logger, flag all loggers as | ||
inactive, etc, etc. | ||
#### logger.to(target) | ||
Add a logging target. The logger must have a `log` method attached. | ||
#### logger.enable(names*) | ||
Enable logging via the named logging instances. To enable logging via all | ||
instances, you can pass a wildcard: | ||
```js | ||
logger.enable('*'); | ||
``` | ||
__TODO:__ wildcard enablers | ||
## qsa(selector, element) | ||
@@ -105,1 +185,16 @@ | ||
but perhaps not quite as terse. | ||
## cog/raf | ||
Request animation frame helper: | ||
```js | ||
var raf = require('cog/raf'); | ||
function animate() { | ||
console.log('animating'); | ||
raf(animate); // go again | ||
} | ||
raf(animate); | ||
``` |
require('./defaults'); | ||
require('./extend'); | ||
require('./listen'); | ||
require('./listen'); | ||
require('./logger'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19912
19
394
193