EagleJS.

Hierarchy

  • Array<EventTarget>
    • default

Constructors

  • Return a collection of given items.

    Parameters

    • Rest...items: EventTarget[]

      Items to add to the collection.

    Returns default

    const example = new EagleJS(document);
    

Properties

[unscopables]: {
    [unscopables]?: boolean;
    length?: boolean;
    [iterator]?: any;
    concat?: any;
    copyWithin?: any;
    entries?: any;
    every?: any;
    fill?: any;
    filter?: any;
    find?: any;
    findIndex?: any;
    forEach?: any;
    includes?: any;
    indexOf?: any;
    join?: any;
    keys?: any;
    lastIndexOf?: any;
    map?: any;
    pop?: any;
    push?: any;
    reduce?: any;
    reduceRight?: any;
    reverse?: any;
    shift?: any;
    slice?: any;
    some?: any;
    sort?: any;
    splice?: any;
    toLocaleString?: any;
    toString?: any;
    unshift?: any;
    values?: any;
}

Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

Type declaration

  • Optional Readonly[unscopables]?: boolean

    Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

  • Optionallength?: boolean

    Gets or sets the length of the array. This is a number one higher than the highest index in the array.

length: number

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

[species]: ArrayConstructor

Methods

  • Iterator

    Returns IterableIterator<EventTarget>

  • Add one or more class names to each Element in the collection.

    Parameters

    • Rest...names: string[]

      One or more class names.

    Returns this

    The current collection.

    new EagleJS(element).addClass('className');
    new EagleJS(element).addClass('className', 'className');

    Element.classList.add() on MDN.

    DOMException Throws a SyntaxError if one of the arguments is the empty string.

    DOMException Throws an InvalidCharacterError if one of the arguments contains any ASCII whitespace.

  • Insert a set of Node or DOMString objects after each ChildNode in the collection. DOMString objects are inserted as equivalent Text nodes.

    Parameters

    • Rest...nodes: (string | Node)[]

      A set of Node or DOMString objects to insert.

    Returns this

    The current collection.

    new EagleJS(element).after('text');
    new EagleJS(element).after(Node);
    new EagleJS(element).after('text', Node);
    new EagleJS(element).after(Node, Node);

    ChildNode.after() on MDN.

  • Insert a set of Node or DOMString objects after the last child of each ParentNode in the collection. DOMString objects are inserted as equivalent Text nodes.

    Parameters

    • Rest...nodes: (string | Node)[]

      A set of Node or DOMString objects to insert.

    Returns this

    The current collection.

    new EagleJS(element).append('text');
    new EagleJS(element).append(Node);
    new EagleJS(element).append('text', Node);
    new EagleJS(element).append(Node, Node);

    ParentNode.append() on MDN.

  • Get the attribute value of the first Element in the collection.

    Parameters

    • name: string

      The name of the attribute.

    Returns null | string

    The attribute value of the first Element.

    new EagleJS(element).attr('attributeName');
    

    Element.getAttribute() on MDN.

    DOMException Throws an InvalidCharacterError if the specified attribute name contains one or more characters that are not valid in attribute names.

  • Set the attribute value of each Element in the collection.

    Parameters

    • name: string

      The name of the attribute.

    • value: string

      The value for the attribute.

    Returns this

    Returns the current collection.

    new EagleJS(element).attr('attributeName', 'value');
    

    Element.setAttribute() on MDN.

    DOMException Throws an InvalidCharacterError if the specified attribute name contains one or more characters that are not valid in attribute names.

  • Insert a set of Node or DOMString objects before each ChildNode in the collection. DOMString objects are inserted as equivalent Text nodes.

    Parameters

    • Rest...nodes: (string | Node)[]

      A set of Node or DOMString objects to insert.

    Returns this

    The current collection.

    new EagleJS(element).before('text');
    new EagleJS(element).before(Node);
    new EagleJS(element).before('text', Node);
    new EagleJS(element).before(Node, Node);

    ChildNode.before() on MDN.

  • Get the children property of each ParentNode in the collection, optionally filtered by a selector.

    Parameters

    • filter: null | string = null

      One or more selectors to filter.

    Returns default

    A new collection of Elements.

    new EagleJS(element).children();
    new EagleJS(element).children('selectors');

    ParentNode.children on MDN.

  • Create a clone of each Node in the collection.

    Parameters

    • deep: boolean = false

      If true, then Node and its whole subtree—including text that may be in child Text nodes—is also copied.

    Returns default

    A new collection of Nodes.

    new EagleJS(element).clone();
    new EagleJS(element).clone(true);
    new EagleJS(element).clone(false);

    Node.cloneNode() on MDN.

    DOMException Throws a NotSupportedError if Node is a ShadowRoot.

  • Get the closest ancestor of each Element in the collection that matches selectors.

    Parameters

    • selectors: string

      One or more selectors to match.

    Returns default

    A new collection of Elements.

    new EagleJS(element).closest('selectors');
    

    Element.closest() on MDN.

    DOMException Throws a SyntaxError if the syntax of the specified selectors is not valid.

  • Merge two or more collections.

    Parameters

    • Rest...items: (EventTarget | ConcatArray<EventTarget>)[]

      Values to concatenate into a new collection.

    Returns default

    A new collection.

    new EagleJS(element).concat(EagleJS, EagleJS, EagleJS);
    

    Array.prototype.concat() on MDN.

  • Get the childNodes property of each Node in the collection.

    Returns default

    A new collection of ChildNodes.

    new EagleJS(element).contents();
    

    Node.childNodes on MDN.

  • Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

    Parameters

    • target: number

      If target is negative, it is treated as length+target where length is the length of the array.

    • start: number

      If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

    • Optionalend: number

      If not specified, length of the this object is used as its default value.

    Returns this

  • Get the dataset of the first HTMLElement or SVGElement in the collection.

    Returns DOMStringMap

    The dataset of the first HTMLElement or SVGElement.

    new EagleJS(element).data();
    

    HTMLOrForeignElement.dataset on MDN.

  • Get the data attribute value of the first HTMLElement or SVGElement in the collection.

    Parameters

    • key: string

      The name of the data.

    Returns undefined | string

    Returns the data attribute value of the first HTMLElement or SVGElement.

    new EagleJS(element).data('key');
    

    HTMLOrForeignElement.dataset on MDN.

  • Set the data attribute value of each HTMLElement and SVGElement in the collection.

    Parameters

    • key: string

      The name of the data.

    • value: string

      The new data value.

    Returns this

    Returns the current collection.

    new EagleJS(element).data('key', 'value');
    

    HTMLOrForeignElement.dataset on MDN.

  • Remove all child nodes of each Node in the collection from the DOM.

    Returns this

    The current collection.

    new EagleJS(element).empty();
    

    Node.removeChild() on MDN.

  • Returns an iterable of key, value pairs for every entry in the array

    Returns IterableIterator<[number, EventTarget]>

  • Determines whether all the members of an array satisfy the specified test.

    Type Parameters

    • S extends EventTarget

    Parameters

    • predicate: ((value: EventTarget, index: number, array: EventTarget[]) => value is S)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

        • (value, index, array): value is S
        • Parameters

          • value: EventTarget
          • index: number
          • array: EventTarget[]

          Returns value is S

    • OptionalthisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns this is S[]

  • Determines whether all the members of an array satisfy the specified test.

    Parameters

    • predicate: ((value: EventTarget, index: number, array: EventTarget[]) => unknown)

      A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

        • (value, index, array): unknown
        • Parameters

          • value: EventTarget
          • index: number
          • array: EventTarget[]

          Returns unknown

    • OptionalthisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns boolean

  • Changes all array elements from start to end index to a static value and returns the modified array

    Parameters

    • value: EventTarget

      value to fill array section with

    • Optionalstart: number

      index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

    • Optionalend: number

      index to stop filling the array at. If end is negative, it is treated as length+end.

    Returns this

  • Parameters

    • predicate: ((value: EventTarget, index: number, array: EventTarget[]) => unknown)
        • (value, index, array): unknown
        • Parameters

          • value: EventTarget
          • index: number
          • array: EventTarget[]

          Returns unknown

    • OptionalthisArg: unknown

    Returns default

  • Reduce the collection with the given selector.

    Parameters

    • selectors: string

      A selector to match.

    • condition: boolean = true

      A condition for the test.

    Returns default

    A new collection with the items that pass the test.

    new EagleJS(element).filterWith('selectors');
    

    Element.matches() on MDN.

  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    Type Parameters

    • S extends EventTarget

    Parameters

    • predicate: ((value: EventTarget, index: number, obj: EventTarget[]) => value is S)

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (value, index, obj): value is S
        • Parameters

          • value: EventTarget
          • index: number
          • obj: EventTarget[]

          Returns value is S

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns undefined | S

  • Parameters

    • predicate: ((value: EventTarget, index: number, obj: EventTarget[]) => unknown)
        • (value, index, obj): unknown
        • Parameters

          • value: EventTarget
          • index: number
          • obj: EventTarget[]

          Returns unknown

    • OptionalthisArg: any

    Returns undefined | EventTarget

  • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

    Parameters

    • predicate: ((value: EventTarget, index: number, obj: EventTarget[]) => unknown)

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

        • (value, index, obj): unknown
        • Parameters

          • value: EventTarget
          • index: number
          • obj: EventTarget[]

          Returns unknown

    • OptionalthisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns number

  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: ((value: EventTarget, index: number, array: EventTarget[]) => void)

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        • (value, index, array): void
        • Parameters

          • value: EventTarget
          • index: number
          • array: EventTarget[]

          Returns void

    • OptionalthisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns void

  • Check if any collection Element has the specified attribute.

    Parameters

    • name: string

      The attribute to search.

    Returns boolean

    true if any Element has the given attribute; otherwise, false.

    new EagleJS(element).hasAttr('attributeName');
    

    Element.hasAttribute() on MDN

  • Check if any collection Element has the specified class name.

    Parameters

    • name: string

      The class name to search.

    Returns boolean

    true if any Element has the given class name; otherwise, false.

    new EagleJS(element).hasClass('className');
    

    Element.classList.contains() on MDN.

  • Get the innerHTML of the first Element in the collection.

    Returns string

    The HTML string of the first Element.

    new EagleJS(element).html();
    

    Element.innerHTML on MDN.

  • Set the innerHTML of each Element in the collection.

    Parameters

    • value: string

      The html string to set.

    Returns this

    Returns the current collection.

    new EagleJS(element).html('htmlString');
    

    Element.innerHTML on MDN.

  • Determines whether an array includes a certain element, returning true or false as appropriate.

    Parameters

    • searchElement: EventTarget

      The element to search for.

    • OptionalfromIndex: number

      The position in this array at which to begin searching for searchElement.

    Returns boolean

  • Returns the index of the first occurrence of a value in an array, or -1 if it is not present.

    Parameters

    • searchElement: EventTarget

      The value to locate in the array.

    • OptionalfromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

    Returns number

  • Adds all the elements of an array into a string, separated by the specified separator string.

    Parameters

    • Optionalseparator: string

      A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

    Returns string

  • Returns an iterable of keys in the array

    Returns IterableIterator<number>

  • Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.

    Parameters

    • searchElement: EventTarget

      The value to locate in the array.

    • OptionalfromIndex: number

      The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.

    Returns number

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type Parameters

    • U

    Parameters

    • callbackfn: ((value: EventTarget, index: number, array: EventTarget[]) => U)

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (value, index, array): U
        • Parameters

          • value: EventTarget
          • index: number
          • array: EventTarget[]

          Returns U

    • OptionalthisArg: any

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    Returns U[]

  • Check any Element in the collection that matches selectors.

    Parameters

    • selectors: string

      One or more selectors to match.

    Returns boolean

    true if any Element matches the given selectors; otherwise, false.

    new EagleJS(element).matches('selectors');
    

    Element.matches() on MDN.

    DOMException Throws a SyntaxError if the syntax of the specified selectors is not valid.

  • Get the nextElementSibling of each Element in the collection, optionally filtered by a selector.

    Parameters

    • filter: null | string = null

      One or more selectors to filter.

    Returns default

    A new collection of Elements.

    new EagleJS(element).next();
    new EagleJS(element).next('selectors');

    Element.nextElementSibling on MDN.

  • Parameters

    • type: string
    • listener: null | EventListenerOrEventListenerObject
    • Optionaloptions: boolean | EventListenerOptions

    Returns this

  • Type Parameters

    • K extends keyof GlobalEventHandlersEventMap

    Parameters

    • type: K
    • listener: ((this: GlobalEventHandlers, event: GlobalEventHandlersEventMap[K]) => unknown)
        • (this, event): unknown
        • Parameters

          • this: GlobalEventHandlers
          • event: GlobalEventHandlersEventMap[K]

          Returns unknown

    • Optionaloptions: boolean | EventListenerOptions

    Returns this

  • Parameters

    • type: string
    • listener: null | EventListenerOrEventListenerObject
    • Optionaloptions: boolean | AddEventListenerOptions

    Returns this

  • Type Parameters

    • K extends keyof GlobalEventHandlersEventMap

    Parameters

    • type: K
    • listener: ((this: GlobalEventHandlers, event: GlobalEventHandlersEventMap[K]) => unknown)
        • (this, event): unknown
        • Parameters

          • this: GlobalEventHandlers
          • event: GlobalEventHandlersEventMap[K]

          Returns unknown

    • Optionaloptions: boolean | AddEventListenerOptions

    Returns this

  • Get the parentNode of each Node in the collection, optionally filtered by a selector.

    Parameters

    • filter: null | string = null

      One or more selectors to filter.

    Returns default

    A new collection of Nodes.

    new EagleJS(element).parent();
    new EagleJS(element).parent('selectors');

    Node.parentNode on MDN.

  • Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

    Returns undefined | EventTarget

  • Insert a set of Node or DOMString objects before the first child of each ParentNode in the collection. DOMString objects are inserted as equivalent Text nodes.

    Parameters

    • Rest...nodes: (string | Node)[]

      A set of Node or DOMString objects to insert.

    Returns this

    The current collection.

    new EagleJS(element).prepend('text');
    new EagleJS(element).prepend(Node);
    new EagleJS(element).prepend('text', Node);
    new EagleJS(element).prepend(Node, Node);

    ParentNode.prepend() on MDN.

  • Get the previousElementSibling of each Element in the collection, optionally filtered by a selector.

    Parameters

    • filter: null | string = null

      One or more selectors to filter.

    Returns default

    A new collection of Elements.

    new EagleJS(element).prev();
    new EagleJS(element).prev('selectors');

    Element.previousElementSibling on MDN.

  • Add one or more items to the end of the collection.

    Parameters

    • Rest...items: EventTarget[]

      Items to add to the end of the collection.

    Returns number

    The new length.

    new EagleJS(element).push(EventTarget, EventTarget, EventTarget);

    // Spread and push
    new EagleJS(element).push(...EagleJS);

    Array.prototype.push() on MDN.

  • Get the first Element descendant of each ParentNode in the collection that matches selectors.

    Parameters

    • selectors: string

      One or more selectors to match.

    Returns default

    A new collection of Elements.

    new EagleJS(element).querySelector('selector');
    

    ParentNode.querySelector() on MDN.

    DOMException Throws a SyntaxError if the syntax of the specified selectors is not valid.

  • Get all Element descendants of each ParentNode in the collection that matches selectors.

    Parameters

    • selectors: string

      One or more selectors to match.

    Returns default

    A new collection of Elements.

    new EagleJS(element).querySelectorAll('selector');
    

    ParentNode.querySelectorAll() on MDN.

    DOMException Throws a SyntaxError if the syntax of the specified selectors is not valid.

  • Specify a function to execute when the DOM is completely loaded.

    Parameters

    • listener: EventListener

      The handler function for the event.

    Returns this

    The current collection.

    new EagleJS(document).ready(() => {
    // Call when DOM is completely loaded
    });

    DOMContentLoaded event on MDN.

  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: ((previousValue: EventTarget, currentValue: EventTarget, currentIndex: number, array: EventTarget[]) => EventTarget)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue, currentValue, currentIndex, array): EventTarget
        • Parameters

          • previousValue: EventTarget
          • currentValue: EventTarget
          • currentIndex: number
          • array: EventTarget[]

          Returns EventTarget

    Returns EventTarget

  • Parameters

    • callbackfn: ((previousValue: EventTarget, currentValue: EventTarget, currentIndex: number, array: EventTarget[]) => EventTarget)
        • (previousValue, currentValue, currentIndex, array): EventTarget
        • Parameters

          • previousValue: EventTarget
          • currentValue: EventTarget
          • currentIndex: number
          • array: EventTarget[]

          Returns EventTarget

    • initialValue: EventTarget

    Returns EventTarget

  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue: U, currentValue: EventTarget, currentIndex: number, array: EventTarget[]) => U)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue, currentValue, currentIndex, array): U
        • Parameters

          • previousValue: U
          • currentValue: EventTarget
          • currentIndex: number
          • array: EventTarget[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: ((previousValue: EventTarget, currentValue: EventTarget, currentIndex: number, array: EventTarget[]) => EventTarget)

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue, currentValue, currentIndex, array): EventTarget
        • Parameters

          • previousValue: EventTarget
          • currentValue: EventTarget
          • currentIndex: number
          • array: EventTarget[]

          Returns EventTarget

    Returns EventTarget

  • Parameters

    • callbackfn: ((previousValue: EventTarget, currentValue: EventTarget, currentIndex: number, array: EventTarget[]) => EventTarget)
        • (previousValue, currentValue, currentIndex, array): EventTarget
        • Parameters

          • previousValue: EventTarget
          • currentValue: EventTarget
          • currentIndex: number
          • array: EventTarget[]

          Returns EventTarget

    • initialValue: EventTarget

    Returns EventTarget

  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue: U, currentValue: EventTarget, currentIndex: number, array: EventTarget[]) => U)

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue, currentValue, currentIndex, array): U
        • Parameters

          • previousValue: U
          • currentValue: EventTarget
          • currentIndex: number
          • array: EventTarget[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

  • Remove each ChildNode of the collection from the DOM.

    Returns this

    The current collection.

    new EagleJS(element).remove();
    

    ChildNode.remove() on MDN.

  • Remove one or more attributes from each Element in the collection.

    Parameters

    • Rest...names: string[]

      One or more attribute names.

    Returns this

    The current collection.

    new EagleJS(element).removeAttr('attributeName');
    new EagleJS(element).removeAttr('attributeName', 'attributeName');

    Element.removeAttribute() on MDN.

  • Remove one or more class names from each Element in the collection.

    Parameters

    • Rest...names: string[]

      One or more class names.

    Returns this

    The current collection.

    new EagleJS(element).removeClass('className');
    new EagleJS(element).removeClass('className', 'className');

    Element.classList.remove() on MDN.

    DOMException Throws a SyntaxError if one of the arguments is the empty string.

    DOMException Throws an InvalidCharacterError if one of the arguments contains any ASCII whitespace.

  • Replace each ChildNode in the collection with a set of Node or DOMString objects. DOMString objects are inserted as equivalent Text nodes.

    Parameters

    • Rest...nodes: (string | Node)[]

      A set of Node or DOMString objects to replace.

    Returns this

    The current collection.

    new EagleJS(element).replaceWith('text');
    new EagleJS(element).replaceWith(Node);
    new EagleJS(element).replaceWith('text', Node);
    new EagleJS(element).replaceWith(Node, Node);

    ChildNode.replaceWith() on MDN.

  • Returns this

  • Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified.

    Returns undefined | EventTarget

  • Get the siblings of each Node in the collection, optionally filtered by a selector.

    Parameters

    • filter: null | string = null

      One or more selectors to filter.

    Returns default

    A new collection of Elements.

    new EagleJS(element).siblings();
    new EagleJS(element).siblings('selectors');
  • Parameters

    • Optionalstart: number
    • Optionalend: number

    Returns default

  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • predicate: ((value: EventTarget, index: number, array: EventTarget[]) => unknown)

      A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

        • (value, index, array): unknown
        • Parameters

          • value: EventTarget
          • index: number
          • array: EventTarget[]

          Returns unknown

    • OptionalthisArg: any

      An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

    Returns boolean

  • Sorts an array in place. This method mutates the array and returns a reference to the same array.

    Parameters

    • OptionalcompareFn: ((a: EventTarget, b: EventTarget) => number)

      Function used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.

      [11,2,22,1].sort((a, b) => a - b)
      
        • (a, b): number
        • Parameters

          • a: EventTarget
          • b: EventTarget

          Returns number

    Returns this

  • Parameters

    • start: number
    • OptionaldeleteCount: number

    Returns default

  • Parameters

    • start: number
    • deleteCount: number
    • Rest...items: EventTarget[]

    Returns default

  • Get the textContent of the first Node in the collection.

    Returns null | string

    Text of the first Node.

    new EagleJS(element).text();
    

    Node.textContent on MDN.

  • Set the textContent of each Node in the collection.

    Parameters

    • value: string

      The text to set.

    Returns this

    Returns the current collection.

    new EagleJS(element).text('value');
    

    Node.textContent on MDN.

  • Toggle the attribute to each Element in the collection.

    Parameters

    • name: string

      The name of the attribute.

    • Optionalforce: boolean

      A boolean value to determine whether the attribute should be added or removed.

    Returns this

    The current collection.

    new EagleJS(element).toggleAttr('attributeName');
    new EagleJS(element).toggleAttr('attributeName', true);
    new EagleJS(element).toggleAttr('attributeName', false);

    Element.toggleAttribute() on MDN.

  • Toggle the class name to each Element in the collection.

    Parameters

    • name: string

      The class name to toggle.

    • Optionalforce: boolean

      A boolean value to determine whether the class should be added or removed.

    Returns this

    The current collection.

    new EagleJS(element).toggleClass('className');
    new EagleJS(element).toggleClass('className', true);
    new EagleJS(element).toggleClass('className', false);

    Element.classList.toggle() on MDN.

    DOMException Throws a SyntaxError if one of the arguments is the empty string.

    DOMException Throws an InvalidCharacterError if one of the arguments contains any ASCII whitespace.

  • Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

    Returns string

  • Parameters

    • locales: string | string[]
    • Optionaloptions: NumberFormatOptions & DateTimeFormatOptions

    Returns string

  • Returns a string representation of an array.

    Returns string

  • Trigger the specified Event on each item in the collection.

    Parameters

    • event: Event

      The Event object to dispatch.

    Returns this

    The current collection.

    const event = new CustomEvent('click');
    new EagleJS(element).trigger(event);

    EventTarget.dispatchEvent() on MDN.

  • Add one or more items to the beginning of the collection.

    Parameters

    • Rest...items: EventTarget[]

      Items to add to the front of the collection.

    Returns number

    The new length.

    new EagleJS(element).unshift(EventTarget, EventTarget, EventTarget);

    // Spread and unshift
    new EagleJS(element).unshift(...EagleJS);

    Array.prototype.unshift() on MDN.

  • Returns an iterable of values in the array

    Returns IterableIterator<EventTarget>

  • Creates an array from an array-like object.

    Type Parameters

    • T

    Parameters

    • arrayLike: ArrayLike<T>

      An array-like object to convert to an array.

    Returns T[]

  • Creates an array from an iterable object.

    Type Parameters

    • T
    • U

    Parameters

    • arrayLike: ArrayLike<T>

      An array-like object to convert to an array.

    • mapfn: ((v: T, k: number) => U)

      A mapping function to call on every element of the array.

        • (v, k): U
        • Parameters

          • v: T
          • k: number

          Returns U

    • OptionalthisArg: any

      Value of 'this' used to invoke the mapfn.

    Returns U[]

  • Creates an array from an iterable object.

    Type Parameters

    • T

    Parameters

    • iterable: Iterable<T> | ArrayLike<T>

      An iterable object to convert to an array.

    Returns T[]

  • Creates an array from an iterable object.

    Type Parameters

    • T
    • U

    Parameters

    • iterable: Iterable<T> | ArrayLike<T>

      An iterable object to convert to an array.

    • mapfn: ((v: T, k: number) => U)

      A mapping function to call on every element of the array.

        • (v, k): U
        • Parameters

          • v: T
          • k: number

          Returns U

    • OptionalthisArg: any

      Value of 'this' used to invoke the mapfn.

    Returns U[]

  • Parameters

    • arg: any

    Returns arg is any[]

  • Checks if the given value is an instance of EventTarget.

    Parameters

    • value: unknown

      The value to be checked.

    Returns value is EventTarget

    true if the given value is an instance of EventTarget; otherwise, false.

  • Returns a new array from a set of elements.

    Type Parameters

    • T

    Parameters

    • Rest...items: T[]

      A set of elements to include in the new array object.

    Returns T[]