Identical to the native URL interface except that all mutable properties are
readonly. To change any of these properties instead you should call the
.set() method which will return a new ImmutableURL object.
All properties are identical to their native counterparts except
searchParams which instead is a ImmutableURLSearchParams whose methods
are all fully immutable.
let url = new ImmutableURL('http://example.com');
url = url.set('path', '/foo'); // = ImmutableURL { http://example.com/foo }
To modify the search params you can call the immutable methods on
searchParams to return a new ImmutableURLSearchParams which can then be
passed to .set()
const newSearchParams = url.searchParams.append('foo', 'bar');
url = url.set('searchParams', newSearchParams);
// Or a shorthand
url = url.set('searchParams', url.searchParams.append('foo', 'bar'));
Identical to the native URL interface except that all mutable properties are readonly. To change any of these properties instead you should call the
.set()
method which will return a new ImmutableURL object.All properties are identical to their native counterparts except
searchParams
which instead is aImmutableURLSearchParams
whose methods are all fully immutable.let url = new ImmutableURL('http://example.com'); url = url.set('path', '/foo'); // = ImmutableURL { http://example.com/foo }
To modify the search params you can call the immutable methods on searchParams to return a new ImmutableURLSearchParams which can then be passed to .set()
const newSearchParams = url.searchParams.append('foo', 'bar'); url = url.set('searchParams', newSearchParams); // Or a shorthand url = url.set('searchParams', url.searchParams.append('foo', 'bar'));