Skip to content

Instantly share code, notes, and snippets.

@dbarjs
Created June 21, 2016 13:40
Show Gist options
  • Save dbarjs/f96375a1d8d1f194f71403f8471da351 to your computer and use it in GitHub Desktop.
Save dbarjs/f96375a1d8d1f194f71403f8471da351 to your computer and use it in GitHub Desktop.
<!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