API Documentation for: 1.0.0
Show:

URLUtils Class

Defined in: URLUtils:36
Module: PreloadJS

Utilities that assist with parsing load items, and determining file types, etc.

Item Index

Methods

Properties

Methods

buildURI

(
  • src
  • [data]
)
String static

Defined in buildURI:155

A utility method that builds a file path using a source and a data object, and formats it into a new path.

Parameters:

  • src String

    The source path to add values to.

  • [data] Object optional

    Object used to append values to this request as a query string. Existing parameters on the path will be preserved.

Returns:

String:

A formatted string that contains the path and the supplied parameters.

formatQueryString

(
  • data
  • [query]
)
static

Formats an object into a query string for either a POST or GET request.

Parameters:

  • data Object

    The data to convert to a query string.

  • [query] Array optional

    Existing name/value pairs to append on to this query.

isCrossDomain

(
  • item
)
Boolean static

Defined in isCrossDomain:184

Parameters:

Returns:

Boolean:

If the load item is loading from a different domain than the current location.

isLocal

(
  • item
)
Boolean static

Defined in isLocal:204

Parameters:

Returns:

Boolean:

If the load item is loading from the "file:" protocol. Assume that the host must be local as well.

parseURI

(
  • path
)
Object static

Defined in parseURI:67

Parse a file path to determine the information we need to work with it. Currently, PreloadJS needs to know:

  • If the path is absolute. Absolute paths start with a protocol (such as http://, file://, or //networkPath)
  • If the path is relative. Relative paths start with ../ or /path (or similar)
  • The file extension. This is determined by the filename with an extension. Query strings are dropped, and the file path is expected to follow the format name.ext.

Parameters:

Returns:

Object:

An Object with an absolute and relative Boolean values, the pieces of the path (protocol, hostname, port, pathname, search, hash, host) as well as an optional 'extension` property, which is the lowercase extension.

Properties

ABSOLUTE_PATH

RegExp static

Defined in ABSOLUTE_PATH:42

The Regular Expression used to test file URLS for an absolute path.

EXTENSION_PATT

RegExp static

Defined in EXTENSION_PATT:58

The Regular Expression used to test file URLS for an extension. Note that URIs must already have the query string removed.

RELATIVE_PATH

RegExp static

Defined in RELATIVE_PATH:50

The Regular Expression used to test file URLS for a relative path.