Skip to content

EwenG/flapjax-cljs

Repository files navigation

flapjax-cljs

A library to improve the experience of using flapjax from clojurescript.

Usage

Simply add flapjax-cljs as a dependency in you project.clj :

[com.ewen.flapjax-cljs "1.0.2"]

Changelog

See changelog

Features

  • Wraps the flapjax library in order to avoid the need to include flapjax in your `:libs` or `:extern` section when using cljsbuild.
  • Makes flapjax compatible with the google-closure compiler `:advanced` compilation mode.
  • Several flapjax functions are defined on prototypes. Flapjax-cljs wraps the flapjax functions in the `com.ewen.flapjax-cljs` namespace to make them plain functions. The original flapjax functions are still available in the `F` namespace.
  • Extends the `extractValueB` function to work on clojurescript atoms.
  • Helps to manipulate flapjax objects with the enfocus templating library. The `com.ewen.flapjax-cljs-macros.with-B` macro can be used to transform enfocus snippets into snippets that accept flapjax behavior objects as parameters. The snippet is automatically updated when the behaviors change.

Example

(def test-atom (atom {:a "a" :b "b"}))
(def atom-B (com.ewen.flapjax-cljs/extractValueB test-atom))
(com.ewen.flapjax-cljs/valueNow atom-B) ; => {:a "a" :b "b"}
(com.ewen.flapjax-cljs-macros/with-B
    (enfocus.macros/defsnippet test-snippet :compiled "test-resources/test.html" ["p"] [val1]
      ["p"] (em/content (:a val1))))
(.log js/console (test-snippet atom-B)) ; => <p>a</p>
(swap! test-atom #(assoc % :a "new-a"))
(com.ewen.flapjax-cljs/valueNow atom-B) ; => {:a "new-a" :b "b"}
(.log js/console (test-snippet atom-B)) ; => <p>new-a</p>

Licence

Distributed under the Eclipse Public License, the same as Clojure.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published