Last active
February 27, 2016 15:11
-
-
Save TylorS/7fcb7be2655f75ea0372 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
import {div, thunk} from '@motorcycle/dom' | |
function googleMaps(center, zoom) { | |
return div({ | |
hook: { | |
insert({elm}) { | |
const map = new google.maps.Map(elm, { | |
center, | |
zoom, | |
}) | |
}, | |
update(oldVNode, newVNode) { | |
// compare the oldVnode against the newVNode | |
// update whatever you need based on the new state | |
}, | |
} | |
}) | |
} | |
function view(state$) { | |
return state$.map(state => { | |
div([ | |
thunk('map', googleMaps, state.counter, state.zoom) | |
]) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment