mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
chore: rename all JS files to TS files (#6297)
This commit is contained in:
45
core/serialization/registry.ts
Normal file
45
core/serialization/registry.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @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');
|
||||
|
||||
const registry = goog.require('Blockly.registry');
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const {ISerializer} = goog.requireType('Blockly.serialization.ISerializer');
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
Reference in New Issue
Block a user