Files
blockly/core/serialization/registry.ts
Maribeth Bottorff 037eb59b89 chore: Lint TsDoc. (#6353)
* 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 commit d6d8656a45.

* 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 commit 173455588a.

* 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
2022-08-23 14:27:22 -07:00

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);
}