Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible shared state on core elements. #731

Closed
Ashpants opened this issue Aug 28, 2014 · 4 comments
Closed

Possible shared state on core elements. #731

Ashpants opened this issue Aug 28, 2014 · 4 comments

Comments

@Ashpants
Copy link

The documentation provides some great guidelines when initializing objects and arrays for an element. It suggests to initialize them in a created callback instead of the prototype object. This should prevent a “shared state”.

I tried to find some good examples of how this is done in the core and paper elements on the polymer site, and discovered this is typically not the case. I only found a few set up this way.

core-component-page has a created callback that initializes objects and arrays.

A few examples of elements that don't implement this are:
paper-radio-button
core-submenu
core-drawer-panel

The core and paper elements should be updated to using a created callback to further clarify the importance of its use, and prevent a shared state.

@arthurevans
Copy link

What shared state are you seeing? paper-radio-button and core-drawer-panel both have publish and eventDelegates objects, which are special objects used by Polymer. But I'm not seeing properties on either of them that are initialized to objects or arrays.

Note that published is documented: http://www.polymer-project.org/docs/polymer/polymer.html#published-properties

The eventDelegates object is not documented yet. The bug is here: Polymer/old-docs-site#546

2 similar comments
@arthurevans
Copy link

What shared state are you seeing? paper-radio-button and core-drawer-panel both have publish and eventDelegates objects, which are special objects used by Polymer. But I'm not seeing properties on either of them that are initialized to objects or arrays.

Note that published is documented: http://www.polymer-project.org/docs/polymer/polymer.html#published-properties

The eventDelegates object is not documented yet. The bug is here: Polymer/old-docs-site#546

@arthurevans
Copy link

What shared state are you seeing? paper-radio-button and core-drawer-panel both have publish and eventDelegates objects, which are special objects used by Polymer. But I'm not seeing properties on either of them that are initialized to objects or arrays.

Note that published is documented: http://www.polymer-project.org/docs/polymer/polymer.html#published-properties

The eventDelegates object is not documented yet. The bug is here: Polymer/old-docs-site#546

@Ashpants
Copy link
Author

Thanks for the quick response, I do see now that the objects I was concerned about are part of the publish object. Thank you for clearing that up.

I haven't run into a specific shared state scenario in my development, but was trying to find some use case examples of how to use a created callback.

Thanks for pointing out the eventDelegates as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants