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

Add a componentReady event #99

Merged
merged 7 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,13 @@ <h2 id="events">Events</h2>
</td>
<td>Fired when the displayed month or year changes.</td>
</tr>
<tr>
<td>componentReady</td>
<td>
<code>CustomEvent&lt;void&gt;</code>
</td>
<td>Fired when this component is fully loaded at the first render.</td>
</tr>
</tbody>
</table>
</div>
Expand All @@ -739,7 +746,12 @@ <h2 id="events">Events</h2>
datepicker.addEventListener('selectDate', function(event) {
console.log(event.detail);
});
&lt;/script&gt;</code></pre>

datepicker.addEventListener('componentReady', function(event) {
console.log(datepicker.startDate);
});
&lt;/script&gt;
</code></pre>
</section>

<section>
Expand Down
3 changes: 3 additions & 0 deletions src/components/inclusive-dates/inclusive-dates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ export class InclusiveDates {

@Event() selectDate: EventEmitter<string | string[] | undefined>;

@Event() componentReady: EventEmitter<void>;

private modalRef?: HTMLInclusiveDatesModalElement;
private inputRef?: HTMLInputElement;
private calendarButtonRef?: HTMLButtonElement;
Expand All @@ -148,6 +150,7 @@ export class InclusiveDates {
private errorMessage = "";

componentDidLoad() {
this.componentReady.emit();
if (!this.id) {
console.error(
'inclusive-dates: The "id" prop is required for accessibility'
Expand Down
Loading