Closed BorisMoore closed 7 years ago
Closing for now since deferred to "After V1"
I was unable to determine the difference with the new version v0.9.89 trying to move from v0.9.82 (the actual code is at line 24: https://thither.direct/static/jsviews/app3.js) in order to use the onAfterLink: function(tagCtx) { var tag = this, vw = tag.view;
this.view is undefined. and to use this as the view, the .refresh(); is not doing well.
Thanks, Kashirin Alex
Ah yes, there was a change in v0.9.86 in which the property tag.view
(or this.view
in the context of the onAfterLink
) was moved to this.tagCtx.contentView
.
One of the reasons for the change was that if you have a custom tag with {{else}}
blocks, then there is a content view for each block - this.tagCtxs[i].contentView
. Previously those views were difficult to access, since the this.view
in fact became the content view for the last {{else}}
block.
I called out the change here, but should have also indicated the breaking change aspect that tagCtx.contentView replaced tag.view.
OK, great , it is working.
I have not seen the changes of the commit might could have notice.
Thanks, Kashirin Alex
See https://github.com/BorisMoore/jsrender/issues/289#issuecomment-280941389
Proof of concept below, but a future support might be more generic and let you make any tag asynchronous, along the lines of:
{^{someTag fetch="..."/}}
- just as any tag can now have a tmpl property: '{^{someTag tmpl="..."/}}'.tmpl as promise: It could take the form of supporting setting the tmpl property to a promise, which would automatically lead to the async behavior - with a view refresh with the returned template when the promise resolves...