Function: createFilterMiddleware()
createFilterMiddleware(
options
: {allowList?
:string
[];blockList?
:string
[];condition?
: (event
:string
,data
:unknown
) =>boolean
; }):EventMiddleware
Defined in: electron/events/middleware.ts:423
Filter middleware that can block certain events based on conditions.
Parameters
options
Configuration options for event filtering
allowList?
string
[]
blockList?
string
[]
condition?
(event
: string
, data
: unknown
) => boolean
Returns
EventMiddleware function that filters events based on allow/block lists or custom conditions
Remarks
Options include:
allowList
: Array of event names to allow (blocks all others)blockList
: Array of event names to blockcondition
: Custom function to determine if an event should be processed
Example
const filterMiddleware = createFilterMiddleware({
allowList: ["user:login", "user:logout"],
condition: (event, data) => event.startsWith("user:"),
});
eventBus.use(filterMiddleware);