Skip to end of metadata
Go to start of metadata

[10:11:27 CST(-0600)] <sgithens> hey

[10:11:51 CST(-0600)] <sgithens> I know we're all up on 0.8 now, but do we know if the GPII will run on node 0.6, or does it depend on stuff in 0.8

[10:12:00 CST(-0600)] <sgithens> even if just minimally

[15:19:44 CST(-0600)] <anastasiac> Bosmon, I have a question about the new lifecycle events. Do you have a minute?

[15:20:01 CST(-0600)] <Bosmon> hi, anastasiac

[15:20:19 CST(-0600)] <anastasiac> well, I'm not 100% sure if my question is about the new lifecycle events specifically, or about options merging for the emptySubcomponent (smile)

[15:21:02 CST(-0600)] <anastasiac> I'm using a demands block to choose between an emptySubcomponent (the default) and another subcomponent that does something useful (based on a demands block)

[15:21:21 CST(-0600)] <anastasiac> I have other things that are waiting for the one or the other to be attached (regardless of which)

[15:21:33 CST(-0600)] <anastasiac> so I'm sharing the onAttach event with an event in the parent

[15:21:41 CST(-0600)] <anastasiac> it doesn't seem to be working for the subcomponent

[15:21:45 CST(-0600)] <anastasiac> should I expect it to?

[15:24:45 CST(-0600)] <anastasiac> (that should have said "doesn't seem to be working for the emptySubcomponent")

[15:31:15 CST(-0600)] <Bosmon> Yes

[15:31:21 CST(-0600)] <Bosmon> Well, emptySubcomponent is no component

[15:31:24 CST(-0600)] <Bosmon> And so will fire no events

[15:32:21 CST(-0600)] <anastasiac> ah, right

[15:32:57 CST(-0600)] <anastasiac> so I'll need a super-simple eventedComponent instead of the emptySubcomponent, then

[15:33:18 CST(-0600)] <Bosmon> Yes

[15:33:22 CST(-0600)] <Bosmon> Although it seems a little suspicious

[15:33:29 CST(-0600)] <Bosmon> What is the activity that is being waited for?

[15:33:35 CST(-0600)] <anastasiac> any suggestions for alternate ways?

[15:33:39 CST(-0600)] <anastasiac> here's what I'm doing:

[15:34:10 CST(-0600)] <anastasiac> the video player controllers subcomponent encapsulates 6 controls: play, volume, scrubber, captions, transcripts and full-screen

[15:34:25 CST(-0600)] <anastasiac> the controllers "onReady" shouldn't really fire until all 6 kids are ready

[15:34:41 CST(-0600)] <anastasiac> but two of the kids aren't necessary, depending on browser capabilities (hence the emptySubcomponent)

[15:34:54 CST(-0600)] <Bosmon> Ah, that is fascinating

[15:34:57 CST(-0600)] <anastasiac> so if I don't know whether or not they'll instantiate, how do I know when to fire "onReady"?

[15:35:06 CST(-0600)] <anastasiac> I was going to aggregate all the onAttach events

[15:35:19 CST(-0600)] <anastasiac> but that wouldn't work with emptySubcomponents, as you point out

[15:35:25 CST(-0600)] <Bosmon> Yes well

[15:35:48 CST(-0600)] <Bosmon> One way out of the issue is to contribute something to each of their grades representing something resembling a "waitableComponent" or some such

[15:36:14 CST(-0600)] <Bosmon> This can fire a special event during preInit, or simply directly update a piece of model, in order to increment a counter

[15:36:21 CST(-0600)] <Bosmon> Indicating that "x components now need to be waited for"

[15:36:54 CST(-0600)] <Bosmon> This count then gets decremented on each of the onAttach or onReady etc... whichever the appropriate lifecycle of the supercomponent is

[15:37:13 CST(-0600)] <Bosmon> The empty components will neither fire the first event nor the 2nd

[15:37:26 CST(-0600)] <Bosmon> But something seems odd though, in that onAttach events should all be synchronous

[15:37:31 CST(-0600)] <anastasiac> so then I would not use an aggregate event in the parent, but rather code in the final init 'count down'

[15:38:14 CST(-0600)] <anastasiac> what do you mean by "the onAttach events should all be synchronous"?

[15:38:29 CST(-0600)] <anastasiac> do you mean that if even one of them has fired, then we can assume that all children have been attached?

[15:38:55 CST(-0600)] <Bosmon> Well, I mean that if it is good enough to wait for the "last onAttach" of a child, it should be good enough to wait for "onCreate" of the parent

[15:39:17 CST(-0600)] <anastasiac> ah

[15:39:29 CST(-0600)] <Bosmon> Unless there is any condition which might delay some readiness of the children due to some genuinely asynchronous event, you should be able to deterministically work out when they are all ready

[15:39:34 CST(-0600)] <anastasiac> so the parent's onAttach would trigger the parent's onReady

[15:39:35 CST(-0600)] <Bosmon> Since a parent cannot be ready until its last child is ready

[15:40:04 CST(-0600)] <Bosmon> Yes

[15:40:22 CST(-0600)] <anastasiac> wait, I thought onAttach is fired when a component is attached to its parent

[15:40:29 CST(-0600)] <Bosmon> yes, that's right

[15:40:29 CST(-0600)] <anastasiac> what if you're waiting for the very root to be ready?

[15:40:37 CST(-0600)] <Bosmon> The very root doesn't fire anything (smile)

[15:40:43 CST(-0600)] <Bosmon> You can depend on everything to fire onCreate though

[15:40:56 CST(-0600)] <anastasiac> onCreate is after onAttach?

[15:41:21 CST(-0600)] <Bosmon> onCreate is before onAttach....

[15:42:05 CST(-0600)] <anastasiac> when will the root's onCreate fire, with respect to the children's attachment? after?

[15:42:13 CST(-0600)] <Bosmon> After

[15:42:18 CST(-0600)] <anastasiac> ah

[15:42:25 CST(-0600)] <anastasiac> so it sound like onCreate is what I'm looking for!

[15:42:30 CST(-0600)] <Bosmon> Hopefully (smile)

[15:42:38 CST(-0600)] <anastasiac> I'll let you know (smile)

[15:43:22 CST(-0600)] <anastasiac> thanks so much, Bosmon, this was very helpful

  • No labels