Skip to content

Commit 87880f6

Browse files
committedAug 8, 2017
separate Node.js and web browser examples
1 parent 25e07c7 commit 87880f6

File tree

8 files changed

+48
-41
lines changed

8 files changed

+48
-41
lines changed
 

‎example/browser.html

-26
This file was deleted.

‎example/wildcards.js

-10
This file was deleted.

‎examples/browser/colors.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>debug()</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6+
<script src="../../dist/debug.js"></script>
7+
<script>
8+
debug.enable('*')
9+
10+
for (var i=0; i < debug.colors.length; i++) {
11+
debug('example:' + i)('The color is %o', debug.colors[i])
12+
}
13+
</script>
14+
<style type="text/css">
15+
body {
16+
padding-top: 100px;
17+
text-align: center;
18+
}
19+
</style>
20+
</head>
21+
<body>
22+
Open your
23+
<strong>Web Inspector</strong>
24+
to see the <code>debug</code> output
25+
</body>
26+
</html>

‎example/app.js ‎examples/node/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
var debug = require('../')('http')
2+
var debug = require('../../')('http')
33
, http = require('http')
44
, name = 'My App';
55

@@ -16,4 +16,4 @@ http.createServer(function(req, res){
1616

1717
// fake worker of some kind
1818

19-
require('./worker');
19+
require('./worker');

‎examples/node/colors.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var debug = require('../../')
2+
3+
debug.enable('*')
4+
5+
for (var i=0; i < debug.colors.length; i++) {
6+
debug('example:' + i)('The color is %o', debug.colors[i])
7+
}

‎example/stdout.js ‎examples/node/stdout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var debug = require('../');
1+
var debug = require('../../');
22
var error = debug('app:error');
33

44
// by default stderr is used

‎examples/node/wildcards.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
var debug = {
3+
foo: require('../../')('test:foo'),
4+
bar: require('../../')('test:bar'),
5+
baz: require('../../')('test:baz')
6+
};
7+
8+
debug.foo('foo')
9+
debug.bar('bar')
10+
debug.baz('baz')

‎example/worker.js ‎examples/node/worker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// DEBUG=worker:a node example/worker
55
// DEBUG=worker:b node example/worker
66

7-
var a = require('../')('worker:a')
8-
, b = require('../')('worker:b');
7+
var a = require('../../')('worker:a')
8+
, b = require('../../')('worker:b');
99

1010
function work() {
1111
a('doing lots of uninteresting work');

0 commit comments

Comments
 (0)
Please sign in to comment.