I have a project, where I need to access a paper toast with the id toastNewVersion
from outside the ES6 app class which extends the polymer Element
class WascApp extends Polymer.Element {
_buttonOnTap() {
this.$.toastNewVersion.open();
}
This code works just finde, as expected. But I want to open the toast from outside this class, in a basic <script>
tag.
I tried using getElementById
document.getElementsByTagName('#toastNewVersion').open();
But this Object just equals null instead of the toast.
Any Ideas, how to open the toast? Thanks!
Polymer2 BTW
I actually found a way myself.
This opens a regular paper-toast from the index.html file, if the toast is inside the app-element
s shadow-root:
document.querySelector('app-element').shadowRoot.querySelector('#toastNewVersion').open();