# Features - Filters now control what types of modules they see. - Filters can be reinstantiated via `.new()` - Added the `Not` type in @revenge-mod/utils/types # Fixes - Pitfall with `lookupModules` and `withDependencies` without `uninitialize: true` fixed. - Filter type-metadata is now stored in a single object instead of multiple parameters. - Incorrect caching behavior for `lookupModules` where cache always reports not found if you finish the iterator. - Also attempt to report not found when using `lookupModule`.
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { lookupModule } from '@revenge-mod/modules/finders'
|
|
import {
|
|
withDependencies,
|
|
withName,
|
|
} from '@revenge-mod/modules/finders/filters'
|
|
import { proxify } from '@revenge-mod/utils/proxy'
|
|
import type { DiscordModules } from '../types'
|
|
|
|
const [, _createClassModuleId] = lookupModule(withName('_createClass'))
|
|
const [, _classCallCheckModuleId] = lookupModule(withName('_classCallCheck'))
|
|
|
|
// ../discord_common/js/shared/utils/TypedEventEmitter.tsx
|
|
/**
|
|
* Do not use the `error` event, as the module will handle it specially for some reason.
|
|
*/
|
|
export let TypedEventEmitter: typeof DiscordModules.Utils.TypedEventEmitter =
|
|
proxify(() => {
|
|
const [module] = lookupModule(
|
|
withName<typeof DiscordModules.Utils.TypedEventEmitter>(
|
|
'TypedEventEmitter',
|
|
).and(
|
|
withDependencies([
|
|
_classCallCheckModuleId,
|
|
_createClassModuleId,
|
|
[],
|
|
2,
|
|
]),
|
|
),
|
|
)
|
|
|
|
if (module) return (TypedEventEmitter = module)
|
|
})!
|