[Pas2js] Detect DOM changes with Mutation Observers

Michael Van Canneyt michael at freepascal.org
Sat Jun 30 10:35:11 CEST 2018




On Sat, 23 Jun 2018, warleyalex via Pas2js wrote:

> I'll share you mutation observer class definition.
> Using MutationObserver is possible to detect a DOM change in a element, for
> instance in a TSplitter component, it's required I'm using following
> definition.

I have added it to the web.pas unit, but I changed the declaration somewhat.
- Changed init structure to record. (there is still an overload with TJSObject)
- Defined TJSMutationRecord as record, with the correct fields.
- Created a single callback which is now a reference to procedure like everywhere else.

Thanks for sharing this !

Michael.


More information about the Pas2js mailing list