1## -*- tcl -*-
2# ### ### ### ######### ######### #########
3
4# ### ### ### ######### ######### #########
5## Requisites
6
7package require Tcl 8.4 ; #
8package require snit    ; #
9
10# ### ### ### ######### ######### #########
11##
12
13snit::type uevent::onidle {
14    # ### ### ### ######### ######### #########
15    ## API
16
17    constructor {cmd} {
18	set mycmd $cmd
19	return
20    }
21
22    method request {} {
23	if {$myhasrequest} return
24	after idle [mymethod RunAction]
25	set myhasrequest 1
26	return
27    }
28
29    # ### ### ### ######### ######### #########
30    ## Internal commands
31
32    method RunAction {} {
33	set myhasrequest 0
34	uplevel \#0 $mycmd
35	return
36    }
37
38    # ### ### ### ######### ######### #########
39    ## State
40
41    variable mycmd        {} ; # Command prefix of the action to perform
42    variable myhasrequest 0  ; # Boolean flag, set when the action has
43    #                        ; # been requested
44
45    # ### ### ### ######### ######### #########
46}
47
48# ### ### ### ######### ######### #########
49## Ready
50
51package provide uevent::onidle 0.1
52