Created
January 20, 2016 19:48
-
-
Save verekia/0c73cc6558e92906223a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
define(['Views/AddView', 'Models/User'], function(AddView, User){ | |
function start(){ | |
AddView.render(); | |
bindEvents(); | |
} | |
function bindEvents(){ | |
document.getElementById('add').addEventListener('click', function(){ | |
var users = JSON.parse(localStorage.users); | |
var userName = document.getElementById('user-name').value; | |
users.push(new User(userName)); | |
localStorage.users = JSON.stringify(users); | |
require(['Controllers/ListController'], function(ListController){ | |
ListController.start(); | |
}); | |
}, false); | |
} | |
return { | |
start:start | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment