Helpers: descriptors
Helper functions to aid in prototype hacking.
Exports
import { booleanAttr, effect, gqlDocument, writable } from '@apollo-elements/lib/descriptors';
booleanAttr
Creates a PropertyDescriptor
for a boolean property that reflects to a boolean attribute
Parameters
attr
string
Attribute name
Returns
PropertyDescriptor
effect
Creates a PropertyDescriptor
for a boolean property that reflects to a boolean attribute
Parameters
options
PropertyEffectOptions<C>
Property | Type | Description |
---|---|---|
name | keyof C |
Name of the property. |
init | C[keyof C] |
The property's initial value. |
onSet | (this: C, value: C[keyof C]) => void |
Site effect to run when setting the property. |
Configuration for the property: it's name, initial value, and setter side-effect.
Returns
PropertyDescriptor
gqlDocument
Creates a PropertyDescriptor
for an ApolloElement
's document
property.
Returns
PropertyDescriptor
writable
Creates a PropertyDescriptor
for a writable property.
Parameters
init
unknown
The property's initial value.
Returns
PropertyDescriptor