Skip to content

Instantly share code, notes, and snippets.

@FruitieX
Created March 23, 2018 17:36
Show Gist options
  • Save FruitieX/dc8d06e3d4cfa3a9e3e99ebb9102f106 to your computer and use it in GitHub Desktop.
Save FruitieX/dc8d06e3d4cfa3a9e3e99ebb9102f106 to your computer and use it in GitHub Desktop.
eval :: Query ~> H.ComponentDSL FrontendState Query Message (Aff _)
-- Handle initialization
eval (Init next) = do
-- Initialize YouTube player
player <- liftAff $ YT.initPlayer "player"
-- Player's 'onReady' handler, here we should call updatePlayerState with the *current* state
(\p -> do
let (state :: FrontendState) = H.get -- This won't work as we're in Eff here... :(
launchAff_ $ updatePlayerState state p
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment