Skip to content

Commit

Permalink
Propagate more events to EventListener
Browse files Browse the repository at this point in the history
In particular:
 * manifestReady
 * codeLoadSkippedNotFresh
  • Loading branch information
squarejesse committed Jan 18, 2024
1 parent 603b846 commit ec08981
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ public open class EventListener {
) {
}

/**
* Invoked when a code load is skipped because the cached code isn't up-to-date.
*
* @param startValue the value returned by [codeLoadStart] for the start of this call. This
* is null unless [codeLoadStart] is overridden to return something else.
*/
public open fun codeLoadSkippedNotFresh(
startValue: Any?,
) {
}

/**
* Invoked when a code load fails.
*
Expand Down Expand Up @@ -190,6 +201,15 @@ public open class EventListener {
) {
}

/**
* Invoked when the loader has successfully fetched a manifest, verified it (if necessary), and
* will proceed to download and load each of its modules.
*/
public open fun manifestReady(
manifest: ZiplineManifest,
) {
}

/**
* Invoked when a module load starts. This is the process of loading code into QuickJS.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ internal class RealEventPublisher(
listener.codeLoadSkipped(startValue)
}

override fun applicationLoadSkippedNotFresh(
applicationName: String,
manifestUrl: String?,
startValue: Any?,
) {
listener.codeLoadSkippedNotFresh(startValue)
}

override fun applicationLoadFailed(
applicationName: String,
manifestUrl: String?,
Expand Down Expand Up @@ -115,6 +123,14 @@ internal class RealEventPublisher(
listener.manifestVerified(manifest, verifiedKey)
}

override fun manifestReady(
applicationName: String,
manifestUrl: String?,
manifest: ZiplineManifest,
) {
listener.manifestReady(manifest)
}

override fun moduleLoadStart(zipline: Zipline, moduleId: String): Any? {
return listener.moduleLoadStart(moduleId)
}
Expand Down

0 comments on commit ec08981

Please sign in to comment.