Get started with stampit CDN

MIT licensed

Library: Stampit - creates functional component apps.

Tags:
  • object
  • prototype
  • object oriented
  • browser
  • inheritance
  • oop
  • node
  • factory
  • class
  • stamp

Stable version

Copied!

How to start using stampit CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with stampit CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/stampit/4.3.2/stampit.umd.min.js"></script>
</head>
<body>
  <script>
    // Define a base stamp with properties and methods
    const BaseStamp = Stamp.create({
      name: '',
      greet: function() {
        console.log('Hello, I am a ' + this.name);
      },
    });

    // Create a derived stamp with an extended property
    const DerivedStamp = BaseStamp.extend({
      age: 0,
      introduce: function() {
        this.greet();
        console.log('I am ' + this.age + ' years old.');
      },
    });

    // Create an instance of the derived stamp
    const person = DerivedStamp.create({ name: 'John Doe' });

    // Call methods on the instance
    person.introduce();
  </script>
</body>
</html>

All versions