Last active
January 28, 2016 19:18
-
-
Save chrisabrams/81a694de8195fcfa62a0 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
var spinner = `<div class="sk-wave"> | |
<div class="sk-rect sk-rect1"></div> | |
<div class="sk-rect sk-rect2"></div> | |
<div class="sk-rect sk-rect3"></div> | |
<div class="sk-rect sk-rect4"></div> | |
<div class="sk-rect sk-rect5"></div> | |
</div>` | |
var template = ` | |
<div id="wrapper"> | |
<header id="header" class="template-#{state}"> | |
<span>#{text.save}</span> | |
</header> | |
<aside id="aside"> | |
... | |
</aside> | |
</div> | |
` | |
var A = createContainer(document.getElementById('wrapper'), {}, function Areducer(state, action) { | |
switch(state.current) { | |
default: | |
return Object.assign({}, state, { | |
state: '', | |
text: { | |
save: 'Save' | |
} | |
}) | |
} | |
}) | |
A.innerHTML = template | |
A.update({current: null}) | |
var B = createContainer(document.getElementById('header'), {}, function Breducer(state, action) { | |
switch(state.current) { | |
case 'saving': | |
return Object.assign({}, state, { | |
state: `state-${state.current}`, | |
text: { | |
save: spinner | |
} | |
}) | |
default: | |
return Object.assign({}, state, { | |
state: '', | |
text: { | |
save: 'Save' | |
} | |
}) | |
} | |
}) | |
B.update({current: 'saving'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment