Advertisement
Guest User

Untitled

a guest
May 26th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function intent(domSources) {
  2.   return domSources.select('.field').events('input')
  3.   .map(ev => ev.target.value)
  4. }
  5.  
  6. function model(action) {
  7.   return action.map(inputValue => inputValue).startWith(‘’)
  8. }
  9.  
  10. function view(state$) {
  11.   return state$.map(state =>(div([‘Twój stan aplikacji:+ state]))
  12. }
  13.  
  14. function main(sources) {
  15.   const action = intent(sources.DOM)
  16.   const state$ = model(action)
  17.   const vdom$ = view(state$)
  18.   return { DOM: vdom$ }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement