Global object additions for semi-W3C runtimes.
npm install com.sweaxizone.w3c.extensionVarious global utilities that are not included in the ECMAScript and WHATWG/W3C APIs. Not focusing on web DOM APIs for now, as I plan to use this for other purposes.
Clutter the global object by using the following import statement:
``ts`
import "com.sweaxizone.w3c.extension";
The following class defines play and stop events.
`ts`
// media player
class MediaPlayer extends SAEventTarget {
// declare events
declare [EventRecord]: {
play: MediaPlayerEvent,
stop: MediaPlayerEvent,
};
}
Extending MediaPlayer with more events:
`ts`
// media player
class MoreSpecializedPlayer extends MediaPlayer {
// declare events
declare [EventRecord]: MediaPlayer[typeof EventRecord] & {
// more events...
};
}
> Note that event types must implement the Event interface.
- assertAssertionError
- trace(...)
- (equivalent to console.log())etrace(...)
- (equivalent to console.error())Math.clamp(value, from, to)
- BigInt.min(...)
- BigInt.max(...)
- SAByteArray
- (like Adobe Flash's ByteArray)isXMLName(argument)
- (like E4X's isXMLName())Namespace
- (like E4X's Namespace)QName
- (like E4X's QName)Iterator.prototype.length()
- Chars
- String.prototype.chars()`
-
Apache 2.0