🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

com.sweaxizone.w3c.extension

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.sweaxizone.w3c.extension

Global object additions for semi-W3C runtimes.

latest
Source
npmnpm
Version
1.0.9
Version published
Maintainers
1
Created
Source

com.sweaxizone.w3c.extension

Various 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.

Getting started

Clutter the global object by using the following import statement:

import "com.sweaxizone.w3c.extension";

Short-augmented events

The following class defines play and stop events.

// media player
class MediaPlayer extends SAEventTarget {
    // declare events
    declare [EventRecord]: {
        play: MediaPlayerEvent,
        stop: MediaPlayerEvent,
    };
}

Extending MediaPlayer with more events:

// media player
class MoreSpecializedPlayer extends MediaPlayer {
    // declare events
    declare [EventRecord]: MediaPlayer[typeof EventRecord] & {
        // more events...
    };
}

Note that event types must implement the Event interface.

Other additions

  • assert
  • AssertionError
  • 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()

License

Apache 2.0

Keywords

event

FAQs

Package last updated on 02 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts