Created
June 21, 2016 13:40
-
-
Save dbarjs/f96375a1d8d1f194f71403f8471da351 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
<!DOCTYPE html> | |
<html lang="pt-br"> | |
<meta charset="UTF-8"> | |
<title>Callback</title> | |
<meta name="viewport" | |
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/> | |
<script src="dist/js/villa.min.js"></script> | |
<link rel="stylesheet" href="dist/css/villa.min.css"/> | |
<!--[if lt IE 9]> | |
<link rel="stylesheet" type="text/css" href="dist/css/material-colors.css"/> | |
<link rel="stylesheet" type="text/css" href="dist/css/villa-cross.min.css"/> | |
<script src="dist/js/html5shiv.js"></script> | |
<script src="dist/js/html5shiv-printshiv.js"></script> | |
<script src="dist/js/classList.min.js"></script> | |
<![endif]--> | |
<style> | |
main { | |
height: 100vh; | |
} | |
</style> | |
<body> | |
<main id="app" class="flex justify-center align-center font-white"></main> | |
<script> | |
/* App */ | |
var App = (function () { | |
/** | |
* App constructor | |
* @constructor | |
*/ | |
function App(viewport) { | |
var self = this; | |
this.viewport = viewport; | |
this.auth = new AppAuth(); | |
this.auth.onStageChange = function (alert) { | |
console.log('HELLO!'); | |
if (alert) { | |
self.viewport.innerHTML = alert.message; | |
self.viewport.classList.toggle(alert.className); | |
setTimeout(self.auth.onReturn, 500); | |
} | |
}; | |
} | |
App.prototype.init = function () { | |
this.auth.init(); | |
}; | |
return App; | |
})(); | |
</script> | |
<script> | |
/* AppAuth */ | |
var AppAuth = (function () { | |
/** | |
* AppAuth constructor | |
* @constructor | |
*/ | |
function AppAuth() { | |
this.onReturn = function () { | |
alert('RETORNOU!'); | |
}; | |
this.onStageChange = false; | |
this.alert = { | |
className: 'blue', | |
message: 'WAKE UP YOUR ASSHOLE!' | |
}; | |
} | |
AppAuth.prototype.init = function () { | |
var self = this; | |
setTimeout(function () { | |
if (self.onStageChange) | |
self.onStageChange(self.alert); | |
}, 3000); | |
}; | |
return AppAuth; | |
})(); | |
</script> | |
<script> | |
var app = new App(document.getElementById('app')); | |
app.init(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment