Skip to content

Instantly share code, notes, and snippets.

Created July 24, 2013 20:11
Show Gist options
  • Save anonymous/6074092 to your computer and use it in GitHub Desktop.
Save anonymous/6074092 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', 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