constructor()

in source/nodejs/adaptivecards/src/host-config.ts [752:816]


    constructor(obj?: any) {
        if (obj) {
            if (typeof obj === "string" || obj instanceof String) {
                obj = JSON.parse(obj as string);
            }

            this.choiceSetInputValueSeparator =
                obj && typeof obj["choiceSetInputValueSeparator"] === "string"
                    ? obj["choiceSetInputValueSeparator"]
                    : this.choiceSetInputValueSeparator;
            this.supportsInteractivity =
                obj && typeof obj["supportsInteractivity"] === "boolean"
                    ? obj["supportsInteractivity"]
                    : this.supportsInteractivity;

            this._legacyFontType = new FontTypeDefinition();
            this._legacyFontType.parse(obj);

            if (obj.fontTypes) {
                this.fontTypes = new FontTypeSet(obj.fontTypes);
            }

            if (obj.lineHeights) {
                this.lineHeights = {
                    small: obj.lineHeights["small"],
                    default: obj.lineHeights["default"],
                    medium: obj.lineHeights["medium"],
                    large: obj.lineHeights["large"],
                    extraLarge: obj.lineHeights["extraLarge"]
                };
            }

            this.imageSizes = {
                small: (obj.imageSizes && obj.imageSizes["small"]) || this.imageSizes.small,
                medium: (obj.imageSizes && obj.imageSizes["medium"]) || this.imageSizes.medium,
                large: (obj.imageSizes && obj.imageSizes["large"]) || this.imageSizes.large
            };

            this.containerStyles = new ContainerStyleSet(obj["containerStyles"]);
            this.spacing = {
                small: (obj.spacing && obj.spacing["small"]) || this.spacing.small,
                default: (obj.spacing && obj.spacing["default"]) || this.spacing.default,
                medium: (obj.spacing && obj.spacing["medium"]) || this.spacing.medium,
                large: (obj.spacing && obj.spacing["large"]) || this.spacing.large,
                extraLarge: (obj.spacing && obj.spacing["extraLarge"]) || this.spacing.extraLarge,
                padding: (obj.spacing && obj.spacing["padding"]) || this.spacing.padding
            };

            this.separator = {
                lineThickness:
                    (obj.separator && obj.separator["lineThickness"]) ||
                    this.separator.lineThickness,
                lineColor: (obj.separator && obj.separator["lineColor"]) || this.separator.lineColor
            };

            this.inputs = new InputConfig(obj.inputs || this.inputs);
            this.actions = new ActionsConfig(obj.actions || this.actions);
            this.adaptiveCard = new AdaptiveCardConfig(obj.adaptiveCard || this.adaptiveCard);
            this.imageSet = new ImageSetConfig(obj["imageSet"]);
            this.factSet = new FactSetConfig(obj["factSet"]);
            this.textStyles = new TextStyleSet(obj["textStyles"]);
            this.textBlock = new TextBlockConfig(obj["textBlock"]);
            this.carousel = new CarouselConfig(obj["carousel"]);
        }
    }