Class: ShutdownEarly

Inherits:
ArcadiaExt show all
Defined in:
ext/test-shutdown-after-startup/test-shutdown-after-startup.rb

Overview

an extension that triggers a shutdown after startup–should you want to profile the startup speed, for example

Instance Attribute Summary

Attributes inherited from ArcadiaExt

#arcadia, #name

Instance Method Summary collapse

Methods inherited from ArcadiaExt

#conf, #conf_array, #conf_default, #exec, #float_frame, #frame, #frame_def_visible?, #frame_domain, #frame_domain_default, #frame_visible?, #initialize, #maximize, #maximized?, #resize, #restore_default_conf

Constructor Details

This class inherits a constructor from ArcadiaExt

Instance Method Details

#on_after_build(_event) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'ext/test-shutdown-after-startup/test-shutdown-after-startup.rb', line 7

def on_after_build(_event)
  if File.exist? 'shutdown_immediately'
    # TODO a different call like "all set up"
    cancel = proc {
      puts 'exit'
      Arcadia.broadcast_event(QuitEvent.new(self))
    }

    cancel.call
    timer=TkAfter.new(10,-1,proc {cancel.call}) # 10ms, loop = -1
    timer.start
  end
end