Actual WeakSet Use Cases

Domenic Denicola d at
Tue Jun 2 15:14:20 UTC 2015

WeakSets are perfect for branding and are how I would expect web platform class branding to be explained.

const foos = new WeakSet();

class Foo {
  constructor() {
  method() {
    if (!foos.has(this)) {
      throw new TypeError("Foo.prototype.method called on an incompatible object!");

More information about the es-discuss mailing list