Skip to content

Commit 442ee5e

Browse files
substacksubstack
substack
authored and
substack
committed
browserify example
1 parent 8bc1ac6 commit 442ee5e

File tree

7 files changed

+52
-0
lines changed

7 files changed

+52
-0
lines changed

browser/data.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[1,2,3,4]

browser/error.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = 500
2+
3+
setTimeout(function () {
4+
throw new Error('whatever')
5+
}, 1000)

browser/hello.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HI THERE!!!!

browser/main.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var gamma = require('gamma')
2+
var foo = require('foo')
3+
console.log(require('./data.json'))
4+
var fs = require('fs')
5+
var xhr = require('xhr')
6+
xhr('/hello.txt', function (err, res, body) {
7+
console.log(body)
8+
})
9+
10+
var img = document.createElement('img')
11+
img.src = 'data:image/jpg;base64,'
12+
+ fs.readFileSync(__dirname + '/tinycat.jpg', 'base64')
13+
document.body.appendChild(img)
14+
15+
foo(3, function (err, n) {
16+
document.body.innerHTML += '<u>' + n + '</u>'
17+
})

browser/package.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"dependencies": {
3+
"brfs": "^1.4.3",
4+
"gamma": "^1.0.0",
5+
"glsl-noise": "0.0.0",
6+
"glslify": "^6.1.0",
7+
"level-browserify": "^1.1.1",
8+
"regl": "^1.3.0",
9+
"regl-camera": "^2.1.1",
10+
"webaudio": "^2.0.0",
11+
"xhr": "^2.4.0",
12+
"yo-yo": "^1.4.1",
13+
"yo-yoify": "^3.7.3"
14+
},
15+
"scripts": {
16+
"build": "browserify main.js > public/bundle.js",
17+
"watch": "watchify main.js -o public/bundle.js -dv"
18+
},
19+
"browserify": {
20+
"transform": [
21+
"brfs"
22+
]
23+
}
24+
}

browser/public/index.html

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<body>
2+
<h1>hi</h1>
3+
<script src="bundle.js"></script>
4+
</body>

browser/tinycat.jpg

39.1 KB
Loading

0 commit comments

Comments
 (0)