Liking cljdoc? Tell your friends :D

applied-science.js-interop

cljs

A JavaScript-interop library for ClojureScript.

A JavaScript-interop library for ClojureScript.
raw docstring

!assoc-in!clj/smacro

(!assoc-in! obj ks v)
source

!getclj/smacro

(!get & args)
source

!get-inclj/smacro

(!get-in obj ks)
source

!setclj/smacro

(!set obj & keyvals)
source

!updateclj/smacro

(!update obj k f & args)
source

applyclj/s≠

(apply obj k arg-array)
cljs

Apply function k of obj, binding this to obj.

(j/apply o :someFunction #js [arg1 arg2])
(j/apply o .-someFunction #js [arg1 arg2])
Apply function `k` of `obj`, binding `this` to `obj`.

```
(j/apply o :someFunction #js [arg1 arg2])
(j/apply o .-someFunction #js [arg1 arg2])
```
source (clj)source (cljs)raw docstring

apply-inclj/s≠

(apply-in obj ks arg-array)
cljs

Apply function nested at path with arg-array, binding this to its parent object.

(j/apply-in o [:x :someFunction] arg1 arg2)
Apply function nested at `path` with `arg-array`, binding `this` to its parent object.

```
(j/apply-in o [:x :someFunction] arg1 arg2)
```
source (clj)source (cljs)raw docstring

assoc!clj/s≠

(assoc! obj & keyvals)
cljs

Sets key-value pairs on obj, returns obj.

(j/assoc! o :x 10)
(j/assoc! o .-x 10)
Sets key-value pairs on `obj`, returns `obj`.

```
(j/assoc! o :x 10)
(j/assoc! o .-x 10)
```
source (clj)source (cljs)raw docstring

assoc-in!clj/s≠

(assoc-in! obj ks v)
cljs

Mutates the value in a nested object structure, where ks is a sequence of keys and v is the new value. If any levels do not exist, objects will be created.

(j/assoc-in! o [:x :y] 10)
(j/assoc-in! o [.-x .-y] 10)
Mutates the value in a nested object structure, where ks is a
sequence of keys and v is the new value. If any levels do not
exist, objects will be created.

```
(j/assoc-in! o [:x :y] 10)
(j/assoc-in! o [.-x .-y] 10)
```
source (clj)source (cljs)raw docstring

callclj/s≠

(call obj k & args)
cljs

Call function k of obj, binding this to obj.

(j/call o :someFunction arg1 arg2)
(j/call o .-someFunction arg1 arg2)
Call function `k` of `obj`, binding `this` to `obj`.

```
(j/call o :someFunction arg1 arg2)
(j/call o .-someFunction arg1 arg2)
```
source (clj)source (cljs)raw docstring

call-inclj/s≠

(call-in obj ks & args)
cljs

Call function nested at path with args, binding this to its parent object.

(j/call-in o [:x :someFunction] arg1 arg2)
Call function nested at `path` with `args`, binding `this` to its parent object.

```
(j/call-in o [:x :someFunction] arg1 arg2)
```
source (clj)source (cljs)raw docstring

clj-litclj

(clj-lit x)

lit for Clojure target, only handles ~@unquote-splicing

lit for Clojure target, only handles ~@unquote-splicing
sourceraw docstring

contains?clj/s≠

(contains? obj k)
cljs

Returns true if obj contains k.

(j/contains? o :k)
(j/contains? o .-k)
Returns true if `obj` contains `k`.

```
(j/contains? o :k)
(j/contains? o .-k)
```
source (clj)source (cljs)raw docstring

defnclj/smacro

(defn & args)

defn with argument destructuring that supports js property and array access. Use ^:js metadata on binding forms to invoke.

`defn` with argument destructuring that supports js property and array access.
Use ^:js metadata on binding forms to invoke.
sourceraw docstring

extend!cljs

(extend! obj)
(extend! obj x)
(extend! obj x & more)

Extends obj with the properties of one or more objects, overwriting existing properties, moving left to right. Returns obj. An empty starting object is provided if obj is nil.

(j/extend! o other)
(j/extend! o other #js{:x 1})

Not IE6-friendly

Extends `obj` with the properties of one or more objects, overwriting
 existing properties, moving left to right. Returns `obj`.
 An empty starting object is provided if `obj` is nil.
```
(j/extend! o other)
(j/extend! o other #js{:x 1})
```
Not IE6-friendly
sourceraw docstring

fnclj/smacro

(fn & args)

fn with argument destructuring that supports js property and array access. Use ^:js metadata on binding forms to invoke. Eg/

(fn [^:js {:keys [a]}] …)

`fn` with argument destructuring that supports js property and array access.
Use ^:js metadata on binding forms to invoke. Eg/

(fn [^:js {:keys [a]}] …)
sourceraw docstring

getclj/s≠

(get k)
(get obj k)
(get obj k not-found)
cljs

Returns the value mapped to key, not-found or nil if key not present.

(j/get o :k)
(j/get o .-k)
Returns the value mapped to key, not-found or nil if key not present.

```
(j/get o :k)
(j/get o .-k)
```
source (clj)source (cljs)raw docstring

get-inclj/s≠

(get-in ks)
(get-in obj ks)
(get-in obj ks not-found)
cljs

Returns the value in a nested object structure, where ks is a sequence of keys. Returns nil if the key is not present, or the not-found value if supplied.

(j/get-in o [:x :y] :fallback-value)
(j/get-in o [.-x .-y] :fallback-value)
Returns the value in a nested object structure, where ks is
a sequence of keys. Returns nil if the key is not present,
or the not-found value if supplied.

```
(j/get-in o [:x :y] :fallback-value)
(j/get-in o [.-x .-y] :fallback-value)
```
source (clj)source (cljs)raw docstring

in?clj/smacro

(in? k obj)
source

letclj/smacro

(let bindings & body)

let with destructuring that supports js property and array access. Use ^:js metadata on the binding form to invoke. Eg/

(let [^:js {:keys [a]} obj] …)

`let` with destructuring that supports js property and array access.
Use ^:js metadata on the binding form to invoke. Eg/

(let [^:js {:keys [a]} obj] …)
sourceraw docstring

litclj/smacro

(lit form)

Recursively converts literal Clojure maps/vectors into JavaScript object/array expressions (using j/obj and cljs.core/array)

Recursively converts literal Clojure maps/vectors into JavaScript object/array expressions
(using j/obj and cljs.core/array)
sourceraw docstring

lit*clj

(lit* x)
(lit* {:as opts :keys [keyfn valfn env] :or {keyfn identity valfn litval*}} x)

Recursively converts literal Clojure maps/vectors into JavaScript object/array expressions

Options map accepts a :keyfn for custom key conversions.

Recursively converts literal Clojure maps/vectors into JavaScript object/array expressions

Options map accepts a :keyfn for custom key conversions.
sourceraw docstring

litval*clj

(litval* v)
source

lookupcljs

(lookup obj)

Wraps obj with an ILookup implementation, to support reading/destructuring. Does not support renamable keys.

(let [{:keys [a b c]} (j/lookup o)]
 ...)
Wraps `obj` with an ILookup implementation, to support reading/destructuring. Does not support renamable keys.

```
(let [{:keys [a b c]} (j/lookup o)]
 ...)
```
sourceraw docstring

objclj/s≠

(obj & keyvals)
cljs

Create JavaScript object from an even number arguments representing interleaved keys and values.

(obj :a 1 :b 2 .-c 3 .-d 4)
Create JavaScript object from an even number arguments representing
interleaved keys and values.

```
(obj :a 1 :b 2 .-c 3 .-d 4)
```
source (clj)source (cljs)raw docstring

push!clj/s≠

clj
(push! array v)
cljs
(push! array x)

Appends v to array and returns the mutated array.

(j/push! arr 10)
Appends `v` to `array` and returns the mutated array.

```
(j/push! arr 10)
```
source (clj)source (cljs)raw docstring

select-keysclj/s≠

(select-keys obj ks)
cljs

Returns an object containing only those entries in o whose key is in ks.

(j/select-keys o [:a :b :c])
(j/select-keys o [.-a .-b .-c])
Returns an object containing only those entries in `o` whose key is in `ks`.

```
(j/select-keys o [:a :b :c])
(j/select-keys o [.-a .-b .-c])
```
source (clj)source (cljs)raw docstring

some-orclj/smacro

(some-or x y)

Like or but switches on some? instead of truthiness.

Like `or` but switches on `some?` instead of truthiness.
sourceraw docstring

unchecked-getclj/s≠

clj
(unchecked-get obj k)
(unchecked-get obj k not-found)
cljs
(unchecked-get obj k)
source (clj)source (cljs)

unchecked-setclj/s

(unchecked-set obj & keyvals)
source (clj)source (cljs)

unshift!clj/s≠

clj
(unshift! array v)
cljs
(unshift! array x)

Prepends v to a and returns the mutated array.

(j/unshift! arr 10)
Prepends `v` to `a` and returns the mutated array.

```
(j/unshift! arr 10)
```
source (clj)source (cljs)raw docstring

update!clj/s≠

(update! obj k f & args)
cljs

'Updates' a value in a JavaScript object, where k is a key and f is a function that will take the old value and any supplied args and return the new value, which replaces the old value. If the key does not exist, nil is passed as the old value.

(j/update! o :a + 10)
(j/update! o .-a + 10)
'Updates' a value in a JavaScript object, where k is a key and
f is a function that will take the old value and any supplied
args and return the new value, which replaces the old value.
If the key does not exist, nil is passed as the old value.

```
(j/update! o :a + 10)
(j/update! o .-a + 10)
```
source (clj)source (cljs)raw docstring

update-in!clj/s≠

(update-in! obj ks f & args)
cljs

'Updates' a value in a nested object structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, mutating the nested structure. If any levels do not exist, objects will be created.

(j/update-in! o [:x :y] + 10)
(j/update-in! o [.-x .-y] + 10)
'Updates' a value in a nested object structure, where ks is a
sequence of keys and f is a function that will take the old value
and any supplied args and return the new value, mutating the
nested structure.  If any levels do not exist, objects will be
created.

```
(j/update-in! o [:x :y] + 10)
(j/update-in! o [.-x .-y] + 10)
```
source (clj)source (cljs)raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close