Misc functions

This demo covers general-purpose Tripous helper functions that do not belong to a more focused area such as strings, numbers, dates, arrays, formatting, URL handling, keyboard, or mouse.

These helpers are small building blocks used by the runtime and by application code: safe callback invocation, lightweight overload detection, interface-like member checks, random colors, delayed execution, JSON output, and mutation observer creation.

Safe function calls

tp.Call() calls a function only when the value is actually a function. It also supplies the this context and any arguments.

Overload and member checks

tp.Overload() returns a compact argument type signature. tp.ImplementsInterface() checks whether an object contains required member names.

Colors and JSON

tp.RandomColor() returns a random hexadecimal color. tp.ToJson() serializes a value with optional formatting.

Wait and observe

tp.WaitAsync() resolves after a delay and can call a callback. tp.CreateMutationObserver() creates a browser mutation observer when available.

Observed text