mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
* chore: add linting for tsdoc * chore: don't require types on return * chore: remove redundant fileoverview from ts * chore: change return to returns and add some newlines * chore: remove license tag * chore: don't require params/return docs * chore: remove spurious struct tags * Revert "chore: change return to returns and add some newlines" This reverts commitd6d8656a45. * chore: don't auto-add param names * chore: disable require-param bc it breaks on this * return to returns and add line breaks * chore: configure additional jsdoc rules * chore: run format * Revert "chore: remove license tag" This reverts commit173455588a. * chore: allow license tag format * chore: only require jsdoc on exported items * chore: add missing jsdoc or silence where needed * chore: run format * chore: lint fixes
68 lines
1.5 KiB
TypeScript
68 lines
1.5 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2020 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* Events fired as a result of a theme update.
|
|
*
|
|
* @class
|
|
*/
|
|
import * as goog from '../../closure/goog/goog.js';
|
|
goog.declareModuleId('Blockly.Events.ThemeChange');
|
|
|
|
import * as registry from '../registry.js';
|
|
|
|
import {UiBase} from './events_ui_base.js';
|
|
import * as eventUtils from './utils.js';
|
|
|
|
|
|
/**
|
|
* Class for a theme change event.
|
|
*
|
|
* @alias Blockly.Events.ThemeChange
|
|
*/
|
|
export class ThemeChange extends UiBase {
|
|
themeName?: string;
|
|
override type: string;
|
|
|
|
/**
|
|
* @param opt_themeName The theme name. Undefined for a blank event.
|
|
* @param opt_workspaceId The workspace identifier for this event.
|
|
* event. Undefined for a blank event.
|
|
*/
|
|
constructor(opt_themeName?: string, opt_workspaceId?: string) {
|
|
super(opt_workspaceId);
|
|
|
|
/** The theme name. */
|
|
this.themeName = opt_themeName;
|
|
|
|
/** Type of this event. */
|
|
this.type = eventUtils.THEME_CHANGE;
|
|
}
|
|
|
|
/**
|
|
* Encode the event as JSON.
|
|
*
|
|
* @returns JSON representation.
|
|
*/
|
|
override toJson(): AnyDuringMigration {
|
|
const json = super.toJson();
|
|
json['themeName'] = this.themeName;
|
|
return json;
|
|
}
|
|
|
|
/**
|
|
* Decode the JSON event.
|
|
*
|
|
* @param json JSON representation.
|
|
*/
|
|
override fromJson(json: AnyDuringMigration) {
|
|
super.fromJson(json);
|
|
this.themeName = json['themeName'];
|
|
}
|
|
}
|
|
|
|
registry.register(registry.Type.EVENT, eventUtils.THEME_CHANGE, ThemeChange);
|