///
import type { Agile } from '../agile';
import { SubscriptionContainer } from './subscription';
import type { RuntimeJob } from './runtime.job';
export declare class Runtime {
agileInstance: () => Agile;
currentJob: RuntimeJob | null;
jobQueue: Array;
jobsToRerender: Array;
notReadyJobsToRerender: Set;
isPerformingJobs: boolean;
bucketTimeout: NodeJS.Timeout | null;
/**
* The Runtime queues and executes incoming Observer-based Jobs
* to prevent [race conditions](https://en.wikipedia.org/wiki/Race_condition#:~:text=A%20race%20condition%20or%20race,the%20possible%20behaviors%20is%20undesirable.)
* and optimized the re-rendering of the Observer's subscribed UI-Components.
*
* Each queued Job is executed when it is its turn
* by calling the Job Observer's `perform()` method.
*
* After successful execution, the Job is added to a re-render queue,
* which is first put into the browser's 'Bucket' and started to work off
* when resources are left.
*
* The re-render queue is designed for optimizing the render count
* by batching multiple re-render Jobs of the same UI-Component
* and ignoring re-render requests for unmounted UI-Components.
*
* @internal
* @param agileInstance - Instance of Agile the Runtime belongs to.
*/
constructor(agileInstance: Agile);
/**
* Adds the specified Observer-based Job to the internal Job queue,
* where it is executed when it is its turn.
*
* After successful execution, the Job is assigned to the re-render queue,
* where all the Observer's subscribed Subscription Containers (UI-Components)
* are updated (re-rendered).
*
* @public
* @param job - Job to be added to the Job queue.
* @param config - Configuration object
*/
ingest(job: RuntimeJob, config?: IngestConfigInterface): void;
/**
* Performs the specified Job
* and assigns it to the re-render queue if necessary.
*
* After the execution of the provided Job, it is checked whether
* there are still Jobs left in the Job queue.
* - If so, the next Job in the `jobQueue` is performed.
* - If not, the `jobsToRerender` queue is started to work off.
*
* @internal
* @param job - Job to be performed.
*/
perform(job: RuntimeJob): void;
/**
* Processes the `jobsToRerender` queue by updating (causing a re-render on)
* the subscribed Subscription Containers (UI-Components) of each Job Observer.
*
* It returns a boolean indicating whether
* any Subscription Container (UI-Component) was updated (re-rendered) or not.
*
* @internal
*/
updateSubscribers(): boolean;
/**
* Extracts the Subscription Containers (UI-Components)
* to be updated (re-rendered) from the specified Runtime Jobs.
*
* @internal
* @param jobs - Jobs from which to extract the Subscription Containers to be updated.
*/
extractToUpdateSubscriptionContainer(jobs: Array): Array;
/**
* Updates the specified Subscription Containers.
*
* Updating a Subscription Container triggers a re-render
* on the Component it represents, based on the type of the Subscription Containers.
*
* @internal
* @param subscriptionsToUpdate - Subscription Containers to be updated.
*/
updateSubscriptionContainer(subscriptionsToUpdate: Array): void;
/**
* Maps the values of the updated Observers (`updatedSubscribers`)
* of the specified Subscription Container into a key map object.
*
* The key containing the Observer value is extracted from the Observer itself
* or from the Subscription Container's `subscriberKeysWeakMap`.
*
* @internal
* @param subscriptionContainer - Subscription Container from which the `updatedSubscribers` are to be mapped into a key map.
*/
getUpdatedObserverValues(subscriptionContainer: SubscriptionContainer): {
[key: string]: any;
};
/**
* Returns a boolean indicating whether the specified Subscription Container can be updated or not,
* based on its selector functions (`selectorsWeakMap`).
*
* This is done by checking the '.value' and the '.previousValue' property of the Observer represented by the Job.
* If a selected property differs, the Subscription Container (UI-Component) is allowed to update (re-render)
* and `true` is returned.
*
* If the Subscription Container has no selector function at all, `true` is returned.
*
* @internal
* @param subscriptionContainer - Subscription Container to be checked if it can be updated.
* @param job - Job containing the Observer that is subscribed to the Subscription Container.
*/
handleSelectors(subscriptionContainer: SubscriptionContainer, job: RuntimeJob): boolean;
}
export interface IngestConfigInterface {
/**
* Whether the ingested Job should be performed immediately
* or added to the queue first and then executed when it is his turn.
*/
perform?: boolean;
}