let _ddragon ; export function ddragon ( ) { if ( _ddragon ) return _ddragon ; fetch ( "https://ddragon.leagueoflegends.com/api/versions.json" ) . then ( x => x . json ( ) ) . then ( versions => { _ddragon = versions [ 0 ] ; } ) ; return "10.6.1" ; } export interface Champion { id : string ; key : string ; name : string ; } let _champions = [ ] ; export async function champions ( ) { if ( _champions . length ) return _champions ; const verReq = await fetch ( "https://ddragon.leagueoflegends.com/api/versions.json" ) ; const versions = await verReq . json ( ) ; _ddragon = versions [ 0 ] ; const champReq = await fetch ( "https://ddragon.leagueoflegends.com/cdn/" + versions [ 0 ] + "/data/en_US/champion.json" ) ; const champs = await champReq . json ( ) ; return _champions = Object . keys ( champs . data ) . map ( x => champs . data [ x ] ) ; } export const API_HOST = "https://orianna.molenzwiebel.xyz" ;