Class: URI

pc.URI

A URI object

Constructor

(private) new URI(uri)

Create a new URI object
Parameters:
Name Type Description
uri String URI string
Source:

Members

authority

The authority. (e.g. www.example.com)
Source:

fragment

The fragment, the section after a #
Source:

path

The path. (e.g. /users/example)
Source:

query

The query, the section after a ?. (e.g. search=value)
Source:

scheme

The scheme. (e.g. http)
Source:

Methods

getQuery() → {Object}

Returns the query parameters as an Object.
Source:
Returns:
The URI's query parameters converted to an Object.
Type
Object
Example
var s = "http://example.com?a=1&b=2&c=3";
var uri = new pc.URI(s);
var q = uri.getQuery();
console.log(q.a); // logs "1"
console.log(q.b); // logs "2"
console.log(q.c); // logs "3"

setQuery(params)

Set the query section of the URI from a Object
Parameters:
Name Type Description
params Object Key-Value pairs to encode into the query string
Source:
Example
var s = "http://example.com";
var uri = new pc.URI(s);
uri.setQuery({"a":1,"b":2});
console.log(uri.toString()); // logs "http://example.com?a=1&b=2

toString() → {String}

Convert URI back to string
Source:
Returns:
The URI as a string.
Type
String