Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 22x 22x 118x 118x 118x 10x 7x 7x 3x 119x 119x | import { Screen, ScreenImpl } from '../model/screen' import { ScreenConfig, ScreenConfigSupplier } from '../value/screenConfig' /** * {@link Screen} を新規作成する際の各種設定を保持します. */ export interface ScreenConfigure { /** * 作成する Screen のライブラリ利用者が自由に使えるフィールドを取得します. */ vars (): unknown /** * 作成する Screen のライブラリ利用者が自由に使えるフィールドを設定します. * * @param vars ライブラリ利用者が自由に使えるフィールド */ vars (vars: unknown): ScreenConfigure } export class ScreenConfigureImpl implements ScreenConfigure { private readonly getter: () => ScreenConfig private readonly setter: (obj: Partial<ScreenConfig>) => void constructor (isDefault: boolean, private readonly scene: g.Scene, private readonly config: ScreenConfigSupplier) { this.getter = () => isDefault ? config.default() : config.get() this.setter = obj => isDefault ? config.defaultIf(obj) : config.setIf(obj) } vars (): unknown vars (vars: unknown): ScreenConfigure vars (args?: unknown): unknown | ScreenConfigure { if (arguments.length > 0) { this.setter({ vars: args }) return this } return this.getter().vars } /** * Field を作成します. */ build (): Screen { const config = this.config.get() return new ScreenImpl({ scene: this.scene, vars: config.vars }) } } |