Skip to content

Instantly share code, notes, and snippets.

@robert-chiniquy
Created October 11, 2015 23:48
Show Gist options
  • Save robert-chiniquy/f7c59d14b92bf0985ef2 to your computer and use it in GitHub Desktop.
Save robert-chiniquy/f7c59d14b92bf0985ef2 to your computer and use it in GitHub Desktop.
Window load event in smokestack?
#! /usr/bin/env node
var Readable = require('stream').Readable;
var browserify = require('browserify');
var smokestack = require('smokestack');
var setup = new Readable();
setup.push((function() {
var content = document.createElement('div');
content.appendChild(document.createTextNode("So far so good"));
document.body.appendChild(content);
console.log('Try both window.onload and window.addEventListener');
window.onload = function() {
console.log('Hello from window.onload');
};
window.addEventListener("load", function () {
console.log('Hello from addEventListener');
});
}).toString().slice(13,-1));
setup.push(null);
browserify(setup)
.bundle()
.pipe(smokestack())
.pipe(process.stdout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment