import { ByteArray, AssetBase } from "@awayjs/core";
import { Font } from "@awayjs/scene";
import { WaveAudio } from "@awayjs/core";
import { Sound } from "../media/Sound";
/**
* The ApplicationDomain class is a container for discrete groups of class definitions.
* Application domains are used to partition classes that are in the same security domain.
* They allow multiple definitions of the same class to exist and allow children to reuse parent
* definitions.
*
*
Application domains are used when an external SWF file is loaded through the Loader class.
* All ActionScript 3.0 definitions in the loaded SWF file are stored in the application
* domain, which is specified by the applicationDomain property of the LoaderContext
* object that you pass as a context parameter of the Loader object's load() or
* loadBytes() method. The LoaderInfo object also contains an
* applicationDomain property, which is read-only.
All code in a SWF file is defined to exist in an application domain. The current application
* domain is where your main application runs. The system domain contains all application domains,
* including the current domain, which means that it contains all Flash Player classes.
Every application domain, except the system domain, has an associated parent domain.
* The parent domain of your main application's application domain is the system domain.
* Loaded classes are defined only when their parent doesn't already define them.
* You cannot override a loaded class definition with a newer definition.
For usage examples of application domains, see the ActionScript 3.0 Developer's Guide.
The ApplicationDomain() constructor function allows you to create an ApplicationDomain object.
*
* @internal Security considerations for application domains are discussed in the
* applicationDomain property entries of URLRequest and LoaderInfo.
*/
export declare class ApplicationDomain {
private static _systemDomain;
private static getSystemDomain();
private static _currentDomain;
private _parentDomain;
private _definitions;
private _font_definitions;
private _audio_definitions;
/**
* Creates a new application domain.
* @param parentDomain If no parent domain is passed in, this application domain takes the system domain as its parent.
*/
constructor(parentDomain?: ApplicationDomain);
/**
* Gets the current application domain in which your code is executing.
* @internal Question: Do you call System.currentDomain? or Loader.currentDomain or request.currentDomain?
*/
static readonly currentDomain: ApplicationDomain;
/**
* Gets and sets the object on which domain-global memory operations
* will operate within this ApplicationDomain.
*/
domainMemory: ByteArray;
/**
* Gets the minimum memory object length required to be used as
* ApplicationDomain.domainMemory.
*/
static readonly MIN_DOMAIN_MEMORY_LENGTH: number;
/**
* Gets the parent domain of this application domain.
*/
readonly parentDomain: ApplicationDomain;
addDefinition(name: string, asset: AssetBase): void;
addAudioDefinition(name: string, asset: WaveAudio): void;
addFontDefinition(name: string, asset: Font): void;
/**
* Gets a public definition from the specified application domain.
* The definition can be that of a class, a namespace, or a function.
* @param name The name of the definition.
* @return The object associated with the definition.
* @internal throws SecurityError The definition belongs to a domain to which
* the calling code does not have access.
* @throws ReferenceError No public definition exists with the
* specified name.
*/
getDefinition(name: string): any;
getFontDefinition(name: string): Font;
getAudioDefinition(name: string): Sound;
getQualifiedDefinitionNames(): string[];
/**
* Checks to see if a public definition exists within the specified application domain.
* The definition can be that of a class, a namespace, or a function.
* @param name The name of the definition.
* @return A value of true if the specified definition exists; otherwise, false.
*/
hasDefinition(name: string): boolean;
hasFontDefinition(name: string): boolean;
hasAudioDefinition(name: string): boolean;
}