Hi Jeremy, with pleasure: https://github.com/Jermolene/TiddlyWiki5/issues/5308.
Regards, Mirko Jeremy Ruston schrieb am Mittwoch, 23. Dezember 2020 um 14:53:18 UTC+1: > Thanks Mirko, that does indeed seem to be a bug with the subclassing > mechanism. The code fails when the base class is set to any of the widgets > that set event handlers in their constructor (eg <$scrollable>), but works > for other widgets. I wonder if you’d kindly be able to create a GitHub > ticket? > > Many thanks, > > Jeremy > > On 23 Dec 2020, at 13:35, Mirko Richter <compa...@gmail.com> wrote: > > > Hi, > > i tried to sublass the navigator as described in " > WidgetSubclassingMechanism" like so: > > > (function(){ > > /*jslint node: true, browser: true */ > /*global $tw: false */ > "use strict"; > > exports.baseClass = "navigator"; > > > // Specify a different name to make the subclass available as a new widget > instead of overwriting the baseclass: > exports.name = "limited-stack-navigator"; > > exports.constructor = function(parseTreeNode,options) { > this.initialise(parseTreeNode,options); > }; > > exports.prototype = {}; > > exports.prototype.handleNavigateEvent = function(event) { > /*event = $tw.hooks.invokeHook("th-navigating",event); > if(event.navigateTo) { > this.addToStory(event.navigateTo,event.navigateFromTitle); > if(!event.navigateSuppressNavigation) { > > > this.addToHistory(event.navigateTo,event.navigateFromClientRect); > } > }*/ > console.log("HANDLE"); > return false; > }; > > })(); > > I get the following error: "this.eventListeners is undefined". It seems > that the constructor of widget (the baseclass of navigator) is not called > beforehand (which registers this.eventListeners ). So my basic questions > here are: > > 1. is this a design flaw? (e.g. the registration for the events inside > of the navigator-constructor is a bad idea ;) ) > 2. is it not intended to subclass navigator from some reason? > 3. am i doing something else (more trivial) wrong in my > overwrite-trial above? > > > Thanks for your help, > Mirko > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWikiDev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to tiddlywikide...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywikidev/b63933cd-ba27-4de1-9bfa-1d44327bd202n%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywikidev/b63933cd-ba27-4de1-9bfa-1d44327bd202n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikidev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/879382a8-d8de-45fe-b308-9282344169a8n%40googlegroups.com.