Idris2Doc : JS.Attribute

JS.Attribute

(source)

Definitions

dataAttribute : Bool-> (Type->Type) ->Type->Type
  A read-write attribute of a JS object.

@alwaysReturns : Bool index if the attribute's getter can
always return a value that is neither
`null` nor `undefined`. This means, that the
attribute is non-nullable and either mandatory
or optional with a proper default value.

@f : Context of values represented by the attribute.
This is `Maybe` if the attribute is nullable,
`Optional` if it is an optional attribute on
a dictionary type, or `id` if it is mandatory
and non-nullable.

@ : Type of values stored in the attribute

Totality: total
Visibility: public export
Constructors:
Attr : JSIOa-> (a->JSIO ()) ->AttributeTrueida
  A non-optional attribute.

This is for data types, which are guaranteed to always return
a value that is neither `null` nor `undefined`.
NullableAttr : JSIO (Maybea) -> (Maybea->JSIO ()) ->AttributeFalseMaybea
  A nullable, non-optional attribute.
OptionalAttr : JSIO (Optionala) -> (Optionala->JSIO ()) ->a->AttributeTrueOptionala
  An optional attribute with a predefined default value.
OptionalAttrNoDefault : JSIO (Optionala) -> (Optionala->JSIO ()) ->AttributeFalseOptionala
  An optional attribute without default value.
get : obj-> (obj->Attributebfa) ->JSIO (fa)
  Returns the value of an attribute in its proper context.
Typically used in infix notation.

```idris example
textField `get` value
```

Totality: total
Visibility: export
over : (a->b) ->Attributexfa->JSIO (fb)
  Maps a function over the value retrieved from an `Attribute`.

Totality: total
Visibility: export
to : (obj->Attributebfa) ->obj->JSIO (fa)
  Flipped version of `get`. This is useful when
combined with the bind operator:

```idris example
body >>= to className
```

Totality: total
Visibility: export
set' : Attributebfa->fa->JSIO ()
  Sets the value of an `Attribute`.

Totality: total
Visibility: export
getDef : obj-> (obj->AttributeTruefa) ->JSIOa
  Gets the value of an `Attribute`. Since this operates
on an `Attribute True`, it is guaranteed to always yield
a non-nullable value.

Totality: total
Visibility: export
overDef : (a->b) ->AttributeTruefa->JSIOb
  Maps a function over the value retrieved from an `Attribute`.
Since this operates
on an `Attribute True`, it is guaranteed to always yield
a non-nullable value.

Totality: total
Visibility: export
toDef : (obj->AttributeTruefa) ->obj->JSIOa
  Flipped version of `getDef`.

Totality: total
Visibility: export
set : Attributebfa->a->JSIO ()
  Sets the value of an `Attribute`.

```idris example
disabled btn `set` True
```

Totality: total
Visibility: export
mod : Attributebfa-> (a->a) ->JSIO ()
  Modifies the stored value of an `Attribute`.

Please note, that this will NOT change the attribute's
values, if the attribute is unset or `null`.

Totality: total
Visibility: export
Fixity Declaration: infixl operator, level 9
unset : Alternativef=>obj-> (obj->Attributebfa) ->JSIO ()
  Unsets the value of an optional or nullable attribute.

Totality: total
Visibility: export
(.=) : Attributebfa->a->JSIO ()
  Operator version of `set`.

```idris example
disabled btn .= True
```

Totality: total
Visibility: export
Fixity Declaration: infix operator, level 1
(%=) : Attributebfa-> (a->a) ->JSIO ()
  Operator version of `mod`.

As with `mod`, this will NOT change the attribute's
values, if the attribute is unset or `null`.

```idris example
toggleCheckBox : HTMLInputElement -> JSIO ()
toggleCheckBox cbx = checked cbx %= not
```

Totality: total
Visibility: export
Fixity Declaration: infix operator, level 1
(=.) : (obj->Attributebfa) ->a->obj->JSIO ()
  Like `set`, but useful when the object, on which
an attribute should operate, is supposed to
be the last argument (for instance, when
iterating over a foldable):

```idris example
disableAll : List HTMLButtonElement -> JSIO ()
disableAll buttons = for_ buttons $ disabled =. True
```

Totality: total
Visibility: export
Fixity Declaration: infix operator, level 1
(=%) : (obj->Attributebfa) -> (a->a) ->obj->JSIO ()
  Like `mod`, but useful when the object, on which
an attribute should operate, is supposed to
be the last argument (for instance, when
iterating over a foldable):

```idris example
toggleAll : List HTMLInputElement -> JSIO ()
toggleAll cbxs = for_ cbxs $ checked =% not
```

Totality: total
Visibility: export
Fixity Declaration: infix operator, level 1
(!>) : Callbackafun=>Attributebfa->fun->JSIO ()
  Sets a callback function at an attribute.

```idris
onclick btn !> consoleLog . jsShow
```

Totality: total
Visibility: export
Fixity Declaration: infixr operator, level 0
(?>) : Callbacka (x->y) =>Attributebfa->y->JSIO ()
  Sets a callback action at an attribute. This is like `(!>)`
but ignores its input.

```idris
onclick btn ?> consoleLog "Boom!"
```

Totality: total
Visibility: export
Fixity Declaration: infixr operator, level 0
fromPrim : ToFFIab=>FromFFIab=>String-> (obj->PrimIOb) -> (obj->b->PrimIO ()) ->obj->AttributeTrueida
Totality: total
Visibility: export
fromNullablePrim : ToFFIab=>FromFFIab=>String-> (obj->PrimIO (Nullableb)) -> (obj->Nullableb->PrimIO ()) ->obj->AttributeFalseMaybea
Totality: total
Visibility: export
fromUndefOrPrim : ToFFIab=>FromFFIab=>String-> (obj->PrimIO (UndefOrb)) -> (obj->UndefOrb->PrimIO ()) ->a->obj->AttributeTrueOptionala
Totality: total
Visibility: export
fromUndefOrPrimNoDefault : ToFFIab=>FromFFIab=>String-> (obj->PrimIO (UndefOrb)) -> (obj->UndefOrb->PrimIO ()) ->obj->AttributeFalseOptionala
Totality: total
Visibility: export