Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 974 Bytes

README.md

File metadata and controls

28 lines (20 loc) · 974 Bytes

cljs-asynchronize

Asynchronize is a clojurescript macro that allows you to wrap arbitary blocks of code to execute that will treat functions requiring callbacks as first class functions. This allows clojure code to be written in a serial fashion without having to nest callback functions.

Installation

In order to use Asynchronize you must import both core.async, the go macro, and the asynchronize macro itself.

(:require [cljs.core.async])
(:require-macros [cljs-asynchronize.macros :as dm :refer [asynchronize]]
                 [cljs.core.async.macros :as am :refer [go]]))

Usage

Use the 'asynchronize' macro to wrap blocks of code which contain callback based functions, replacing the callback parameter with an elipsis '...':

(asynchronize
  (def res (.get http "http://www.google.com" ...))
  (console/log res))

More examples can be found in examples