-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
83 additions
and
48 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
{ "presets": ["es2015"] } | ||
{ | ||
"presets": [ "es2015" ] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dist/ | ||
node_modules/ | ||
.vscode/ | ||
.vscode/ | ||
.vagrant/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = "minimal/trusty64" | ||
|
||
config.vm.network "forwarded_port", guest: 6701, host: 6701 | ||
|
||
config.vm.synced_folder ".", "/todo-app" | ||
|
||
config.vm.provider "virtualbox" do |vb| | ||
vb.memory = "1024" | ||
vb.customize ["modifyvm", :id, "--usb", "off"] | ||
vb.customize ["modifyvm", :id, "--usbehci", "off"] | ||
end | ||
|
||
config.vm.provision "shell", inline: <<-SHELL | ||
sudo apt-get update | ||
sudo apt-get install -y curl | ||
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | ||
sudo apt-get install -y nodejs | ||
sudo apt-get install -y build-essential | ||
SHELL | ||
end |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
module.exports = element => { | ||
const renderForm = element => { | ||
element.innerHTML = `<input id="new-todo" /> | ||
<button onclick="(function () { | ||
var input = document.getElementById('new-todo'); | ||
actions.add(input.value); | ||
input.value=null; | ||
}())">Submit</button>`; | ||
}; | ||
input.focus(); | ||
}())">Add To-Do</button>`; | ||
}; | ||
|
||
module.exports = renderForm; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<body> | ||
<div id="flash"></div> | ||
<div id="todo-list"></div> | ||
<div id="todo-form"></div> | ||
<div id="todo-list"></div> | ||
<script src="app.js"></script> | ||
</body> | ||
</body> |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
'use strict'; | ||
|
||
const polling = new Set(); | ||
|
||
module.exports = { | ||
subscribe(callback) { | ||
polling.add(callback); | ||
return () => polling.delete(callback); | ||
return () => { | ||
callback.DONE = true; | ||
}; | ||
}, | ||
publish(message) { | ||
polling.forEach(cb => cb(message)); | ||
polling.forEach(cb => { | ||
if (cb.DONE !== true) { | ||
cb(message); | ||
} | ||
}); | ||
polling.clear(); | ||
} | ||
}; |
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