From 1d5aa07eaa5177caca24e6176782aa3223f26324 Mon Sep 17 00:00:00 2001 From: Dean Attali Date: Fri, 23 Sep 2016 20:13:00 -0700 Subject: [PATCH] implement tip 8c: Support chaining API functions with pipes (`%>%`) --- NAMESPACE | 2 ++ R/timevisBasic.R | 7 ++++++- man/reexports.Rd | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 man/reexports.Rd diff --git a/NAMESPACE b/NAMESPACE index 05c6bdc..0d2241e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,9 @@ # Generated by roxygen2: do not edit by hand +export("%>%") export(addCustomTime) export(renderTimevis) export(setWindow) export(timevis) export(timevisOutput) +importFrom(magrittr,"%>%") diff --git a/R/timevisBasic.R b/R/timevisBasic.R index 38c4019..d4b1bbb 100644 --- a/R/timevisBasic.R +++ b/R/timevisBasic.R @@ -108,6 +108,7 @@ callJS <- function() { session <- shiny::getDefaultReactiveDomain() method <- paste0("timevis:", message$method) session$sendCustomMessage(method, message) + return(message$id) } #' @export @@ -120,4 +121,8 @@ setWindow <- function(id, start, end, options) { addCustomTime <- function(id, time, itemId) { method <- "addCustomTime" callJS() -} \ No newline at end of file +} + +#' @importFrom magrittr %>% +#' @export +magrittr::`%>%` \ No newline at end of file diff --git a/man/reexports.Rd b/man/reexports.Rd new file mode 100644 index 0000000..8139178 --- /dev/null +++ b/man/reexports.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/timevisBasic.R +\docType{import} +\name{reexports} +\alias{\%>\%} +\alias{reexports} +\title{Objects exported from other packages} +\description{ +These objects are imported from other packages. Follow the links +below to see their documentation. + +\describe{ + \item{magrittr}{\code{\link[magrittr]{\%>\%}}} +}} +\keyword{internal} +