当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript DocumentStore.updateObject方法代码示例

本文整理汇总了TypeScript中eez-studio-shared/model/store.DocumentStore.updateObject方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DocumentStore.updateObject方法的具体用法?TypeScript DocumentStore.updateObject怎么用?TypeScript DocumentStore.updateObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eez-studio-shared/model/store.DocumentStore的用法示例。


在下文中一共展示了DocumentStore.updateObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: unsetResolutionDependablePropertyForCurrentResolution

export function unsetResolutionDependablePropertyForCurrentResolution(
    object: EezObject,
    propertyName: string
) {
    const allValues: (any | null)[] = getPropertyValueForAllResolutions(object, propertyName);

    allValues[getPageContext().resolution] = null;
    while (allValues.length > 1 && allValues[allValues.length - 1] === null) {
        allValues.pop();
    }

    DocumentStore.updateObject(object, {
        [propertyName + "_"]: allValues
    });
}
开发者ID:eez-open,项目名称:studio,代码行数:15,代码来源:resolution-dependable-properties.ts

示例2: resetInObject

    function resetInObject(object: EezObject) {
        const changes: {
            [key: string]: any;
        } = {};

        object._classInfo.properties.forEach(propertyInfo => {
            if (propertyInfo.resolutionDependable) {
                const value = getPropertyValueForAllResolutions(object, propertyInfo.name);
                for (let i = getPageContext().resolution + 1; i < value.length; i++) {
                    value[i] = null;
                }
                changes[propertyInfo.name + "_"] = value;
            }
        });

        DocumentStore.updateObject(object, changes);

        getChildren(object).forEach(resetInObject);
    }
开发者ID:eez-open,项目名称:studio,代码行数:19,代码来源:resolution-dependable-properties.ts

示例3: replaceObjectReference

export function replaceObjectReference(object: EezObject, newValue: string) {
    let resultsGenerator = searchForReference(DocumentStore.document, object, false);

    while (true) {
        let searchResult = resultsGenerator.next();
        if (searchResult.done) {
            break;
        }

        let searchValue = searchResult.value;
        if (searchValue) {
            let value: string | string[] = newValue;

            if (searchValue.propertyInfo.replaceObjectReference) {
                value = searchValue.propertyInfo.replaceObjectReference(value);
            } else if (searchValue.propertyInfo.type === PropertyType.ConfigurationReference) {
                value = [];
                for (let i = 0; i < searchValue.value.length; i++) {
                    if (searchValue.value[i] !== getProperty(object, "name")) {
                        value.push(searchValue.value[i]);
                    } else {
                        value.push(newValue);
                    }
                }
            }

            let parent = searchValue._parent;
            if (parent) {
                let key = searchValue._key;
                if (parent && key && typeof key == "string") {
                    DocumentStore.updateObject(parent, {
                        [key]: value
                    });
                }
            }
        }
    }
}
开发者ID:eez-open,项目名称:studio,代码行数:38,代码来源:search.ts


注:本文中的eez-studio-shared/model/store.DocumentStore.updateObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。