ulmus

所属分类:工具库
开发工具:Clojure
文件大小:0KB
下载次数:0
上传日期:2019-11-28 16:48:04
上 传 者sh-1993
说明:  Clojure的函数式 React编程库(脚本),
(A functional-reactive style programming library for Clojure(script),)

文件列表:
Makefile (350, 2019-06-24)
deps.edn (119, 2019-06-24)
pom.xml (1377, 2019-06-24)
resources/ (0, 2019-06-24)
resources/ulmus.svg (15024, 2019-06-24)
src/ (0, 2019-06-24)
src/ulmus/ (0, 2019-06-24)
src/ulmus/dom.cljs (500, 2019-06-24)
src/ulmus/keyboard.cljs (529, 2019-06-24)
src/ulmus/mouse.cljs (937, 2019-06-24)
src/ulmus/signal.cljc (11334, 2019-06-24)
src/ulmus/time.cljs (377, 2019-06-24)
src/ulmus/window.cljs (880, 2019-06-24)

--- Ulmus is a library for doing Functional Reactive Programming (FRP) in Clojure and Clojurescript. ### Usage `[ulmus "0.2.3"]` in `project.clj` or `{:deps {ulmus {:mvn/version "0.2.3"}}}` in `deps.edn` ### Introduction Ulmus is a library designed to facilitate a functional-reactive style of programming. It's primarily inspired by Elm and RX. Some of the API apes Elm although it makes no attempt to be complete or exclusive in doing so. Signals are the basic building blocks of ulmus. Conceptually, a signal is a datatype which holds a particular value. Signals can be composed with standard functional tooling (eg. map, filter, reduce), producing new, dependent, signals. Changing a signal's value causes all of it's dependent signals to update as well. So for the sake of illustration, we might define a signal representing the current position of the mouse. ```clojure (defn mouse-pos [] (let [sig-$ (ulmus/signal)] (.addEventListener js/body "mousemove" (fn [e] (ulmus/>! sig-$ [(.-clientX e) (.-clientY e)]))) sig-$)) (def position-$ (mouse-pos)) ``` We now have a signal, `position-$` which represents the current mouse position. Dereferencing the signal will return it's current value. ```clojure @position-$ ``` might return [640 480] for instance. Just like static data, signals can be composed, yielding new signals. So, ```clojure (def mouse-x-$ (ulmus/map first position-$)) ``` Signals can model functionally interactions that would otherwise require slipping into imperative coding. To better understand how these ideas might be applied to user interface see [Recurrent](https://github.com/jeremykross/recurrent). ### Examples Various examples can be found at https://jeremykross.github.io/recurrent-examples. ### API Docs [![cljdoc badge](https://cljdoc.org/badge/ulmus)](https://cljdoc.org/d/ulmus/ulmus/CURRENT) ### Status Ulmus is fairly well-tread at this point, but still beta quality. It shouldn't be relied on yet for anything mission critical. ### Todo * Spec ### Thanks The Ulmus logo was created by the eminently talented [@the_stritt](https://twitter.com/the_stritt). ### License Copyright 2019 Jeremy Kross Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

近期下载者

相关文件


收藏者