Skip to content

Commit

Permalink
[js] Add the canParse() and parse() static methods to URL
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Oct 23, 2024
1 parent 2f05f37 commit 70b164f
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions std/js/html/URL.hx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

package js.html;

import haxe.extern.EitherType;

/**
The URL interface represents an object providing static methods used for creating object URLs.
Expand All @@ -36,9 +38,20 @@ extern class URL {
/** @throws DOMError */
@:overload( function( blob : Blob ) : String {} )
static function createObjectURL( source : MediaSource ) : String;

/** @throws DOMError */
static function revokeObjectURL( url : String ) : Void;


/**
Returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.
**/
static function canParse( url : String, ?base : EitherType<String, URL> ) : Bool;

/**
Returns a newly created `URL` object representing the URL defined by the parameters.
**/
static function parse( url : String, ?base : EitherType<String, URL> ): Null<URL>;

/**
Is a `DOMString` containing the whole URL.
**/
Expand Down Expand Up @@ -101,5 +114,12 @@ extern class URL {

/** @throws DOMError */
function new( url : String, ?base : String ) : Void;
/**
Returns a JSON representation of this URL.
**/
function toJSON() : String;
}

Returns a string representation of this URL.
**/
function toString() : String;
}

0 comments on commit 70b164f

Please sign in to comment.