Exit point of execution

exit point

Execution of the Rice script begins with calling the start(browser) or start() method. The called method will end sometime. Is the end of these methods the end of script execution?

In Cooker, the answer is No. Even after the start method finishes, the event handler may still be waiting for the event to occur. The timer handler may be repeating method calls.


End of script execution in the Cooker is to replace the interpreter.

A .cook file is loaded and a new interpreter is created for execution the new script. The old interpreter is replaced to the new interpreter.

This is the end of execution for the old interpreter. It may need to clean up at this time. For example, canceling the assignment of handlers etc.

Cooker attempts to call the method for cleaning up.


The method for finishing execution and its call are called exit point. In Cooker, two methods of the main class can be exit point.

open method void end(browser)

open method void end()

The definition of these methods is optional. If there is a method, it will be called, otherwise it will do nothing.

open method void end(browser)

Cooker has two browsers and Script-tiles. If you need a browser that corresponds to the tile that was executed, define this method.

An instance of the browser class is passed as a method argument. The argument is the Main-browser if executed from the left tile, otherwise it is the Sub-browser.

1:

open method void end(browser br)

2:

// Method definition.

3:

endmethod

If system.cook defines this method, the argument is Main-browser.

open method void end()

If the correspondence between the executed tile and the browser is not important, define this method.

1:

open method void end()

2:

// Method definition.

3:

endmethod

Priority

If the main class has both methods, the call to the end(browser) method takes precedence.

Copyright © Cooker All rights reserved.