Skip to content

Commit

Permalink
ui/agent: partial bundle injection
Browse files Browse the repository at this point in the history
  • Loading branch information
andreypopp committed Nov 18, 2013
1 parent 92c359a commit 34101d4
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions ui/agent.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
function update(data) {
if (data.styles)
updateStyles(data.styles);
updateStyles(data.styles);
updateDeps(data.deps);
updateCode(data.component);
}

function updateDeps(deps) {
if (!deps) return;

deps.sort();

var host = document.getElementById('deps');
if (!host) {
host = document.createElement('script');
host.id = 'deps';
document.head.appendChild(host);
}
host.src = '/browserify/partial?modules=' +
encodeURIComponent(deps.join(' '));
}

function updateStyles(styles) {
if (!styles) return;

var host = document.getElementById('styles');
if (!host) {
host = document.createElement('style');
Expand Down

0 comments on commit 34101d4

Please sign in to comment.