Skip to content

Commit

Permalink
mwModule() now return controller value, with possibility to use new …
Browse files Browse the repository at this point in the history
…clear() method
  • Loading branch information
bthieurmel committed Nov 27, 2017
1 parent e89a33e commit 64bc707
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: manipulateWidget
Type: Package
Title: Add Even More Interactivity to Interactive Charts
Version: 0.8.0
Date: 2017-10-26
Version: 0.8.1
Date: 2017-11-27
Authors@R: c(
person("Francois", "Guillem", email = "[email protected]", role = c("aut", "cre")),
person("RTE", role = "cph"),
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<!-- Copyright © 2016 RTE Réseau de transport d’électricité --->

# manipulateWidget 0.8.1 (2017-11-27)

## New features
* `mwModule()` now return `controller` value, with possibility to use new `clear()` method

# manipulateWidget 0.8.0 (2017-10-25)

## New features
Expand Down
20 changes: 15 additions & 5 deletions R/controller.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ MWController <- setRefClass(
invisible(.self)
},

clear = function(){
rm(list = ls(envir = .self, all.names = TRUE), envir = .self, inherits = TRUE)
},

setShinySession = function(output, session) {
catIfDebug("Set shiny session")
session <<- session
Expand Down Expand Up @@ -155,12 +159,15 @@ MWController <- setRefClass(

updateChart = function(chartId = 1) {
catIfDebug("Update chart", chartId)
e <- new.env(parent = envs$ind[[chartId]]) # User can set values in expr without messing environments
charts[[chartId]] <<- eval(expr, envir = e)
if (useCombineWidgets) {
charts[[chartId]] <<- combineWidgets(charts[[chartId]])
if(!is.null(envs)){
e <- new.env(parent = envs$ind[[chartId]]) # User can set values in expr without messing environments
charts[[chartId]] <<- eval(expr, envir = e)
if (useCombineWidgets) {
charts[[chartId]] <<- combineWidgets(charts[[chartId]])
}
renderShinyOutput(chartId)
}
renderShinyOutput(chartId)

},

returnCharts = function() {
Expand Down Expand Up @@ -254,6 +261,7 @@ MWController <- setRefClass(

getModuleServer = function() {
function(input, output, session, ...) {

controller <- .self$clone()

reactiveValueList <- list(...)
Expand Down Expand Up @@ -295,6 +303,8 @@ MWController <- setRefClass(
file = con, selfcontained = TRUE)
}
)

return(controller)
}
}
)
Expand Down

0 comments on commit 64bc707

Please sign in to comment.