Package ai.platon.pulsar.skeleton.plugin
Interface LoadEventMount
-
- All Implemented Interfaces:
-
ai.platon.pulsar.skeleton.plugin.PluginMount
public interface LoadEventMount implements PluginMount
Mount point for load-phase event handlers.
The
PluginManagercalls configureLoadHandlers with the active LoadEventHandlers chain, allowing the plugin to register handlers on any load-phase hook:onNormalize— URL normalizationonWillLoad— before URL loadingonWillFetch— before fetchingonFetched— after fetch completesonWillParse— before parsingonWillParseHTMLDocument— before HTML document parsingonHTMLDocumentParsed— after HTML document parsing (data extraction)onParsed— parsing completeonLoaded— page fully loaded
class MyPlugin : LoadEventMount { override fun configureLoadHandlers(handlers: LoadEventHandlers) { handlers.onNormalize.addLast { url -> url.replace(Regex("\\?utm_.*"), "") } handlers.onHTMLDocumentParsed.addLast { page, doc -> extractData(page, doc) } } }
-
-
Method Summary
Modifier and Type Method Description abstract UnitconfigureLoadHandlers(LoadEventHandlers handlers)Called by PluginManagerto let this plugin register handlers on any load-phase event hook.-
-
Method Detail
-
configureLoadHandlers
abstract Unit configureLoadHandlers(LoadEventHandlers handlers)
Called by
PluginManagerto let this plugin register handlers on any load-phase event hook.- Parameters:
handlers- the active load event handlers chain (never null at call time)
-
-
-
-