diff --git a/package.json b/package.json index 0112baa..fcb4eb1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@next2d/framework", "description": "It is a framework dedicated to Next2D that enables scene management by URL (SPA), which has been difficult with conventional Canvas/WebGL applications, and simplifies readability and shareability by fixing the development pattern (MVVM).", - "version": "1.5.11", + "version": "1.5.12", "homepage": "https://next2d.app", "bugs": "https://github.com/Next2D/Framework/issues/new", "author": "Toshiyuki Ienaga (https://github.com/ienaga/)", diff --git a/src/application/Application.ts b/src/application/Application.ts index 8714722..4359560 100644 --- a/src/application/Application.ts +++ b/src/application/Application.ts @@ -34,7 +34,6 @@ export class Application private readonly _$removeResponse: RemoveResponse; private _$popstate: boolean; private _$currentName: string; - private readonly _$promises: Promise[]; /** * @constructor @@ -45,8 +44,6 @@ export class Application $setConfig(config); $setPackages(packages); - this._$promises = [$createContext(config)]; - /** * @type {QueryParser} * @private @@ -108,21 +105,20 @@ export class Application * @private */ this._$currentName = "top"; - - // initial processing - this.initialize(); } /** - * @description constructorが起動した後にコールされます。(初回起動時のみコールされます。) - * Called after the constructor is invoked. (Called only the first time it is invoked.) + * @description Next2Dのアプリを起動します + * Launch the Next2D application * - * @return {void} + * @return {Application} * @method - * @abstract + * @public */ - // eslint-disable-next-line no-empty-function - initialize (): void {} + run () + { + return $createContext(config); + } /** * @description 指定のViewを起動して、描画を開始します。引数を指定しない場合はURLをパースしてViewを起動します。 @@ -136,32 +132,23 @@ export class Application */ gotoView (name: string = ""): Promise { - return Promise - .all(this._$promises) - .then((): Promise[]> => - { - // reset - if (this._$promises.length) { - this._$promises.length = 0; - } - - const promises: Promise[] = []; - if (config.loading) { - /** - * ローディング表示を起動 - * Launch loading display - */ - this._$loading.start(); - - /** - * 現時点の描画をBitmapにして処理の負担を減らす - * Reduce the processing burden by making the current drawing a Bitmap. - */ - promises.push(this._$capture.execute()); - } + const promises: Promise[] = []; + if (config.loading) { + /** + * ローディング表示を起動 + * Launch loading display + */ + this._$loading.start(); + + /** + * 現時点の描画をBitmapにして処理の負担を減らす + * Reduce the processing burden by making the current drawing a Bitmap. + */ + promises.push(this._$capture.execute()); + } - return Promise.all(promises); - }) + return Promise + .all(promises) .then((): Promise => { /** diff --git a/src/application/Context.ts b/src/application/Context.ts index 3cda02b..7e7722e 100644 --- a/src/application/Context.ts +++ b/src/application/Context.ts @@ -1,5 +1,4 @@ import { ToCamelCase } from "../domain/convert/ToCamelCase"; -import { Event } from "@next2d/events"; import { packages } from "./variable/Packages"; import type { View } from "../view/View"; import type { ViewModel } from "../view/ViewModel"; diff --git a/src/application/variable/Context.ts b/src/application/variable/Context.ts index 14606da..3023559 100644 --- a/src/application/variable/Context.ts +++ b/src/application/variable/Context.ts @@ -16,8 +16,7 @@ export let context: Context; */ export const $createContext = (config: ConfigImpl): Promise => { - return window - .next2d + return next2d .createRootMovieClip( config.stage.width, config.stage.height, diff --git a/src/index.ts b/src/index.ts index 48ebe41..e1bc683 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,6 +7,7 @@ import { MovieClipContent } from "./application/content/MovieClipContent"; import { ShapeContent } from "./application/content/ShapeContent"; import { TextFieldContent } from "./application/content/TextFieldContent"; import { VideoContent } from "./application/content/VideoContent"; +import { ConfigImpl } from "./interface/ConfigImpl"; import { packages } from "./application/variable/Packages"; import { context } from "./application/variable/Context"; import { cache } from "./application/variable/Cache"; @@ -29,6 +30,7 @@ export { ShapeContent, TextFieldContent, VideoContent, + ConfigImpl, packages, context, cache, diff --git a/src/interface/ConfigImpl.ts b/src/interface/ConfigImpl.ts index 2e55daa..e877e9b 100644 --- a/src/interface/ConfigImpl.ts +++ b/src/interface/ConfigImpl.ts @@ -3,7 +3,11 @@ import { RoutingImpl } from "./RoutingImpl"; import { LoadingImpl } from "./LoadingImpl"; import { GotoViewImpl } from "./GotoViewImpl"; -export interface ConfigImpl { +interface BaseConfigImpl { + [key: string]: any +} + +export interface ConfigImpl extends BaseConfigImpl { platform: string; stage: StageImpl; routing?: {