Search code examples
javascriptgoogle-chromechromiumnew-operator

Where can I see all objects I can make with the "new" operator in Chrome?


Title basically. I want to know all the objects I can make with new in chrome - which are specific to Chrome/Chromium. For example:

new MessageChannel();

new TextEncoderStream();

new EyeDropper();

Is there a list of these methods somewhere?


Solution

  • Since these are properties of window, you can try something like this:

    names = []
    
    for (let k of Object.getOwnPropertyNames(window)) {
      let v;
      try {
        v = window[k]
      } catch (e) {
      }
      if (k.match(/^[A-Z]/) && typeof v === 'function')
        names.push(k)
    }
    
    console.log(names.sort())

    It doesn't tell whether these functions are really constructors though.