Sha256: f47465b793cdc8c324924d93e2fcc25fe76d162e3c6ded40ece01f9c807c388c
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
/* * Class powers the OOP facilities of the library. Thanks to John Resig and Dean Edwards for inspiration! */ L.Class = function () {}; L.Class.extend = function (/*Object*/ props) /*-> Class*/ { // extended class with the new prototype var NewClass = function () { if (this.initialize) { this.initialize.apply(this, arguments); } }; // instantiate class without calling constructor var F = function () {}; F.prototype = this.prototype; var proto = new F(); proto.constructor = NewClass; NewClass.prototype = proto; // add superclass access NewClass.superclass = this.prototype; // add class name //proto.className = props; //inherit parent's statics for (var i in this) { if (this.hasOwnProperty(i) && i !== 'prototype' && i !== 'superclass') { NewClass[i] = this[i]; } } // mix static properties into the class if (props.statics) { L.Util.extend(NewClass, props.statics); delete props.statics; } // mix includes into the prototype if (props.includes) { L.Util.extend.apply(null, [proto].concat(props.includes)); delete props.includes; } // merge options if (props.options && proto.options) { props.options = L.Util.extend({}, proto.options, props.options); } // mix given properties into the prototype L.Util.extend(proto, props); // allow inheriting further NewClass.extend = L.Class.extend; // method for adding properties to prototype NewClass.include = function (props) { L.Util.extend(this.prototype, props); }; return NewClass; };
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
leaflet-ruby-0.3.beta4 | lib/leaflet/src/core/Class.js |
leaflet-ruby-0.3.beta3 | lib/leaflet/src/core/Class.js |
leaflet-ruby-0.3.beta1 | lib/leaflet/src/core/Class.js |