Options
All
  • Public
  • Public/Protected
  • All
Menu

Singleton class that acts as a global registry for codecs.

Adding an :

  1. Define a default codec with a new instance of the object to be handled.

    var codec = new mxObjectCodec(new mxGraphModel());
    
  2. Define the functions required for encoding and decoding objects.

    codec.encode = function(enc, obj) { ... }
    codec.decode = function(dec, node, into) { ... }
    
  3. Register the codec in the .

    mxCodecRegistry.register(codec);
    

mxObjectCodec.decode may be used to either create a new instance of an object or to configure an existing instance, in which case the into argument points to the existing object. In this case, we say the codec "configures" the object.

Hierarchy

  • mxCodecRegistry

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Static aliases

aliases: {}

Maps from classnames to codecnames.

static

Type declaration

  • [key: string]: any

Static codecs

codecs: {}

Maps from constructor names to codecs.

static

Type declaration

Methods

Static addAlias

  • addAlias(classname: string, codecname: string): void
  • Adds an alias for mapping a classname to a codecname.

    static

    Parameters

    • classname: string
    • codecname: string

    Returns void

Static getCodec

  • Returns a codec that handles objects that are constructed using the given constructor.

    static

    Parameters

    • ctor: any

      JavaScript constructor function.

    Returns mxObjectCodec

Static register

Generated using TypeDoc