Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 967 Bytes

README.md

File metadata and controls

47 lines (37 loc) · 967 Bytes

elm-konami-code

Use the Konami Code to do awesome (or boring) stuff on your website.

Installation

elm-package install ahstro/elm-konami-code

Usage

import KonamiCode exposing (KonamiCode)

type alias Model =
    { konamiCode : KonamiCode
    }

type Msg
    = KonamiCodeMsg KonamiCode.Msg

init : ( Model, Cmd Msg )
init =
    ( { konamiCode = KonamiCode.init }
    , Cmd.none
    )

update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        KonamiCodeMsg msg ->
            let
                ( newModel, konamiCodeEntered ) =
                    KonamiCode.update msg model
            in
            ( { newModel
                | showEasterEgg =
                    model.showEasterEgg || konamiCodeEntered
              }
            , Cmd.none
            )

subscriptions : Model -> Sub Msg
subscriptions model =
    KonamiCode.subscribe KonamiCodeMsg