Skip to content

About the myWidget_html function #44

@stla

Description

@stla

Hello,

Thank you for this great package. I've done a couple of packages based on it, such as shinyDatetimePicker and rAmCharts4.

I have a minor remark. The function scaffoldReactWidget generates a template R file which contains a function myWidget_html:

#' Called by HTMLWidgets to produce the widget's root element.
#' @rdname myWidget-shiny
myWidget_html <- function(id, style, class, ...) {
  htmltools::tagList(
    # Necessary for RStudio viewer version < 1.2
    reactR::html_dependency_corejs(),
    reactR::html_dependency_react(),
    reactR::html_dependency_reacttools(),
    htmltools::tags$div(id = id, class = class, style = style)
  )
}

It took me a while to understand the role of this function. The fact that it is grouped with the Shiny functions is puzzling. It is not specific to Shiny. So I would suggest to remove @rdname myWidget-shiny and to put @noRd instead (because this function has nothing to do in the documentation).

Another remark: in the Roxygen code of the template R file generated by scaffoldReactShinyInput, there is an import of restoreInput from shiny, but this function is not used (I don't know what it is by the way).

And a last one: there is a duplicated key path in webpack.config.js:

    output: {
        path: path.join(__dirname, 'inst', 'www', '${package}', 'myWidget'),
        path: path.join(__dirname, 'inst/htmlwidgets'),
        filename: 'myWidget.js'
    },

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions