UNPKG

@maxgraph/core

Version:

maxGraph is a fully client side JavaScript diagramming library that uses SVG and HTML for rendering.

43 lines (39 loc) 1.38 kB
/* Copyright 2025-present The maxGraph project Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // The elements in this file are private and are not intended to be exported by the npm package import CodecRegistry from './CodecRegistry.js'; import ObjectCodec from './ObjectCodec.js'; /** * @private */ export const CodecRegistrationStates = { base: false, core: false, editor: false, model: false, }; /** * @private */ export const registerBaseCodecs = (force = false) => { if (!CodecRegistrationStates.base || force) { CodecRegistry.register(createObjectCodec({}, 'Object')); CodecRegistry.register(createObjectCodec([], 'Array')); CodecRegistrationStates.base = true; } }; export const createObjectCodec = (template, name) => { const objectCodec = new ObjectCodec(template); objectCodec.setName(name); return objectCodec; };