cferdinandi / reef

A lightweight library for creating reactive, state-based components and UI.

Home Page:https://reefjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Obj events = {} storing duplicate event listiners causing duplicate calls

Topher-Dev opened this issue · comments

There is an issue with addEvent => getListener as the code is deciding whether to add event into Obj events = {};
The comparison of callback === listener.callback is not reliable and allowing "leakage" into this collection causing unreliable behaviour such as the event listener callback running multiple times.

image

I've found that the comparison is fundamentally (Believe Highly Likely) one of the string representations between the two. and there are instance where the "Whitespace is not being stored consistantly.

A someone what visual
image

I found converting to string expliciltly and removing all white space resolved my issue. of the duplicate records in events ={}. Seems a a bit weird but the solution works.
image

True! Good catch. This was removed in the just-released v12, though, so I'll be closing this issue.

@Topher-Dev Great question!

It was a general displeasure with data and components being so closely tied together, and the "all or nothing" approach that the design of it forced.

I wrote something a few months back about wanting a tool that felt more "vanilla JS" than what Reef currently was. This was a realization of that vision: https://gomakethings.com/a-vanilla-js-state-based-ui-library/