ibm-js / delite

HTML Custom Element / Widget infrastructure
http://ibm-js.github.io/delite/
Other
68 stars 28 forks source link

DisplayContainer: Extracting method for loading a child #418

Closed EAlexRojas closed 9 years ago

EAlexRojas commented 9 years ago

The show() and hide() methods load a child before show it or hide it, but sometimes the widget could want only to load a child dynamically, either by using a controller to load it or using its own load() method.

In this PR I take the common code used on the show() and hide() methods related to loading a child and I extract it to a new method -> loadChild() (This name has to be discussed in order to avoid confusion between this method and the load() method)

wkeese commented 9 years ago

Seems basically fine to me.

My only question is whether we need both a loadChild() and a load() method. Theoretically load() exists so an application or subclass can override it. AFAICT no one is actually doing that though. And if an application did want to override existing behavior, then couldn't it just override loadChild()? Overriding loadChild() is more powerful than overriding load() because the former can return a promise. @cjolif, thoughts?

cjolif commented 9 years ago

@wkeese

That said I'm fine with dropping load(). So if @wkeese is still in favor of that, @EAlexRojas I suggest you drop it.

wkeese commented 9 years ago

I didn't realize that load() could return a Promise but yes, I'm still in favor of dropping load().

EAlexRojas commented 9 years ago

I updated the PR dropping load()

wkeese commented 9 years ago

Cool. I pushed this as 7cfadc1409d31269e19de7c9901ed8de080d9ce7.