UNPKG

2.66 kBSource Map (JSON)View Raw
1{"version":3,"file":"StartupSystem.js","sources":["../../src/startup/StartupSystem.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/extensions';\n\nimport type { ExtensionMetadata } from '@pixi/extensions';\nimport type { IRenderer } from '../IRenderer';\nimport type { ISystem } from '../system/ISystem';\n\n/**\n * Options for the startup system.\n * @memberof PIXI\n */\nexport interface StartupSystemOptions\n{\n /**\n * Whether to log the version and type information of renderer to console.\n * @memberof PIXI.IRendererOptions\n */\n hello: boolean;\n}\n\n/**\n * A simple system responsible for initiating the renderer.\n * @memberof PIXI\n */\nexport class StartupSystem implements ISystem<StartupSystemOptions>\n{\n /** @ignore */\n static defaultOptions: StartupSystemOptions = {\n /**\n * {@link PIXI.IRendererOptions.hello}\n * @default false\n * @memberof PIXI.settings.RENDER_OPTIONS\n */\n hello: false,\n };\n\n /** @ignore */\n static extension: ExtensionMetadata = {\n type: [\n ExtensionType.RendererSystem,\n ExtensionType.CanvasRendererSystem\n ],\n name: 'startup',\n };\n\n readonly renderer: IRenderer;\n\n constructor(renderer: IRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * It all starts here! This initiates every system, passing in the options for any system by name.\n * @param options - the config for the renderer and all its systems\n */\n run(options: StartupSystemOptions): void\n {\n const { renderer } = this;\n\n renderer.runners.init.emit(renderer.options);\n\n if (options.hello)\n {\n // eslint-disable-next-line no-console\n console.log(`PixiJS ${process.env.VERSION} - ${renderer.rendererLogId} - https://pixijs.com`);\n }\n\n renderer.resize(renderer.screen.width, renderer.screen.height);\n }\n\n destroy(): void\n {\n // ka pow!\n }\n}\n\nextensions.add(StartupSystem);\n"],"names":["ExtensionType","extensions"],"mappings":";;AAuBO,MAAM,cACb;AAAA,EAsBI,YAAY,UACZ;AACI,SAAK,WAAW;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,SACJ;AACU,UAAA,EAAE,SAAa,IAAA;AAEZ,aAAA,QAAQ,KAAK,KAAK,SAAS,OAAO,GAEvC,QAAQ,SAGR,QAAQ,IAAI,kBAAmC,SAAS,aAAa,uBAAuB,GAGhG,SAAS,OAAO,SAAS,OAAO,OAAO,SAAS,OAAO,MAAM;AAAA,EACjE;AAAA,EAEA,UACA;AAAA,EAEA;AACJ;AAnDa,cAGF,iBAAuC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1C,OAAO;AACX;AAVS,cAaF,YAA+B;AAAA,EAClC,MAAM;AAAA,IACFA,WAAAA,cAAc;AAAA,IACdA,WAAAA,cAAc;AAAA,EAClB;AAAA,EACA,MAAM;AACV;AAkCJC,WAAAA,WAAW,IAAI,aAAa;;"}
\No newline at end of file