mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -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
|
||||
*/
|
||||
@@ -36,6 +39,16 @@ export function onVisible<T extends 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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user