通过sendCustomMessage在邮件发送的js字符串中插入换行符的方法是什么?
rm(list = ls())
library(shiny)
ui =fluidPage(
tags$head(tags$script(HTML('Shiny.addCustomMessageHandler("jsCode",function(message) {eval(message.value);});'))),
actionButton("click","click to send message")
)
server = function(input, output, session) {
observe({
if(!is.null(input$click)){
string_to_break <-"alert(\"Line1. Line2.\");"
session$sendCustomMessage(type='jsCode', list(value = string_to_break ))
}
})
}
runApp(list(ui = ui, server = server))
由于