Hologram.JS (hologram v0.9.2)

Copy Markdown View Source

Summary

Functions

Calls a function from the current scope (imported binding or global).

Calls a method on a JS receiver.

Deletes a property from a JS receiver.

Dispatches a JavaScript event on a target element.

Evaluates a JavaScript expression and returns the result.

Executes JavaScript code.

Gets a property from a JS receiver.

Checks if a value is an instance of a JS class.

Imports the default JS export and binds it to a name that can be used as a receiver in other JS functions. The :as option is required.

Imports a named JS export and binds it to a name that can be used as a receiver in other JS functions.

Instantiates a JS class.

Sets a property on a JS receiver.

Provides a convenient syntax for executing JavaScript code using the ~JS sigil.

Returns the JavaScript type of a value.

Functions

call(function, args)

(macro)

Calls a function from the current scope (imported binding or global).

call(receiver, method, args)

(macro)

Calls a method on a JS receiver.

delete(receiver, property)

(macro)

Deletes a property from a JS receiver.

dispatch_event(target, name)

(macro)

Dispatches a JavaScript event on a target element.

dispatch_event(target, name, opts)

(macro)

dispatch_event(target, type, name, opts)

(macro)

eval(expression)

@spec eval(String.t()) :: any()

Evaluates a JavaScript expression and returns the result.

exec(code)

@spec exec(String.t()) :: any()

Executes JavaScript code.

get(receiver, property)

(macro)

Gets a property from a JS receiver.

instanceof(value, class)

(macro)

Checks if a value is an instance of a JS class.

js_import(opts)

(macro)

Imports the default JS export and binds it to a name that can be used as a receiver in other JS functions. The :as option is required.

Examples

js_import from: "chart.js", as: :Chart

js_import(export, opts)

(macro)

Imports a named JS export and binds it to a name that can be used as a receiver in other JS functions.

Examples

js_import :Chart, from: "chart.js"
js_import :Chart, from: "chart.js", as: :MyChart

new(class, args)

(macro)

Instantiates a JS class.

set(receiver, property, value)

(macro)

Sets a property on a JS receiver.

sigil_JS(code, list)

@spec sigil_JS(String.t(), []) :: :ok

Provides a convenient syntax for executing JavaScript code using the ~JS sigil.

typeof(value)

(macro)

Returns the JavaScript type of a value.