implementing-jsc-classes-cpp

Installation
SKILL.md

Implementing JavaScript Classes in C++

Class Structure

For publicly accessible Constructor and Prototype, create 3 classes:

  1. class Foo : public JSC::DestructibleObject - if C++ fields exist; otherwise use JSC::constructEmptyObject with putDirectOffset
  2. class FooPrototype : public JSC::JSNonFinalObject
  3. class FooConstructor : public JSC::InternalFunction

No public constructor? Only Prototype and class needed.

Iso Subspaces

Classes with C++ fields need subspaces in:

  • src/bun.js/bindings/webcore/DOMClientIsoSubspaces.h
  • src/bun.js/bindings/webcore/DOMIsoSubspaces.h
Related skills
Installs
80
Repository
oven-sh/bun
GitHub Stars
89.5K
First Seen
Jan 22, 2026