Files
blockly/core/serialization/registry.js
Monica Kozbial d8fbe1b05b Add namespace and alias annotations to jsdoc (#5550)
* Add annotations to files under core/events

* Add annotations to files under core/interfaces

* Add annotations to files under core/keyboard_nav

* Add annotations to files under core/renderers

* Add annotations to files under core/serialization

* Add annotations to files under core/theme

* Add annotations to files under core/toolbox

* Add annotations to files under core/utils

* Add annotations to files under core
2021-09-27 14:42:54 -07:00

48 lines
1.3 KiB
JavaScript

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Contains functions registering serializers (eg blocks,
* variables, plugins, etc).
*/
'use strict';
/**
* Contains functions registering serializers (eg blocks, variables, plugins,
* etc).
* @namespace Blockly.serialization.registry
*/
goog.module('Blockly.serialization.registry');
goog.module.declareLegacyNamespace();
// eslint-disable-next-line no-unused-vars
const {ISerializer} = goog.requireType('Blockly.serialization.ISerializer');
const registry = goog.require('Blockly.registry');
/**
* Registers the given serializer so that it can be used for serialization and
* deserialization.
* @param {string} name The name of the serializer to register.
* @param {ISerializer} serializer The serializer to register.
* @alias Blockly.serialization.registry.register
*/
const register = function(name, serializer) {
registry.register(registry.Type.SERIALIZER, name, serializer);
};
exports.register = register;
/**
* Unregisters the serializer associated with the given name.
* @param {string} name The name of the serializer to unregister.
* @alias Blockly.serialization.registry.unregister
*/
const unregister = function(name) {
registry.unregister(registry.Type.SERIALIZER, name);
};
exports.unregister = unregister;