Skip to content

Commit

Permalink
separate Node.js and web browser examples
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Aug 8, 2017
1 parent 25e07c7 commit 87880f6
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 41 deletions.
26 changes: 0 additions & 26 deletions example/browser.html

This file was deleted.

10 changes: 0 additions & 10 deletions example/wildcards.js

This file was deleted.

26 changes: 26 additions & 0 deletions examples/browser/colors.html
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>debug()</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../../dist/debug.js"></script>
<script>
debug.enable('*')

for (var i=0; i < debug.colors.length; i++) {
debug('example:' + i)('The color is %o', debug.colors[i])
}
</script>
<style type="text/css">
body {
padding-top: 100px;
text-align: center;
}
</style>
</head>
<body>
Open your
<strong>Web Inspector</strong>
to see the <code>debug</code> output
</body>
</html>
4 changes: 2 additions & 2 deletions example/app.js → examples/node/app.js
@@ -1,5 +1,5 @@

var debug = require('../')('http')
var debug = require('../../')('http')
, http = require('http')
, name = 'My App';

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

// fake worker of some kind

require('./worker');
require('./worker');
7 changes: 7 additions & 0 deletions examples/node/colors.js
@@ -0,0 +1,7 @@
var debug = require('../../')

debug.enable('*')

for (var i=0; i < debug.colors.length; i++) {
debug('example:' + i)('The color is %o', debug.colors[i])
}
2 changes: 1 addition & 1 deletion example/stdout.js → examples/node/stdout.js
@@ -1,4 +1,4 @@
var debug = require('../');
var debug = require('../../');
var error = debug('app:error');

// by default stderr is used
Expand Down
10 changes: 10 additions & 0 deletions examples/node/wildcards.js
@@ -0,0 +1,10 @@

var debug = {
foo: require('../../')('test:foo'),
bar: require('../../')('test:bar'),
baz: require('../../')('test:baz')
};

debug.foo('foo')
debug.bar('bar')
debug.baz('baz')
4 changes: 2 additions & 2 deletions example/worker.js → examples/node/worker.js
Expand Up @@ -4,8 +4,8 @@
// DEBUG=worker:a node example/worker
// DEBUG=worker:b node example/worker

var a = require('../')('worker:a')
, b = require('../')('worker:b');
var a = require('../../')('worker:a')
, b = require('../../')('worker:b');

function work() {
a('doing lots of uninteresting work');
Expand Down

0 comments on commit 87880f6

Please sign in to comment.