Skip to content

Instantly share code, notes, and snippets.

@s9tpepper
Forked from anonymous/gist:6074092
Created July 24, 2013 20:18
Show Gist options
  • Save s9tpepper/6074153 to your computer and use it in GitHub Desktop.
Save s9tpepper/6074153 to your computer and use it in GitHub Desktop.
var BuyThisWorld = function BuyThisWorld(callback) {
this.browser = document.querySelector('iframe');
callback();
};
// DSL
BuyThisWorld.prototype.test = function(callback) {
if (this.browser.contentDocument.querySelector('p').innerText === "Yup") {
callback;
}
else {
callback.fail();
}
};
// helpers
BuyThisWorld.prototype.visit = function(url, callback) {
this.browser.addEventListener('load', function () {
callback();
});
// src after to avoid instant load problem
this.browser.src = url;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment