mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-22 14:09:30 -07:00
feat(utils.ts): add loadGsap and loadSwiper function to asynchronously load library
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
import { type Power3, type gsap } from 'gsap'
|
||||||
|
import { type Swiper } from 'swiper'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* custom helpers
|
* custom helpers
|
||||||
*/
|
*/
|
||||||
@@ -36,6 +39,16 @@ export function onVisible<T extends Element>(
|
|||||||
}).observe(element)
|
}).observe(element)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function loadGsap(): Promise<[typeof gsap, typeof Power3]> {
|
||||||
|
const g = await import('gsap')
|
||||||
|
return [g.gsap, g.Power3]
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function loadSwiper(): Promise<typeof Swiper> {
|
||||||
|
const s = await import('swiper')
|
||||||
|
return s.Swiper
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* custom types
|
* custom types
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user