mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-21 23:26:12 +00:00
Destructure statics
and includes
from class properties (#8823)
This commit is contained in:
@ -10,7 +10,7 @@ import * as Util from './Util';
|
||||
|
||||
export function Class() {}
|
||||
|
||||
Class.extend = function (props) {
|
||||
Class.extend = function ({statics, includes, ...props}) {
|
||||
|
||||
// @function extend(props: Object): Function
|
||||
// [Extends the current class](#class-inheritance) given the properties to be included.
|
||||
@ -43,19 +43,17 @@ Class.extend = function (props) {
|
||||
}
|
||||
|
||||
// mix static properties into the class
|
||||
if (props.statics) {
|
||||
Util.extend(NewClass, props.statics);
|
||||
if (statics) {
|
||||
Util.extend(NewClass, statics);
|
||||
}
|
||||
|
||||
// mix includes into the prototype
|
||||
if (props.includes) {
|
||||
Util.extend.apply(null, [proto].concat(props.includes));
|
||||
if (includes) {
|
||||
Util.extend.apply(null, [proto].concat(includes));
|
||||
}
|
||||
|
||||
// mix given properties into the prototype
|
||||
Util.extend(proto, props);
|
||||
delete proto.statics;
|
||||
delete proto.includes;
|
||||
|
||||
// merge options
|
||||
if (proto.options) {
|
||||
|
Reference in New Issue
Block a user