import { EventContainer , ObjectUtils } from "../utils" ; export abstract class SettingsContainer < T extends object > { internal private readonly _defaultSettings : T ; internal private _modifiedEventContainer : EventContainer | undefined ; protected _settings : T ; param defaultSettings constructor ( defaultSettings ) { this . _defaultSettings = ObjectUtils . assign ( { } , defaultSettings ) ; this . _settings = defaultSettings ; } /**
     * Resets the settings to the default.
     */ reset ( ) { this . _settings = ObjectUtils . assign ( { } , this . _defaultSettings ) ; this . _fireModified ( ) ; } /**
     * Gets a copy of the settings as an object.
     */ get ( ) { return ObjectUtils . assign ( { } , this . _settings ) ; } param settings set ( settings ) { ObjectUtils . assign ( this . _settings , settings ) ; this . _fireModified ( ) ; } param action onModified ( action ) { if ( this . _modifiedEventContainer == null ) this . _modifiedEventContainer = new EventContainer ( ) ; this . _modifiedEventContainer . subscribe ( action ) ; } internal private _fireModified ( ) { if ( this . _modifiedEventContainer != null ) this . _modifiedEventContainer . fire ( undefined ) ; } }