Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | import type { ElementRef } from '@/types/dom.ts'
import type { int } from '@/types/semantic/number.ts'
/**
* # Nanosplash
* @author Isak Hauge <isakhauge@icloud.com>
*/
export interface INanosplash {
/**
* # Show
* Display Nanosplash inside the window.
* @param {string | null | undefined} text Optional text. Pass falsy to display spinner only.
* @param {string | Element | undefined} inside Optional element reference
* @returns {number | null} The internal ID of the created Nanosplash.
* @example
* // Show spinner only
* ns.show()
* @example
* // Show spinner and text
* ns.show('Loading ...')
* @example
* // Show spinner and text inside element
* const div = document.createElement('div')
* div.id = 'my-div'
* document.body.append(div)
*
* // Alternative 1: Using node
* ns.show('Loading ...', div)
*
* // Alternative 2: Using selector
* ns.show('Loading ...', '#my-div')
* @example
* // Show spinner only, inside element
* const div = document.createElement('div')
* div.id = 'my-div'
* document.body.append(div)
*
* // Alternative 1: Using node
* ns.show(null, div)
*
* // Alternative 2: Using selector
* ns.show(null, '#my-div')
*/
show(
text?: string | null | undefined,
inside?: ElementRef | HTMLElement
): int | null
/**
* # Hide
* Remove Nanosplash in multiple ways depending on the passed argument.
* - Pass ID: Remove specific.
* - Pass '*': Remove all in window.
* - Pass nothing: Remove in FIFO order.
* @param id The internal ID, an asterisk, or nothing.
* @example
* // Remove the first Nanosplash in the queue (FIFO)
* ns.hide()
* @example
* // Remove specific Nanosplash in case you have multiple
* const idA: number = ns.show(null, '#div-a') // 1700000000000
* const idB: number = ns.show(null, '#div-b') // 1800000000000
* ns.hide(idB) // Only hides Nanosplash inside the element with ID div-b
* @example
* // Hide all Nanosplash elements in the DOM
* ns.hide('*')
*/
hide(id?: int | '*'): void
/**
* # Version
* The current version of Nanosplash.
*/
version: string
}
|