deserver
    Preparing search index...

    Class PageTools

    Hierarchy (View Summary)

    Index
    errorid: string = "error"
    errortoconsole: boolean = true
    errortoelement: boolean = true
    ptversion: string = '1.6.1'
    • Append children created by html code to the end of the selected element

      Parameters

      • elmid: ElementDef

        a existing element or a string that will find a element by id

      • code: string

        html code for creating new elements

      Returns HTMLElement | null

      the first of the created elements or undefined if none created

    • Clear the error element defined by errorid if active defined by errortoelement

      Returns void

    • Create new element from html code

      Parameters

      • code: string

        html code

      Returns HTMLCollection | null

      elements created from the html

    • Do a DELETE request to the url and return the json object

      Parameters

      • url: string

        an url that is allowed to use

      Returns Promise<{}>

      a real object from call to server or a {result: 'error', error: message}

    • Do a GET request to the url and return the json object

      Parameters

      • url: string

        an url that is allowed to use

      Returns Promise<{}>

      a real object from call to server or a {result: 'error', error: message}

    • Do a POST request to the url and return the json object

      Parameters

      • url: string

        an url that is allowed to use

      • indata: {}

        a object that will be stringified to send

      Returns Promise<{}>

      a real object from call to server or a {result: 'error', error: message}

    • Do a PUT request to the url and return the json object

      Parameters

      • url: string

        an url that is allowed to use

      • indata: {}

        a object that will be stringified to send

      Returns Promise<{}>

      a real object from call to server or a {result: 'error', error: message}

    • Find one HtlmElement

      Parameters

      • elmid: ElementDef

        a existing element or a string that will find a element by id

      • Optionalselector: string

        uses to find a element inside the element found by elmid

      Returns HTMLElement | null

      HtmlElement or null

    • Get 0 or more elements from selector(s) or element and selector

      Parameters

      • sel1: ElementDef

        existing element to be queried for children or a selector for selecting elemenets

      • Optionalsel2: string

      Returns NodeList | null

      list of Elements or null

    • Find attribute on element or on the first child that have this attribute and return the value

      Parameters

      • elid: ElementDef

        an existing element or a string that will find a element by id

      • attname: string

        name of the attribure to find

      Returns string | null

      attribute or null

    • Check for attribute on element or children and return the first element having the attributre defined

      Parameters

      • elid: ElementDef

        an existing element or a string that will find a element by id

      • attname: string

        name of the attribure to find

      Returns HTMLElement | null

      element with attributre defined or null

    • Return a attribute value if it exists

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • attr: string

        attribute name

      Returns string

      attribute value or blank string

    • Return a attribute value if it exists

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • attr: string

        attribute name

      • nullonnotfound: true

        if set to true a null will be returned for not found

      Returns string | null

      attribute value or blank or null depending on nullonnotfound

    • Returns {}

    • Hide a element by adding d-none class

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      Returns HTMLElement | null

      the element or null

    • Get inner htlm to or from a element

      Parameters

      • elmid: ElementDef

        a existing element or a string that will find a element by id

      Returns string | null

      the inner htlm of the element or null if element not found

    • Set inner htlm to an element

      Parameters

      • elmid: ElementDef

        a existing element or a string that will find a element by id

      • code: string

        if given a string, it will be set to the element

      Returns HTMLElement | null

      null if element not found or the element if code set

    • Test if a instance is a real array and not object or null

      Parameters

      • x: any

        to test

      Returns boolean

      true if real array

    • Test if a instance is a real object and not array or null

      Parameters

      • x: any

        to test

      Returns boolean

      true if real object

    • Call a method when element selected is changed

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • fn: EventListener

        a method in the class extended on this class

      Returns void

    • Call a method when element selected is clicked

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • fn: EventListener

        a method in the class extended on this class

      Returns void

    • Call a method when element get the named event. This method if for handleing all events that not are so commonly used that they have got their own method like onclickme

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • eventname: string

        the name for the event to register ex input, focusin, focusout

      • fn: EventListener

        a method in the class extended on this class

      Returns void

    • Call this function when document have finished loading

      Parameters

      • fn: EventListener | (() => void)

        a function to run

      Returns void

    • Remove children from the back of thil element till there is only the amount of to left

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • Optionalto: number

        hove many children to be left, default is 0 if not set

      Returns void

    • Add a class to all selected elements

      Parameters

      • selector: string

        a selector that will match elements in the DOM

      • cname: string

        class name to add

      Returns void

    • Remove class from all selected elements

      Parameters

      • selector: string

        a selector that will match elements in the DOM

      • cname: string

        class name to remove

      Returns void

    • Send error to console and error element if defined To error element is defined by errorid and errortoelement To console is defined by errortoconsole

      Parameters

      • result: any

        the result from call to deserver api or a string

      Returns void

    • Set a attribute value on a element or if value is null, remove it

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • attr: string

        attribute name

      • val: string

        a string value to set or null if you want to remove the attribute

      Returns HTMLElement | null

      element if found and attribute set or null if element not found or remove failed

    • Show a element by remove d-none class

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      Returns HTMLElement | null

      the element or null

    • Get value from element

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      Returns string | boolean | null

      return the value of element as string or boolean if the element exists and null if not

    • Set value in element

      Parameters

      • elmid: ElementDef

        an existing element or a string that will find a element by id

      • val: string | boolean

        this is the value to set

      Returns null | undefined

      it will return undefined if a value is set and null if element do not exist