Closed izaakschroeder closed 9 years ago
Also your CI is broken. Can't find module graceful-fs
Humm. This is counter to some of the performance changes we just made due to the .call
usage that we are now trying to avoid and also impacts the API a bit. What if we instead added a 3rd parameter to getViewInstance that would allow the context to be passed?
Something like:
Thorax.Util.getViewInstance(this.itemView, viewOptions, this)
This would remain backwards compatible and require little overhead vs. the current implementation.
NB: Tests need to be written for this yet.
Normally the
itemView
property of aThorax.CollectionView
expects either a string or aThorax.View
constructor. We just tweak the checks ingetViewInstance
to be smarter about detecting whether the function is a constructor of aThorax.View
or not; if it is a constructor it behaves just as before, and if not we attempt to invoke it as a method of the parent view (by passingthis
through).