我正在用 GitHub 上的简单测试来测试extendShinyJs : link。
我已经安装了 V8 包,但即使使用示例脚本,我也会收到此错误: 错误:shinyjs:解析提供的 JavaScript 代码时出错。
我还尝试将 JavaScript 代码移动到 www 文件夹下的单独文件中。
当前会话的附加信息:
> sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
知道如何运行extendShinyjs吗?
在ui.R 中:
library(shiny)
library(shinyjs)
library(shinyAce)
#library(V8)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
shinyjs::useShinyjs(),
extendShinyjs(text = "myfunc.js"),
navbarPage("Tweets stuff",
tabPanel("Contact",
sidebarLayout(
sidebarPanel(
textInput("ctFrom", "From:", value=""),
textInput("ctSubject", "Subject:", value="Sugerencias BTT"),
actionButton("ctSend", "Send")
),
mainPanel(
aceEditor("ctMessage", value="")
)
)
))
)
)
myfunc.js (in www folder):
shinyjs.pageCol = function(params){
$('body').css('background', params);
};
服务器.R:
shinyServer(function(input, output, session) {
#Programming with Twitter API
observeEvent(input$ctSend, {
#I have more things here
js$pageCol (input$ctSend)
})
}
请询问我是否认为您需要查看更多代码。我想清除“aceEditor”中的文本。
感谢您的快速帮助。