@web-atoms/core
Version:
95 lines • 3.25 kB
TypeScript
import { AtomDispatcher } from "./core/AtomDispatcher";
import { AtomUri } from "./core/AtomUri";
import { IScreen } from "./core/IScreen";
import { IDisposable } from "./core/types";
import { ServiceProvider } from "./di/ServiceProvider";
import { IBackgroundTaskInfo } from "./services/BusyIndicatorService";
import "./core/AtomList";
import "@web-atoms/date-time/dist/DateTime";
import "@web-atoms/date-time/dist/TimeSpan";
export type AtomAction = (channel: string, data: any) => void;
export declare class AtomMessageAction {
message: string;
action: AtomAction;
constructor(msg: string, a: AtomAction);
}
export interface IAuthorize {
authorize: string[] | boolean;
authorized: boolean;
}
export declare class App extends ServiceProvider {
static installStyleSheet(ssConfig: string | {
href: string;
integrity?: string;
crossOrigin?: string;
}): void;
static installScript(location: string): any;
static authorize(authorize?: string[] | boolean): boolean;
static current: App;
readonly dispatcher: AtomDispatcher;
readonly screen: IScreen;
/**
* This must be set explicitly as it can be used outside to detect
* if app is ready. This will not be set automatically by framework.
*/
appReady: boolean;
private bag;
private busyIndicatorService;
private readyHandlers;
private mUrl;
get url(): AtomUri;
set url(v: AtomUri);
get contextId(): string;
constructor();
createBusyIndicator(taskInfo?: IBackgroundTaskInfo): Disposable;
syncUrl(): void;
callLater(f: () => void): void;
installStyleSheet(ssConfig: string | {
href: string;
integrity?: string;
crossOrigin?: string;
}): void;
installScript(location: string): any;
updateDefaultStyle(content: string): void;
waitForPendingCalls(): Promise<any>;
setTimeoutAsync(task: () => Promise<any>, timeInMS?: number, previousToken?: number): number;
/**
* This method will run any asynchronous method
* and it will display an error if it will fail
* asynchronously
*
* @template T
* @param {() => Promise<T>} tf
* @memberof AtomDevice
*/
runAsync<T>(tf: () => Promise<T>): void;
onError: (m: any) => void;
/**
* Broadcast given data to channel, only within the current window.
*
* @param {string} channel
* @param {*} data
* @returns
* @memberof AtomDevice
*/
broadcast(channel: string, data: any): void;
/**
* Subscribe for given channel with action that will be
* executed when anyone will broadcast (this only works within the
* current browser window)
*
* This method returns a disposable, when you call `.dispose()` it will
* unsubscribe for current subscription
*
* @param {string} channel
* @param {AtomAction} action
* @returns {AtomDisposable} Disposable that supports removal of subscription
* @memberof AtomDevice
*/
subscribe(channel: string, action: AtomAction): IDisposable;
main(): void;
protected onReady(f: () => any): void;
protected invokeReady(): void;
private invokeReadyHandler;
}
//# sourceMappingURL=App.d.ts.map