Skip to content

Instantly share code, notes, and snippets.

@TylorS
Last active February 27, 2016 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TylorS/7fcb7be2655f75ea0372 to your computer and use it in GitHub Desktop.
Save TylorS/7fcb7be2655f75ea0372 to your computer and use it in GitHub Desktop.
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