Module

Autocomplete

Package
purescript-autocomplete
Repository
jane/purescript-autocomplete

#SuggesterSettings Source

type SuggesterSettings a = { api :: SuggestionApi a, inputDebounce :: Milliseconds, inputTransformer :: Terms -> Terms }

#SuggesterEffects Source

type SuggesterEffects e a = Eff (ajax :: AJAX, channel :: CHANNEL, err :: EXCEPTION | e) a

All effects induced by a suggester during its lifespan.

#SuggesterInstance Source

type SuggesterInstance e a = SuggesterEffects e { send :: Terms -> SuggesterEffects e Unit, subscribe :: (Suggestions a -> SuggesterEffects e Unit) -> SuggesterEffects e Unit }

A suggester instance has a send function for providing new terms and a subscribe function for listening for new suggestions. The subscribe function will always be called with the most up to date suggestions for the latest terms sent, even if a previous search is slow to complete. Subscribers immediately receive the most recent result set.

#mkSuggester Source

mkSuggester :: forall a e. Eq a => DecodeJson a => String -> SuggesterInstance e a

Create a suggester with the default API backend: Affjax.get & decodeJson, no input debounce, and no input transformations.

#mkSuggester' Source

mkSuggester' :: forall a e. Eq a => SuggesterSettings a -> SuggesterInstance e a

Create a suggester with an alternate API backend.