Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

Problem on setting global

globalwormingglobalworming Moderators
edited July 2014 in Sahi - Open Source
In this testscript, the logName function is not saved in the global:
function $anObject($name) {
  var $this=this;
  $this.name=$name
}

$anObject.prototype.logName = function(){
  $this=this;
  _log($this.name);
}

var $instance = new $anObject("instance of anObject");

//works
$instance.logName();

_setGlobal("instance", $instance);

var $globalInstance = _getGlobal("instance");

//does not work
$globalInstance.logName();

Is there an easy workaround for this issue?

Regards
Wormi
Sign In or Register to comment.