Skip to content

CustomElement: make computeProperties() / refreshRendering() report changes to function/class properties too  #314

@cjolif

Description

@cjolif

This issue was created when I realized changing the itemRenderer property on deliteful List had no effect. itemRenderer property on deliteful List is referencing a default ItemRenderer.

An example is:

<html>
    <head>
        <script src="../requirejs/require.js"></script>
        <script>
            require.config({
                baseUrl: ".."
            });
            require(["delite/register", "dstore/Memory", "delite/Widget"], function(register, Memory, Widget) {
                register("my-widget", [HTMLElement, Widget], {
                    store: Memory,
                    othertype: "test",
                    refreshRendering: function (oldValues) {
                        if ("store" in oldValues) {
                            console.log("I changed store");
                        }
                        if ("othertype" in oldValues) {
                            console.log("I changed othertype");
                        }
                    }
                })
                register.parse();
                foo.store = new Object();
                foo.othertype = "bar";
            })
        </script>
    </head>
    <my-widget id="foo"></my-widget>
</html>

An easy workaround is to not have a default value for the property. But I'm wondering is something can be changed at delite level so people don't have to bother about that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions