# ACTIVESTATE TEAPOT-PKG BEGIN TM -*- tcl -*- # -- Tcl Module # @@ Meta Begin # Package uevent::onidle 0.1 # Meta as::build::date 2015-05-25 # Meta as::origin http://sourceforge.net/projects/tcllib # Meta category User events # Meta description Request merging and deferal to idle time # Meta license BSD # Meta platform tcl # Meta require {Tcl 8.4} # Meta require snit # Meta subject on-idle merge callback idle event deferal # Meta summary uevent::onidle # @@ Meta End # ACTIVESTATE TEAPOT-PKG BEGIN REQUIREMENTS package require Tcl 8.4 package require snit # ACTIVESTATE TEAPOT-PKG END REQUIREMENTS # ACTIVESTATE TEAPOT-PKG BEGIN DECLARE package provide uevent::onidle 0.1 # ACTIVESTATE TEAPOT-PKG END DECLARE # ACTIVESTATE TEAPOT-PKG END TM ## -*- tcl -*- # ### ### ### ######### ######### ######### # ### ### ### ######### ######### ######### ## Requisites package require Tcl 8.4 ; # package require snit ; # # ### ### ### ######### ######### ######### ## snit::type uevent::onidle { # ### ### ### ######### ######### ######### ## API constructor {cmd} { set mycmd $cmd return } method request {} { if {$myhasrequest} return after idle [mymethod RunAction] set myhasrequest 1 return } # ### ### ### ######### ######### ######### ## Internal commands method RunAction {} { set myhasrequest 0 uplevel \#0 $mycmd return } # ### ### ### ######### ######### ######### ## State variable mycmd {} ; # Command prefix of the action to perform variable myhasrequest 0 ; # Boolean flag, set when the action has # ; # been requested # ### ### ### ######### ######### ######### } # ### ### ### ######### ######### ######### ## Ready package provide uevent::onidle 0.1