These are chat archives for canjs/canjs

26th
Aug 2018
Frank Lemanschik
@frank-dspeed
Aug 26 2018 10:58
@kaderiho i solve that via a next Tick operation after the async operation
so for example if the async operation is fetching data and returning a promise i simply integrate at that point a next tick operation or a timer to get next tick
a other nice way is also if its a standart async operation that returns a promise to call a function inside the stache template once promise is resolved
a example where i am using that is a animated gallery that i init after the stache template is rendered and data is fetched
via the stache template
Frank Lemanschik
@frank-dspeed
Aug 26 2018 11:06
{{#if listArtist.isResolved}}
    <div  on:inserted="initGallery()" class="justified-gallery justifiedGallery" id="puppies">
        {{#listArtist.value}}
        <!-- https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQN8oh9a91sQGeOjg7DwZFAaecnWnLlUoVEREk-yDlbr75vcbHG  on:click="doSomething(%element)"-->

          <div id="{{_id}}">
            <a  href="{{routeUrl ( page='details'  )}}&artistId={{_id}}"><img alt="{{name}}" data-artist-id="{{_id}}"  src="http://master.peep:3030/bilder/{{_id}}/{{mainImage}}" /></a>
          </div>

        {{/listArtist.value}}
        <br />
    </div>
    <a href="{{routeUrl ( page='session' )}}"><button style="width: 100%;" class="btn btn-success">BUCHUNG ABSCHLIESSEN</button></a>
    {{/if}}
look at the on:inserted
this is for example one easy way to fire a function after data is Resolved
Frank Lemanschik
@frank-dspeed
Aug 26 2018 11:15
but if your a current canjs user you need to import something to make this on:inserted work again
as far as i remember