Merge pull request #5925 from andyyaldoo/patch-1

Docs: Update extending-1-classes.md
This commit is contained in:
Andrew 2017-11-18 09:13:38 +01:00 committed by GitHub
commit 047780659b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,9 +130,9 @@ Leaflet handles the `options` property in a special way: options available for a
var instance = new MyCubeClass('Blue'); var instance = new MyCubeClass('Blue');
console.log(instance.options.width); console.log(instance.options.width); // Outputs "1", parent class default
console.log(instance.options.height); console.log(instance.options.height); // Outputs "1", parent class default
console.log(instance.options.depth); console.log(instance.options.depth); // Outputs "1"
It's quite common for child classes to run the parent's constructor, and then their own constructor. In Leaflet this is achieved using `L.Class.addInitHook()`. This method can be used to "hook" initialization functions that run right after the class' `initialize()`, for example: It's quite common for child classes to run the parent's constructor, and then their own constructor. In Leaflet this is achieved using `L.Class.addInitHook()`. This method can be used to "hook" initialization functions that run right after the class' `initialize()`, for example: