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

[docs] TypeScript sample on front page with JS in a code editor #491

Merged
merged 12 commits into from
Jan 31, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jan 29, 2019

No description provided.

@ghost ghost requested a review from justinfagnani as a code owner January 29, 2019 02:00
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="/node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to use the bundle over the loader?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easier loading process I think? i forget

docs/_includes/projects/index-typescript/index.html Outdated Show resolved Hide resolved
docs/_includes/projects/index-typescript/index.html Outdated Show resolved Hide resolved
docs/_includes/projects/index-typescript/index.html Outdated Show resolved Hide resolved
docs/_includes/projects/index-typescript/manifest.json Outdated Show resolved Hide resolved
docs/_includes/projects/index-typescript/manifest.json Outdated Show resolved Hide resolved
docs/index.md Outdated Show resolved Hide resolved
}
}

customElements.define('custom-greeting', CustomGreeting);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use the customElement decorator too:

@customElement('custom-greeting')
export class CustomGreeting extends LitElement { 

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also then have to add the interface HTMLElementTagThingStuff ?

https://github.com/Polymer/lit-element/blob/0093b439fa53e26707a84690d17bf15f54baae3e/src/lib/decorators.ts#L78

Seems noisier

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katejeffreys No, as in #291 this was changed to only be a string. Before it would actually check if the string was part of HTMLElementTagNameMap. Probably the comment in the source code should also be removed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we then remove customElements.define('custom-greeting', CustomGreeting);?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katejeffreys Yes, @customElement('custom-greeting') and customElements.define('custom-greeting', CustomGreeting); do the same thing. Only one is needed.

docs/index.md Show resolved Hide resolved
justinfagnani and others added 8 commits January 29, 2019 15:41
Co-Authored-By: katejeffreys <katejeffreys@google.com>
Co-Authored-By: katejeffreys <katejeffreys@google.com>
Co-Authored-By: katejeffreys <katejeffreys@google.com>
Co-Authored-By: katejeffreys <katejeffreys@google.com>
Co-Authored-By: katejeffreys <katejeffreys@google.com>
@ghost ghost changed the title TypeScript sample on front page with optional JS in a code editor [docs] TypeScript sample on front page with JS in a code editor Jan 29, 2019
@@ -0,0 +1 @@
import './custom-greeting.ts';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with separate files for elements in most cases (trying to show only how two elements can compose might be easier with two very small elements in one file).

The stackblitz limitations should be gone with the lit-html project template, which will hopefully be usable tomorrow. We can think about migrating to that later...

@justinfagnani justinfagnani merged commit 0273322 into master Jan 31, 2019
@justinfagnani justinfagnani deleted the mwc-tab branch January 31, 2019 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants