<library name="Dispatcher">
	<description>
		Offers functionality to call timed callbacks.
		Generally this requires a UI framework to be active such as a <b>Game.GameWindow</b> or <b>Nori.Frame</b>.
		However, events can be manually dispatched by calling <code>Dispatcher.flush()</code> from synchronous code.
	</description>
	<namespace name="Dispatcher">
		<function name="setTimedCallback">
			<description>
				Invokes a given function after a given amount of time has passed. The function is only invoked once.
			</description>
			<arg name="callback" type="function" description="A function pointer to invoke."/>
			<arg name="delay" type="float" description="Number of seconds to wait before invoking the function pointer."/>
			<arg name="arguments" type="list" optional="true" description="A list of arguments to pass to the function. If not specified, the function will be invoked with no arguments."/>
		</function>
		<function name="setRecurringCallback">
			<description>
				Invokes a given function repeatedly with the given interval duration.
			</description>
			<arg name="callback" type="function" description="A function pointer to invoke."/>
			<arg name="delay" type="float" description="Number of seconds to wait before invoking the function pointer since the last time the function was invoked. Note that this is the time since the function was invoked and not since the function previously ended."/>
			<arg name="arguments" type="list" optional="true" description="A list of arguments to pass to the function. If not specified, the function will be invoked with no arguments."/>
		</function>
		<function name="flush">
			<description>
				Causes all the callbacks that are due to run to get invoked.
				The dispatcher will automatically invoke the callbacks in situations where there is an active UI such as a Game window or Nori frame and so calling this function is unnecessary in those types of programs.
				However in synchronous programs, such as single-threaded command line programs, the VM is unable to interrupt the current thread to do so,
				and so this function ought to be called periodically in those situations if setTimedCallback and setRecurringCallback are used.
			</description>
		</function>
	</namespace>
</library>
