Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @doodad-js/core with all npm packages installed. Try it out:

require('@doodad-js/core').createRoot() .then(root => { const doodad = root.Doodad, mixins = doodad.MixIns, types = doodad.Types; const Animal = types.INIT(doodad.BASE(doodad.Object.$extend( { $TYPE_NAME: 'Animal', makeNoise: doodad.PUBLIC(doodad.MUST_OVERRIDE()), }))); const Perrot = types.INIT(Animal.$extend( { $TYPE_NAME: 'Perrot', __word: doodad.PROTECTED(null), create: doodad.OVERRIDE(function(word) { this._super(); this.__word = word; }), makeNoise: doodad.OVERRIDE(function() { return this.__word; }), })); let obj = new Perrot("hello"); console.log("Instance of Object: " + String(obj instanceof doodad.Object)); console.log("Instance of Animal: " + String(obj instanceof Animal)); console.log("Instance of Perrot: " + String(obj instanceof Perrot)); console.log("Implements Creatable: " + types._implements(obj, mixins.Creatable)); console.log("Noise: " + obj.makeNoise()); obj.destroy(); }) .catch(err => { console.error(err); });

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@doodad-js/core v9.1.3

Object-oriented programming framework for Javascript

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free