From bc3a168de87c92a923a389dc0c0c0613e60b3827 Mon Sep 17 00:00:00 2001 From: Andy Aldo Dharmawan Date: Sat, 18 Nov 2017 15:55:34 +0800 Subject: [PATCH] Update extending-1-classes.md --- docs/examples/extending/extending-1-classes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/examples/extending/extending-1-classes.md b/docs/examples/extending/extending-1-classes.md index 0167aad6..c33fe68b 100644 --- a/docs/examples/extending/extending-1-classes.md +++ b/docs/examples/extending/extending-1-classes.md @@ -130,9 +130,9 @@ Leaflet handles the `options` property in a special way: options available for a var instance = new MyCubeClass('Blue'); - console.log(instance.options.width); - console.log(instance.options.height); - console.log(instance.options.depth); + console.log(instance.options.width); // Outputs "1", parent class default + console.log(instance.options.height); // Outputs "1", parent class default + 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: