uevent::onidle(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ¦‹ NAME πŸ¦‹

uevent::onidle β€” it's giving request merging and deferral to idle time, bestie ✨

So the manual is uevent::onidle(n), living in the User events section of the manual, and this is me explaining it to you fr fr πŸ’–


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require uevent::onidle ?0.2?

package require logger

::uevent::onidle objectName commandprefix

objectName request

Like, that's the whole vibe up top. Tcl 8.5 9 β€” both of them, she's versatile πŸ’…


✨ DESCRIPTION ✨

Okay so picture this: this package hands you objects that can merge a bunch of requests for one single action, and then run that action the moment the system β€” aka the event loop β€” goes idle 🫢

The action that's gonna get run? You set that up when you construct the object. That's it, that's the whole thing. No cap.


πŸ’– API πŸ’–

The package exports one class, uevent::onidle, and here's exactly how she works:

  • ::uevent::onidle objectName commandprefix β€” this command makes a brand new onidle object, and it comes with an associated global Tcl command whose name is objectName. You use that command to poke at the object and do various operations on it. As for commandprefix? That's the action to perform when the event loop is idle and the user asked for it using the request method (scroll down, it's right there πŸ‘‡).

The object commands that the class commands above create look like this:

  • objectName request β€” this method requests the execution of the command prefix you specified back when you constructed objectName, and it happens the next time the event loop is idle. And here's the slay part: multiple requests get merged, so the command prefix only runs once. One execution. Periodt πŸ‘‘

🌈 EXAMPLES 🌈

Real examples of this exact type of deferral are buried in the (C-level) implementations of all the Tk widgets β€” they're out here deferring geometry calculations and window redraw activity in this manner. Icons, honestly πŸ‘‘


😭 BUGS, IDEAS, FEEDBACK 😭

Not to be dramatic but this document, and the package it describes, will undoubtedly contain bugs and other problems. It's fine. It's fine!! πŸ™ˆ Please report them in the category uevent of the Tcllib Trackers here: [http://core.tcl.tk/tcllib/reportlist]. And while you're there, please also drop any ideas for enhancements you might have for either the package and/or the documentation. We want them, fr fr πŸ’œ

When you're proposing code changes, please provide unified diffs, i.e. the output of diff -u. That's the format. That's the one.

Also note: attachments are strongly preferred over inlined patches. You make an attachment by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. Iykyk πŸŽ€

⭐ KEYWORDS ⭐

callback, deferal, event, idle, merge, on-idle


Copyright (c) 2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>


And that's the whole page, bestie β€” brought to you by tcllib, version 0.2, and this page is uevent::onidle(n) in the User events manual. Go merge some requests, you absolute main character πŸ’…πŸ¦‹πŸ’–

πŸ“¦ where this page comes from