2025-06-03 16:24:58 +07:00
|
|
|
import * as AssetsLibrary from '@revenge-mod/assets'
|
2025-05-18 22:24:48 +07:00
|
|
|
import { onRunApplication } from '@revenge-mod/react/native'
|
2025-07-05 13:12:57 +07:00
|
|
|
import { initPlugin, pList, startPlugin } from './_internal'
|
|
|
|
|
import { pUnscopedApi } from './apis'
|
2025-05-18 22:24:48 +07:00
|
|
|
import { react } from './apis/react'
|
|
|
|
|
import { PluginFlags } from './constants'
|
|
|
|
|
import type { UnscopedInitPluginApi } from './types'
|
|
|
|
|
|
|
|
|
|
// Setup init plugin APIs
|
2025-07-05 13:12:57 +07:00
|
|
|
const uapi = pUnscopedApi as UnscopedInitPluginApi
|
2025-04-29 21:38:14 +07:00
|
|
|
uapi.assets = AssetsLibrary
|
2025-05-18 22:24:48 +07:00
|
|
|
uapi.react = react
|
|
|
|
|
|
2025-07-05 13:12:57 +07:00
|
|
|
for (const plugin of pList.values())
|
2025-06-03 16:24:58 +07:00
|
|
|
if (plugin.flags & PluginFlags.Enabled) initPlugin(plugin)
|
2025-05-18 22:24:48 +07:00
|
|
|
|
|
|
|
|
const unsub = onRunApplication(() => {
|
|
|
|
|
unsub()
|
2025-04-29 21:38:14 +07:00
|
|
|
|
2025-07-05 13:12:57 +07:00
|
|
|
for (const plugin of pList.values())
|
2025-06-03 16:24:58 +07:00
|
|
|
if (plugin.flags & PluginFlags.Enabled) startPlugin(plugin)
|
2025-04-29 21:38:14 +07:00
|
|
|
})
|