Skip to content
This repository has been archived by the owner on Mar 5, 2018. It is now read-only.

Implement lifecycle hooks #16

Closed
1 of 4 tasks
tomdale opened this issue Mar 23, 2017 · 5 comments
Closed
1 of 4 tasks

Implement lifecycle hooks #16

tomdale opened this issue Mar 23, 2017 · 5 comments

Comments

@tomdale
Copy link
Contributor

tomdale commented Mar 23, 2017

  • didInsertElement (no this.element yet due to Glimmer bug)
  • didRender
  • didUpdate
  • willDestroy
@habdelra
Copy link
Contributor

habdelra commented Apr 4, 2017

@tomdale how about a didReceiveAttrs? Where the component has received the attrs, but has not yet rendered?

@locks
Copy link
Contributor

locks commented Apr 4, 2017

@habdelra those are likely to come out of an RFC

@habdelra
Copy link
Contributor

habdelra commented Apr 11, 2017

@tomdale For my purposes I need a hook for after the DOM has been updated (we were calling this didRender from the Monegraph "proto standalone-glimmer" days.

My use case is that I'm using a <video> element that gets it source from a tracked property. When the source changes I need to tell the video element to load() using the HTML5 media API.

Looking at what you have above, it looks like you are proposing a didRender hook, which would suit my needs perfectly. However, in the currently existing didUpdate() hook, this comment appears, https://github.com/glimmerjs/glimmer-component/blob/master/src/component.ts#L189, which seems to indicate that didUpdate() is invoked after the component has rerendered itself. But when I actually try it out, I see that that is definitely not the case. Is the comment just incorrect?

Here's a simple little glimmerjs project demonstrating this: https://github.com/habdelra/glimmerjs-didUpdate-hook


EDIT: I actually logged this issue as: #51

@tschoartschi
Copy link

I would also need some kind of didReceiveAttrs

@rwjblue
Copy link
Member

rwjblue commented Mar 5, 2018

This repo has been merged with glimmerjs/glimmer.js (into a monorepo setup). I am not sure if this issue is still applicable, but if you could confirm it is still an ongoing concern and open it over there that would be very helpful.

Sorry for the noise, but thank you for your help!

@rwjblue rwjblue closed this as completed Mar 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants