Skip to content

dirv/might-i-suggest

Repository files navigation

might-i-suggest

A ClojureScript library to add autosuggest capability to a textbox, given a local copy of the search data. The library performs no network requests.

Example

(def search-data [
  ["My first page title" "/my-site/first-page-title"]
  ["My second page title" "/my-site/second-page-title"]
  ["Something else" "/something-else"]])

; define your select-function
(defn select-fn [url]
  (.fetch js/window url))

(let [handler (make-autosuggest-on-change-handler-fn search-data select-fn)]
  (.addEventListener text-box handler))
  • Matches are searched for each word with three or more characters.
  • Results are ordered according to the order they appear in the search-data array.

Running tests

npm install
clj -Atest

Building

clj -m cljs.main -c might-i-suggest.core

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published