mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +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
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2021 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* Contains functions registering serializers (eg blocks, variables, plugins,
|
|
* etc).
|
|
*
|
|
* @namespace Blockly.serialization.registry
|
|
*/
|
|
import * as goog from '../../closure/goog/goog.js';
|
|
goog.declareModuleId('Blockly.serialization.registry');
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
import type {ISerializer} from '../interfaces/i_serializer.js';
|
|
import * as registry from '../registry.js';
|
|
|
|
|
|
/**
|
|
* Registers the given serializer so that it can be used for serialization and
|
|
* deserialization.
|
|
*
|
|
* @param name The name of the serializer to register.
|
|
* @param serializer The serializer to register.
|
|
* @alias Blockly.serialization.registry.register
|
|
*/
|
|
export function register(name: string, serializer: ISerializer) {
|
|
registry.register(registry.Type.SERIALIZER, name, serializer);
|
|
}
|
|
|
|
/**
|
|
* Unregisters the serializer associated with the given name.
|
|
*
|
|
* @param name The name of the serializer to unregister.
|
|
* @alias Blockly.serialization.registry.unregister
|
|
*/
|
|
export function unregister(name: string) {
|
|
registry.unregister(registry.Type.SERIALIZER, name);
|
|
}
|