It is standardised and widely implemented.
https://developer.mozilla.org/docs/Web/JavaScript/Reference/...
Your code has a bug, missing constructor.
https://developer.mozilla.org/docs/Web/JavaScript/Reference/...
Your code has a bug, missing constructor.
That doesn't seem like a standard API call.