@demirkartal/eaglejs - v0.8.3
    Preparing search index...

    Class default

    EagleJS.

    Hierarchy

    • Array<EventTarget>
      • default

    Indexable

    • [n: number]: EventTarget
    Index

    Constructors

    • Return a collection of given items.

      Parameters

      • ...items: EventTarget[]

        Items to add to the collection.

      Returns default

      const example = new EagleJS(document);
      

    Properties

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

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

    Type declaration

    • [key: number]: undefined | boolean
    • Optional[iterator]?: boolean
    • Optional Readonly[unscopables]?: boolean

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

    • Optionalconcat?: boolean
    • OptionalcopyWithin?: boolean
    • Optionalentries?: boolean
    • Optionalevery?: boolean
    • Optionalfill?: boolean
    • Optionalfilter?: boolean
    • Optionalfind?: boolean
    • OptionalfindIndex?: boolean
    • OptionalforEach?: boolean
    • Optionalincludes?: boolean
    • OptionalindexOf?: boolean
    • Optionaljoin?: boolean
    • Optionalkeys?: boolean
    • OptionallastIndexOf?: boolean
    • Optionallength?: boolean

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

    • Optionalmap?: boolean
    • Optionalpop?: boolean
    • Optionalpush?: boolean
    • Optionalreduce?: boolean
    • OptionalreduceRight?: boolean
    • Optionalreverse?: boolean
    • Optionalshift?: boolean
    • Optionalslice?: boolean
    • Optionalsome?: boolean
    • Optionalsort?: boolean
    • Optionalsplice?: boolean
    • OptionaltoLocaleString?: boolean
    • OptionaltoString?: boolean
    • Optionalunshift?: boolean
    • Optionalvalues?: boolean
    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 ArrayIterator<EventTarget>

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

      Parameters

      • ...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

      • ...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

      • ...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

      • ...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.

      Returns default

      A new collection of Elements.

      new EagleJS(element).children();-
      

      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

      • ...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 ArrayIterator<[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.

      • 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.

      • 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

    • Returns the items of a collection that meet the condition specified in a callback function.

      Parameters

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

        A function that accepts up to three arguments. The filter method calls the predicate function one time for each item in the collection.

      • OptionalthisArg: unknown

        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 default

      A shallow copy of the given collection containing just the items that pass the test. If no items pass the test, an empty collection is returned.

      Array.prototype.filter() on MDN.

    • 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.

      • 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
      • 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.

      • 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.

      • 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 ArrayIterator<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.

      • 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.

      Returns default

      A new collection of Elements.

      new EagleJS(element).next();
      

      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
      • 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
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns this

    • Get the parentNode of each Node in the collection.

      Returns default

      A new collection of Nodes.

      new EagleJS(element).parent();
      

      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

      • ...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.

      Returns default

      A new collection of Elements.

      new EagleJS(element).prev();
      

      Element.previousElementSibling on MDN.

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

      Parameters

      • ...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.

      Returns EventTarget

    • Parameters

      • callbackfn: (
            previousValue: EventTarget,
            currentValue: EventTarget,
            currentIndex: number,
            array: EventTarget[],
        ) => 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.

      • 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.

      Returns EventTarget

    • Parameters

      • callbackfn: (
            previousValue: EventTarget,
            currentValue: EventTarget,
            currentIndex: number,
            array: EventTarget[],
        ) => 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.

      • 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

      • ...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

      • ...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

      • ...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.

    • Reverses the items in a collection in place. This method mutates the collection and returns a reference to the same collection.

      Returns this

      The current collection.

      Array.prototype.reverse() on MDN.

    • 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.

      Returns default

      A new collection of Elements.

      new EagleJS(element).siblings();
      
    • Returns a copy of a section of a collection. For both start and end, a negative index can be used to indicate an offset from the end of the collection.

      Parameters

      • Optionalstart: number

        The beginning index of the specified portion of the collection. If start is undefined, then the slice begins at index 0.

      • Optionalend: number

        The end index of the specified portion of the collection. This is exclusive of the element at the index 'end'. If end is undefined, then the slice extends to the end of the collection.

      Returns default

      A new collection containing the extracted items.

      Array.prototype.slice() on MDN.

    • 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.

      • 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, UTF-16 code unit order.

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

      Returns this

    • Removes item from a collection and, if necessary, inserts new items in their place, returning the deleted items.

      Parameters

      • start: number

        The zero-based location in the collection from which to start removing items.

      • OptionaldeleteCount: number

        The number of items to remove.

      • ...items: EventTarget[]

        Items to insert into the collection in place of the deleted items.

      Returns default

      A new collection containing the items that were deleted.

      Array.prototype.splice() on MDN.

    • 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

      • ...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 ArrayIterator<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.

      • 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, any, any> | 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, any, any> | 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.

      • 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

      • ...items: T[]

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

      Returns T[]