#! lua

local wimptask = require "wimp.task"
local this = wimptask:spawn "Ephemeral"
local message, delay = arg[1], tonumber (arg[2])
local kill <const> , nullevent <const> = 0, 0
_ENV = this
init (this )
handler[nullevent] = QUIT
preclosedown = \ (self)
       self:send (self.post, kill)
   end -- function
post = alert (this, message)
mask = (1<<1)|(7<<4)|(1<<8)|(7<<11)|(7<<17)
time = now (100*(delay))
run  (this, "poll_idle")

--[[
this.init has to be called before task can be used,
this.preclosedown can only be called once the task is running,
by which time self.post will have the correct value. 
Note that when preclosedown is evaluated (as opposed to
when it is called) this.post is nil.
this.time must be defined before the task runs.
Any non-nil non-false argument would do instead of "poll_idle".
--]]