Board Thread:Support Requests - Getting Technical/@comment-4368470-20191204221122

Hi there everyone! I am just trying to barely dip my toes into some MediaWiki coding, although it is slow-going and quickly confusing because neither FANDOM nor MediaWiki itself have any tutorials that I can find on how to use their libraries.

Anyway, I just had a quick question about a basic concept: Here is my starting code. When I just have an event that uses mw.hook.add, it is supposed to "Register a hook handler" according to the documentation (in this case, it is registering a handler to the 'wikipage.content' event). I would not expect this handler to actually fire when the Event occurs, because I have not added an mw.hook.fire line. Yet in reality when I check the console, the event fires twice: (see picture).

Even more strangely, when I do add the mw.hook.fire method (so that my code looks like this), it causes the mw.hook.add event to only fire once! And the handler inside the mw.hook.fire event doesn't fire at all.

'''So why is this? What is the purpose of mw.hook.fire if the .add method already fires its handler on the event occurrence?'''

If you can explain the Media Wiki stuff in simple term for me, that would be great because even though I have tons of experience with JS and Lua, I have never used the MediaWiki libraries before now :) Thanks for your time! 