We can basically use react from bdapi

This commit is contained in:
Jean Ouina 2020-07-28 04:32:51 +02:00
parent fc6f916f39
commit 68f6898003
3 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import { ReactDOMSelector } from "./selectors"
window.ReactDOM = (window["Reac"+"tDOM"] || // If in Lightcord window.ReactDOM = (window["Reac"+"tDOM"] || // If in Lightcord
(()=>{ // If in Standard BetterDiscord (()=>{ // If in Standard BetterDiscord
try{ try{
return window.BdApi.findModule(ReactDOMSelector as any) return window.BdApi.ReactDOM
}catch(e){ }catch(e){
return null return null
} }
@ -19,7 +19,7 @@ window.ReactDOM = (window["Reac"+"tDOM"] || // If in Lightcord
})() || })() ||
(()=>{ // If in EnhancedDiscord (()=>{ // If in EnhancedDiscord
try{ try{
return window.EDApi.findModule(ReactDOMSelector as any) return window.EDApi.ReactDOM
}catch(e){ }catch(e){
return null return null
} }

View File

@ -3,7 +3,7 @@ import { ReactSelector } from "./selectors";
window.React = (window.React || // If in Lightcord window.React = (window.React || // If in Lightcord
(()=>{ // If in Standard BetterDiscord (()=>{ // If in Standard BetterDiscord
try{ try{
return window.BdApi.findModule(ReactSelector as any) return window.BdApi.React
}catch(e){ }catch(e){
return null return null
} }
@ -18,7 +18,7 @@ window.React = (window.React || // If in Lightcord
})() || })() ||
(()=>{ // If in EnhancedDiscord (()=>{ // If in EnhancedDiscord
try{ try{
return window.EDApi.findModule(ReactSelector as any) return window.EDApi.React
}catch(e){ }catch(e){
return null return null
} }

View File

@ -48,6 +48,8 @@ declare global {
EDApi: typeof bandagedbdApi.BdApi EDApi: typeof bandagedbdApi.BdApi
} }
var Lightcord:LightcordGlobal var Lightcord:LightcordGlobal
var BdApi: typeof bandagedbdApi.BdApi
var EDApi: typeof bandagedbdApi.BdApi
} }
export default LightcordApi export default LightcordApi