Fix browser example

This commit is contained in:
haad 2016-10-04 09:48:01 +02:00
parent 84e984a4cb
commit 1c1668c207
3 changed files with 13 additions and 9 deletions

1
.gitignore vendored
View File

@ -7,5 +7,6 @@ dump.rdb
Vagrantfile Vagrantfile
orbit-db-cache.json orbit-db-cache.json
examples/browser/bundle.js examples/browser/bundle.js
examples/browser/*.map
dist/*.map dist/*.map
dist/orbitdb.js dist/orbitdb.js

View File

@ -16,7 +16,7 @@ try {
const log = orbit.eventlog(channel + ".log") const log = orbit.eventlog(channel + ".log")
const counter = orbit.counter(channel + ".count") const counter = orbit.counter(channel + ".count")
const creatures = ['👻', '🤖', '🐬', '🐞', '🐈'] const creatures = ['👻', '🐙', '🐷', '🐬', '🐞', '🐈', '🙉', '🐸', '🐓']
let count = 1 let count = 1
const query = () => { const query = () => {
@ -38,18 +38,20 @@ try {
const count = counter.value() const count = counter.value()
const output = const output =
` `<b>Key-Value Store</b>
--------------------------------------------------- ---------------------------------------------------
Key | Value Key | Value
--------------------------------------------------- ---------------------------------------------------
${key} | ${result} ${key} | ${result}
--------------------------------------------------- ---------------------------------------------------
<b>Eventlog</b>
--------------------------------------------------- ---------------------------------------------------
Latest Visitors Latest Visitors
--------------------------------------------------- ---------------------------------------------------
${latest.reverse().map((e) => e.payload.value).join('\n')} ${latest.reverse().map((e) => e.payload.value + " - " + new Date(e.payload.meta.ts).toISOString()).join('\n')}
<b>Counter</b>
--------------------------------------------------- ---------------------------------------------------
Visitor Count: ${count} Visitor Count: ${count}
--------------------------------------------------- ---------------------------------------------------

View File

@ -8,16 +8,17 @@ module.exports = {
output: { output: {
filename: './examples/browser/bundle.js' filename: './examples/browser/bundle.js'
}, },
devtool: 'sourcemap',
node: { node: {
console: false, console: false,
process: 'mock', process: 'mock',
Buffer: true Buffer: true
}, },
plugins: [ plugins: [
// new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({
// mangle: false, mangle: false,
// compress: { warnings: false } compress: { warnings: false }
// }) })
], ],
resolve: { resolve: {
modules: [ modules: [
@ -40,7 +41,7 @@ module.exports = {
}, },
{ {
test: /\.js$/, test: /\.js$/,
include: /node_modules\/(hoek|qs|wreck|boom|log|orbit.+|logplease|crdts|promisify-es|whatwg-fetch|node-fetch|isomorphic-fetch|db\.js)/, include: /node_modules\/(hoek|qs|wreck|boom|ipfs.+|orbit.+|logplease|crdts|promisify-es|whatwg-fetch|node-fetch|isomorphic-fetch|db\.js)/,
loader: 'babel', loader: 'babel',
query: { query: {
presets: require.resolve('babel-preset-es2015'), presets: require.resolve('babel-preset-es2015'),