Skip to content

Commit

Permalink
put setHook() in a branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Dec 3, 2024
1 parent f9e65e2 commit 34c7ea0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/onLoad.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@
# no delayed registration support for NAMESPACE; perform it manually
if (isNamespaceLoaded("knitr")) {
registerS3method("knit_print", "data.table", knit_print.data.table, envir = asNamespace("knitr"))
} else {
setHook(packageEvent("knitr", "onLoad"), function(...) {
registerS3method("knit_print", "data.table", knit_print.data.table, envir = asNamespace("knitr"))
})
}
setHook(packageEvent("knitr", "onLoad"), function(...) {
registerS3method("knit_print", "data.table", knit_print.data.table, envir = asNamespace("knitr"))
})
}

# Set options for the speed boost in v1.8.0 by avoiding 'default' arg of getOption(,default=)
Expand Down

0 comments on commit 34c7ea0

Please sign in to comment.