hyperdrive-ui
Advanced tools
Comparing version 2.0.0 to 2.0.1
24
index.js
@@ -10,4 +10,3 @@ var path = require('path') | ||
var root = opts.root || '/' | ||
var dirs = {} | ||
var entries = [] | ||
var entries = {} | ||
@@ -21,6 +20,14 @@ function clicky (ev, entry) { | ||
var tree = yofs(root, entries, clicky) | ||
var tree = yofs(root, [], clicky) | ||
function update () { | ||
var fresh = tree.render(root, entries, clicky) | ||
// super inefficient. yo-fs should probably have a .add(entry) | ||
// function instead of recomputing the entry list every time | ||
var vals = [] | ||
for (var key in entries) { | ||
if (entries.hasOwnProperty(key)) { | ||
vals.push(entries[key]) | ||
} | ||
} | ||
var fresh = tree.render(root, vals, clicky) | ||
yo.update(tree.widget, fresh) | ||
@@ -34,11 +41,10 @@ } | ||
} | ||
entries.push(entry) | ||
entries[entry.name] = entry | ||
var dir = path.dirname(entry.name) | ||
if (!dirs[dir]) { | ||
entries.push({ | ||
if (!entries[dir]) { | ||
entries[dir] = { | ||
type: 'directory', | ||
name: dir, | ||
length: 0 | ||
}) | ||
dirs[dir] = true | ||
} | ||
} | ||
@@ -45,0 +51,0 @@ update() |
{ | ||
"name": "hyperdrive-ui", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Render a hyperdrive in the browser.", | ||
@@ -22,3 +22,6 @@ "main": "index.js", | ||
"url": "https://github.com/karissa/hyperdrive-ui/issues" | ||
}, | ||
"devDependencies": { | ||
"standard": "^7.1.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
46
0
3039
1
9