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

Project is not working #11

Open
rahimoddinn opened this issue Aug 9, 2019 · 1 comment
Open

Project is not working #11

rahimoddinn opened this issue Aug 9, 2019 · 1 comment

Comments

@rahimoddinn
Copy link

rahimoddinn commented Aug 9, 2019

Project is not working if you download the zip and start server. There are couple of js errors in the console. Please update the attached zip in the codelab.

Error description:

main.js:149 Uncaught TypeError: Failed to execute 'define' on 'CustomElementRegistry': The callback provided as parameter 2 is not a function. at main.js:149and main.js:74 Uncaught TypeError: note.setMessage is not a function
at StickyNotesApp.displayNote (main.js:74)
at new StickyNotesApp (main.js:34)
at main.js:88

@bochap
Copy link

bochap commented Aug 29, 2019

This code does not look correct

customElements.define('sticky-note', {

based on the syntax of https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define

And looking at this commit 7f3d24c I think the code was changed from document.registerElement but the function signature was not changed https://developer.mozilla.org/en-US/docs/Web/API/Document/registerElement

The previous commit for ES6 version (b72c713) worked since it uses the class syntax which fits the syntax of customElement.define

I found the following issue WICG/webcomponents#587 talks about the changes customElement.define. The solution to support the non class syntax was to use Reflect.construct. I have forked this repository and actually made the code use Reflect.construct. It is working on Google Chrome | 76.0.3809.100 (Official Build) (64-bit)

The repo is here: https://github.com/seetd-opensource/chrome-es2015. I will be happy to put in a PR if this code is good for the examples.

Disclaimer I got it to work but I am not sure if this is production grade code since Web Components are new to me and I am still learning about this 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