{"id":11473,"library":"o3","title":"Ozone (o3) JavaScript Class Framework","description":"The `o3` package, also known as Ozone, is a JavaScript class framework designed to bring enhanced object-oriented programming capabilities to ES5 environments. Released as version 1.0.3, its last significant update was over five years ago, indicating it is no longer actively maintained and can be considered abandoned. It aimed to provide class-like inheritance and structure at a time when native ES6 classes were not widely supported, offering an alternative to transpilers like Babel or TypeScript for class definitions. The framework requires an ES5-compatible environment, specifically relying on `Object.create` and ES5 property enumeration features. Its primary differentiator was enabling robust class inheritance in older runtimes without needing a build step. Due to its age and the universal adoption of native ES6 classes, its utility in modern JavaScript development is minimal.","status":"abandoned","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/inf3rno/o3","tags":["javascript","inheritance","class","ES5","object-oriented","abstract method"],"install":[{"cmd":"npm install o3","lang":"bash","label":"npm"},{"cmd":"yarn add o3","lang":"bash","label":"yarn"},{"cmd":"pnpm add o3","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary way to import the entire o3 module in CommonJS environments, which is its intended use case.","wrong":"import o3 from 'o3';","symbol":"o3","correct":"const o3 = require(\"o3\");"},{"note":"The `Class` constructor is a named export (or property of the main module object) within `o3`. Directly requiring `o3` gives you the main object, from which `Class` can be destructured or accessed as `o3.Class`.","wrong":"const Class = require(\"o3\");","symbol":"Class","correct":"const { Class } = require(\"o3\");"},{"note":"As an ES5-focused library primarily designed for CommonJS, ESM `import` syntax is not supported and will fail to resolve the module or its exports.","wrong":"import { Class } from 'o3';","symbol":"Class","correct":"const Class = o3.Class; // after const o3 = require('o3');"}],"quickstart":{"code":"const o3 = require(\"o3\");\nconst Class = o3.Class;\n\n// Define a base class inheriting from Object\nconst BasePerson = Class(Object, {\n    prototype: {\n        // Constructor function\n        constructor: function BasePerson(name) {\n            this.name = name;\n        },\n        // A method\n        sayHello: function() {\n            console.log(`Hello, my name is ${this.name}.`);\n        }\n    }\n});\n\n// Define a derived class using the inherited extend method\nconst Employee = BasePerson.extend({\n    prototype: {\n        constructor: function Employee(name, position) {\n            // Call the super constructor\n            BasePerson.prototype.constructor.call(this, name);\n            this.position = position;\n        },\n        // Override or add new methods\n        sayHello: function() {\n            console.log(`Hello, I'm ${this.name} and I'm a ${this.position}.`);\n        },\n        work: function() {\n            console.log(`${this.name} is working.`);\n        }\n    }\n});\n\nconst person = new BasePerson(\"Alice\");\nperson.sayHello();\n\nconst employee = new Employee(\"Bob\", \"Software Engineer\");\nemployee.sayHello();\nemployee.work();","lang":"javascript","description":"Demonstrates defining a base class and an inheriting class using o3's `Class` and `extend` methods, showcasing object instantiation and method calls."},"warnings":[{"fix":"Ensure your target environment supports ECMAScript 5. This framework is not suitable for pre-ES5 environments.","message":"The `o3` framework is strictly designed for ES5 compatible environments. It will not function correctly in older JavaScript engines (e.g., IE8 or below) lacking `Object.create` or full ES5 property enumeration support.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"For new projects, prefer native ES6+ class syntax. For existing projects, evaluate migration to modern patterns or be aware of potential security and compatibility issues due to lack of maintenance.","message":"The `o3` package is no longer actively maintained, with its last publish occurring over five years ago. Users should consider alternatives like native ES6+ classes or modern transpilers (e.g., Babel, TypeScript) which provide robust and actively supported class functionalities.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Avoid using o3 in applications where Opera browser compatibility is a critical requirement.","message":"The framework explicitly does not support Opera due to issues with its Karma test launcher at the time of development. While it might function, official compatibility is not guaranteed.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always include `Error.captureStackTrace(this, this.constructor);` in custom Error class constructors when extending `Error` to preserve correct stack information. Ensure `this` context is correctly bound when calling super constructors via `call` or `apply`.","message":"When inheriting from native classes like `Error`, special care must be taken with the constructor and `Error.captureStackTrace` to ensure correct stack trace capturing and `this` context binding.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Upgrade your JavaScript engine or ensure polyfills for ES5 features are loaded before initializing `o3`. However, the framework is not recommended for environments requiring extensive polyfilling.","cause":"The JavaScript environment is not fully ES5 compatible and lacks the `Object.create` method, which `o3` relies on heavily for inheritance.","error":"TypeError: Object.create is not a function"},{"fix":"Verify that `require('o3')` is correctly resolving the package. Check your `node_modules` directory and ensure the package is installed. If using a bundler, confirm its configuration allows CommonJS imports.","cause":"The `o3` module was not successfully required or imported, meaning the `o3` object is `undefined` when attempting to access `o3.Class`.","error":"TypeError: Cannot read properties of undefined (reading 'Class')"},{"fix":"Use CommonJS `require` syntax: `const { Class } = require('o3');` or `const o3 = require('o3'); const Class = o3.Class;`.","cause":"Attempting to use ES Modules `import { Class } from 'o3';` syntax with `o3`, which is primarily a CommonJS module and does not expose `Class` via named ESM exports.","error":"TypeError: (0 , _o3.Class) is not a function"}],"ecosystem":"npm"}