Skip to content

Latest commit

 

History

History
98 lines (83 loc) · 3.12 KB

HTTP.md

File metadata and controls

98 lines (83 loc) · 3.12 KB

@squirrel-forge/ui-util

Back to table of contents

Documentation

Javascript / HTTP

Events <[ HTTP ]> Layout

Table of contents


AsyncRequest

AsyncRequest class - An XMLHttpRequest wrapper with events and response parsing

Class overview

class AsyncRequest extends EventDispatcher {
  static unique_url( url, cache = false ) {} // string
  constructor( options = null, parent = null, debug = null ) {}
  url : string
  user : string
  pwd : string
  method : string
  cache : boolean
  type : string
  successStatus : Array
  error : boolean
  status : Number
  statusText : string
  readyState : Number
  responseText : string
  responseType : string
  responseParsed : *
  responseParsingError : *
  send( data = null, modifyProcessed = null ) {} // void
  abort() {} // void
  _parse_auto() {} // void
  _parse_html() {} // void
  _parse_svg() {} // void
  _parse_string() {} // void
  _parse_json() {} // void
}

For more details check the AsyncRequest source file.

Events

  • error - Fired when the request failed or returned an error.
  • success - Fired when the request was successful.
  • complete - Fired when the request has completed.
  • progress - Fired when upload progress is made.
  • readystatechange - Fired when the XMLHttpRequest state changes.

JsonP

JsonP class - Extension of the native Error with a previous implementation

Class overview

class JsonP {
  static getCallbackName( prefix = 'jsonPCallback_' ) {} // String
  static promise( url, limit = 10000 ) {} // Promise
  constructor( url, success, timeout = null, limit = 10000 ) {}
}

For more details check the JsonP source file.


LocationManager

LocationManager class - Class for handling urls, get params, push and replace states etc. The class extends EventDispatcher class.

Class overview

class LocationManager extends EventDispatcher {
    static decodeSearch( query ) {} // Object
    static encodeSearch( data ) {} // String
    constructor( protocols = null, debug = null ) {}
    url( data, absolute = true ) {} // String
    search( param = null ) {} // null|String|Object
    update( state, title = null, data = null, replace = false ) {} // void
}

For more details check the LocationManager source file.

Events

  • location.pop - Fired right after default window.popstate event and contains original event information in event.detail.event.
  • location.before.update - Fired before an url update is made with push or replace state, can be prevented by calling event.preventDefault().
  • location.replace - Fired after history.replaceState() and contains title, url and state information.
  • location.push - Fired after history.pushState() and contains title, url and state information.

Events <[ HTTP ]> Layout