mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Make eleventy js templates asynchronus
This commit is contained in:
parent
bb40fd294c
commit
84355645bf
4 changed files with 16 additions and 10 deletions
|
|
@ -10,7 +10,7 @@ function getCardType ( video ) {
|
|||
return VideoCard
|
||||
}
|
||||
|
||||
export default function ( videos, options = {} ) {
|
||||
export default async function ( videos, options = {} ) {
|
||||
|
||||
const {
|
||||
cardWidth = '325',
|
||||
|
|
@ -24,17 +24,19 @@ export default function ( videos, options = {} ) {
|
|||
const rowId = `row-${ uid }`
|
||||
|
||||
// Setup inline lazysizes
|
||||
this.usingComponent( 'helpers/scroll.js' )
|
||||
await this.usingComponent( 'helpers/scroll.js' )
|
||||
|
||||
// console.log('video', video)
|
||||
|
||||
const cardsHtml = videos.map( video => {
|
||||
const renderedCards = await Promise.all(videos.map( async video => {
|
||||
const Card = getCardType( video )
|
||||
|
||||
// console.log('Card', this.boundComponent(Card)( video ) )
|
||||
|
||||
return this.boundComponent(Card)( video )
|
||||
} ).join('')
|
||||
return await this.boundComponent(Card)( video )
|
||||
} ))
|
||||
|
||||
const cardsHtml = renderedCards.join('')
|
||||
|
||||
// console.log( 'cardsHtml', cardsHtml )
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue