Message component for Respo apps.
Demo http://repo.respo.site/message/
[respo/message "0.3.1"]
You will need:
respo-message.action/message-action?
respo-message.action/create
respo-message.action/clear
respo-message.action/remove-one
respo-message.updater/update-messages
respo-message.comp.messages/comp-messages
To mount component and show a message, by default it shows for 4 seconds:
(comp-messages (:messages store) {:bottom? true})
(dispatch! action/create {:text (lorem-ipsum), :token "xxx"}))
(dispatch! action/remove-one {:token "xxx"})
Messages can be removed with :id
or :token
, where :token
is what you can generate.
Sorry but the component gets even harder to setup:
(defn dispatch! [op op-data]
(println "dispatch!" op op-data)
(let [op-id (.generate shortid), op-time (.now js/Date), store @*store]
(reset!
*store
(cond
(= op :states) (update store :states (mutate op-data))
(action/message-action? op)
(update store :messages #(update-messages % op op-data op-id op-time))
:else (do (println "Unhandled operation:" op) store)))))
Workflow https://github.com/mvc-works/calcit-workflow
MIT
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close