Created
July 24, 2013 20:11
-
-
Save anonymous/6074092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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