- @supercat1337/utils
- Classes
-
Functions
- Function: DOMReady()
- Function: bindToAttr()
- Function: bindToCheckboxChecked()
- Function: bindToClass()
- Function: bindToDisabled()
- Function: bindToHtml()
- Function: bindToInputValue()
- Function: bindToList()
- Function: bindToListLength()
- Function: bindToProperty()
- Function: bindToShow()
- Function: bindToText()
- Function: createSingletonFetch()
- Function: escapeHtml()
- Function: fetchRetry()
- Function: getDiffs()
- Function: getListItem()
- Function: getListItemIndex()
- Function: memoize()
- Function: selectRefs()
- Function: selectRefsExtended()
- Function: walkDomScope()
- Type Aliases
@supercat1337/utils • Docs
- DOMReady
- bindToAttr
- bindToCheckboxChecked
- bindToClass
- bindToDisabled
- bindToHtml
- bindToInputValue
- bindToList
- bindToListLength
- bindToProperty
- bindToShow
- bindToText
- createSingletonFetch
- escapeHtml
- fetchRetry
- getDiffs
- getListItem
- getListItemIndex
- memoize
- selectRefs
- selectRefsExtended
- walkDomScope
@supercat1337/utils • Docs
@supercat1337/utils / Chain
Creates a concurrency chain instance
Chain
new Chain():
Chain
private
#private:any
completedSuccessfully:
object
__#2@#private:
any
readonly
name:string
readonly
store:Store
value:
any
void
boolean
• func_or_null
boolean
• callback
• debounce_time?: number
Unsubscriber
isRunning:
object
__#2@#private:
any
readonly
name:string
readonly
store:Store
value:
any
void
boolean
• func_or_null
boolean
• callback
• debounce_time?: number
Unsubscriber
returnValue:
object
__#2@#private:
any
readonly
name:string
readonly
store:Store
value:
any
void
boolean
• func_or_null
boolean
• callback
• debounce_time?: number
Unsubscriber
get
abortController():AbortController
AbortController
get
store():Store
Store
cancel():
void
void
complete(
return_value
?):void
• return_value?: any
void
getCtx():
void
void
run(
ctx
?):Promise
<any
>
• ctx?
Promise
<any
>
then(
task
):this
• task: Task
this
@supercat1337/utils • Docs
@supercat1337/utils / DOMReady
DOMReady(
callback
):void
Execute callback after the DOM is loaded
• callback
void
@supercat1337/utils • Docs
@supercat1337/utils / bindToAttr
bindToAttr(
reactive_item
,element
,attribute_name
,custom_value_converter
?,debounce_time
?):Unsubscriber
Binds the value of a reactive variable to the element's attribute
• reactive_item: Atom
| Computed
• element: HTMLElement
• attribute_name: string
• custom_value_converter?
• debounce_time?: number
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToCheckboxChecked
bindToCheckboxChecked(
reactive_item
,element
,debounce_time
?):Unsubscriber
Synchronizes the value of a reactive variable to the checkbox's "checked" property and vice versa
• reactive_item: Atom
• element: HTMLInputElement
• debounce_time?: number
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToClass
bindToClass(
reactive_item
,element
,custom_value_converter
?,debounce_time
?):Unsubscriber
Binds the value of a reactive variable to the element's "className" property
• reactive_item: Atom
| Computed
• element: HTMLElement
• custom_value_converter?
• debounce_time?: number
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToDisabled
bindToDisabled(
reactive_item
,element
,custom_value_converter
?):Unsubscriber
Binds the value of a reactive variable to the element's "disabled" property
• reactive_item: Atom
| Computed
• element: HTMLLinkElement
| HTMLInputElement
| HTMLButtonElement
| HTMLFieldSetElement
| HTMLOptGroupElement
| HTMLOptionElement
| HTMLSelectElement
| HTMLStyleElement
| HTMLTextAreaElement
| SVGStyleElement
• custom_value_converter?
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToHtml
bindToHtml(
reactive_item
,element
,custom_value_converter
?,debounce_time
?):Unsubscriber
Binds the value of a reactive variable to the element's "innerHTML" property
• reactive_item: Atom
| Computed
• element: HTMLElement
• custom_value_converter?
• debounce_time?: number
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToInputValue
bindToInputValue(
reactive_item
,element
,debounce_time
?,lazy
?):Unsubscriber
Synchronizes the value of a reactive variable to the input's "value" property and vice versa
• reactive_item: Atom
• element: HTMLInputElement
| HTMLTextAreaElement
• debounce_time?: number
• lazy?: boolean
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToList
bindToList(
reactive_item
,list_element
,item_value_setter
,element_item_creator
?):Unsubscriber
Binds the array-value of a reactive collection to the element
• reactive_item: Collection
• list_element: HTMLElement
• item_value_setter: TypeItemValueSetter
• element_item_creator?: TypeItemCreator
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToListLength
bindToListLength(
reactive_item
,element
,custom_value_converter
?,debounce_time
?):Unsubscriber
Binds the length of a reactive collection to the element's "innerText" property
• reactive_item: Collection
• element: HTMLElement
• custom_value_converter?
• debounce_time?: number
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToProperty
bindToProperty(
reactive_item
,element
,property_name
,custom_value_converter
?,debounce_time
?):Unsubscriber
Binds the value of a reactive variable to the element's property
• reactive_item: Atom
| Computed
• element: HTMLElement
• property_name: string
• custom_value_converter?
• debounce_time?: number
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToShow
bindToShow(
reactive_item
,element
,custom_value_converter
?,debounce_time
?,hide_class_name
?):Unsubscriber
Binds the value of a reactive variable to the element's visibility
• reactive_item: Atom
| Computed
• element: HTMLElement
• custom_value_converter?
• debounce_time?: number
• hide_class_name?: string
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / bindToText
bindToText(
reactive_item
,element
,custom_value_converter
?,debounce_time
?):Unsubscriber
Binds the value of a reactive variable to the element's "innerText" property
• reactive_item: Atom
| Computed
• element: HTMLElement
• custom_value_converter?
• debounce_time?: number
Unsubscriber
@supercat1337/utils • Docs
@supercat1337/utils / createSingletonFetch
createSingletonFetch(): (
resource
,options
?) =>Promise
<Response
>
Returns singleton version of function fetch
Function
• resource: RequestInfo
| URL
• options?: RequestInit
Promise
<Response
>
@supercat1337/utils • Docs
@supercat1337/utils / escapeHtml
escapeHtml(
text
):string
Escape string for use in HTML
• text: string
string
@supercat1337/utils • Docs
@supercat1337/utils / fetchRetry
fetchRetry(
url
,fetchOptions
?,delay
?,tries
?):Promise
<Response
>
A version of the fetch function that allows you to specify the number of retries if the connection is lost
• url: RequestInfo
| URL
• fetchOptions?: RequestInit
• delay?: number
• tries?: number
Promise
<Response
>
@supercat1337/utils • Docs
@supercat1337/utils / getDiffs
getDiffs<
T
>(new_object
,old_object
,custom_compare_function
?):{ [key in keyof T]: boolean }
Compares two objects and returns information about their differences
• T extends object
• new_object: T
• old_object: any
• custom_compare_function?
{ [key in keyof T]: boolean }
@supercat1337/utils • Docs
@supercat1337/utils / getListItem
getListItem(
element
,attr_name
?):Element
Returns the list item element by child node
• element: HTMLElement
• attr_name?: string
Element
@supercat1337/utils • Docs
@supercat1337/utils / getListItemIndex
getListItemIndex(
element
):number
Returns the index of the list item element
• element: HTMLElement
number
@supercat1337/utils • Docs
@supercat1337/utils / memoize
memoize<
T
>(func
):T
An optimization used to speed up consecutive function calls by caching the result of calls with identical input
• T extends (...args
) => any
• func: T
T
@supercat1337/utils • Docs
@supercat1337/utils / selectRefs
selectRefs(
root_element
):object
Returns an object of child elements containing the ref attribute
• root_element: Node
object
@supercat1337/utils • Docs
@supercat1337/utils / selectRefsExtended
selectRefsExtended(
root_element
):object
• root_element: Node
object
refs:
object
[key
: string
]: HTMLElement
scopes:
object
[key
: string
]: HTMLElement
@supercat1337/utils • Docs
@supercat1337/utils / walkDomScope
walkDomScope(
root_element
,callback
):void
• root_element: Node
• callback
void
@supercat1337/utils • Docs
@supercat1337/utils / Task
Task: (
previous_result
,ctx
,chain
) =>any
• previous_result: any
• ctx
• chain: Chain
any
@supercat1337/utils • Docs
@supercat1337/utils / TypeItemCreator
TypeItemCreator: (
item_element
?) =>HTMLElement
• item_element?: HTMLElement
HTMLElement
@supercat1337/utils • Docs
@supercat1337/utils / TypeItemValueSetter
TypeItemValueSetter: (
item_element
,index
,value
,old_value
,length
) =>void
• item_element: HTMLElement
• index: number
• value: any
• old_value: any
• length: number
void