[Sciviews-commits] r36 - komodo/SciViews-K/content/js
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jul 2 22:53:24 CEST 2008
Author: romain
Date: 2008-07-02 22:53:23 +0200 (Wed, 02 Jul 2008)
New Revision: 36
Modified:
komodo/SciViews-K/content/js/r.js
komodo/SciViews-K/content/js/robjects.js
komodo/SciViews-K/content/js/socket.js
Log:
added "context" to callback R functions to enable transfer of javascript data as well as R output in the callback function
Modified: komodo/SciViews-K/content/js/r.js
===================================================================
--- komodo/SciViews-K/content/js/r.js 2008-07-02 20:51:30 UTC (rev 35)
+++ komodo/SciViews-K/content/js/r.js 2008-07-02 20:53:23 UTC (rev 36)
@@ -94,10 +94,11 @@
// " koCmd('alert(\"koCmd is back\");')", earlyExit = true);
// Evaluate R expression and call procfun in Komodo with the result as argument
-sv.r.evalCallback = function(cmd, procfun) {
+// context might be used to pass additional data as the second argument of procfun
+sv.r.evalCallback = function(cmd, procfun, context) {
// Evaluate a command in hidden mode (contextual help, calltip, etc.)
// and call 'procfun' at the end of the evaluation
- var res = sv.socket.rCommand("<<<h>>>" + cmd, false, null, procfun);
+ var res = sv.socket.rCommand("<<<h>>>" + cmd, false, null, procfun, context);
return(res);
}
Modified: komodo/SciViews-K/content/js/robjects.js
===================================================================
--- komodo/SciViews-K/content/js/robjects.js 2008-07-02 20:51:30 UTC (rev 35)
+++ komodo/SciViews-K/content/js/robjects.js 2008-07-02 20:53:23 UTC (rev 36)
@@ -214,6 +214,14 @@
// Make sure to check .GlobalEnv at the beginning
// TODO: persitently save user's selection using Komodo mechanism
-sv.r.objects.packageSelected(".GlobalEnv", true);
+// sv.r.objects.packageSelected(".GlobalEnv", true);
sv.r.objects.debug = false ;
+
+sv.robjects.refreshPackage = function(pack){
+ if( sv.r.objects.__isSelected(pack) ){
+ // TODO: there is probably a better way
+ sv.r.objects.packageSelected(".GlobalEnv", false);
+ sv.r.objects.packageSelected(".GlobalEnv", true);
+ }
+}
Modified: komodo/SciViews-K/content/js/socket.js
===================================================================
--- komodo/SciViews-K/content/js/socket.js 2008-07-02 20:51:30 UTC (rev 35)
+++ komodo/SciViews-K/content/js/socket.js 2008-07-02 20:53:23 UTC (rev 36)
@@ -117,12 +117,12 @@
}
// Send an R command through the socket
-sv.socket.rCommand = function(cmd, echo, echofun, procfun) {
+sv.socket.rCommand = function(cmd, echo, echofun, procfun, context) {
cmd = sv.tools.strings.replaceCRLF(cmd, "<<<n>>>");
if (procfun == null) { // Do nothing at the end
var listener = { finished: function(data) {} }
} else { // Call procfun at the end
- var listener = { finished: function(data) { procfun(data); } }
+ var listener = { finished: function(data) { procfun(data, context); } }
}
// TODO: deal with error checking for this command
var port = sv.prefs.getString("sciviews.client.socket", "8888");
More information about the Sciviews-commits
mailing list