Atoms


class Atoms


Utility class wrapping simple and more commonly used atoms.

Summary

Public functions

java-static TransformingAtom.Transformer<Evaluation!, E!>!
<E> castOrDie(clazz: Class<E!>!)

Creates a transformer which will convert an Evaluation to a given type (or die trying).

java-static Atom<String!>!

Returns the value of document.location.href.

java-static Atom<String!>!

Returns the value of document.title.

java-static Atom<Evaluation!>!
script(script: String!)

Creates an atom that will execute the provided script and return an evaluation object.

java-static Atom<O!>!
<O> script(
    script: String!,
    transformer: TransformingAtom.Transformer<Evaluation!, O!>!
)

Creates an atom that will execute the provided script and return an object created by the given transformer.

java-static Atom<Evaluation!>!
scriptWithArgs(script: String!, args: (Mutable)List<Any!>!)

Creates an atom that will execute the provided script with the given non-contextual arguments.

java-static Atom<O!>!
<I, O> transform(
    in: Atom<I!>!,
    transformer: TransformingAtom.Transformer<I!, O!>!
)

Creates an atom which wraps the input atom and transforms its output using the given transformer.

Public functions

castOrDie

java-static fun <E> castOrDie(clazz: Class<E!>!): TransformingAtom.Transformer<Evaluation!, E!>!

Creates a transformer which will convert an Evaluation to a given type (or die trying).

getCurrentUrl

java-static fun getCurrentUrl(): Atom<String!>!

Returns the value of document.location.href.

getTitle

java-static fun getTitle(): Atom<String!>!

Returns the value of document.title.

script

java-static fun script(script: String!): Atom<Evaluation!>!

Creates an atom that will execute the provided script and return an evaluation object.

script

java-static fun <O> script(
    script: String!,
    transformer: TransformingAtom.Transformer<Evaluation!, O!>!
): Atom<O!>!

Creates an atom that will execute the provided script and return an object created by the given transformer.

scriptWithArgs

java-static fun scriptWithArgs(script: String!, args: (Mutable)List<Any!>!): Atom<Evaluation!>!

Creates an atom that will execute the provided script with the given non-contextual arguments.

transform

java-static fun <I, O> transform(
    in: Atom<I!>!,
    transformer: TransformingAtom.Transformer<I!, O!>!
): Atom<O!>!

Creates an atom which wraps the input atom and transforms its output using the given transformer.