OpenWGA 7.7 - TMLScript reference

WGA » WGA.Master
Method :

runMethod(object, function [, param1, param2 ...])

On object WGA.Master
Usage Runs the method of a custom TMLScript object under master session rights
Description

This the pendant of WGA.Master.runFunction() for execution methods of custom TMLScript objects. It additionally receives the current object as parameter "object". 

The given function to execute as method will have access to that object and its public members via "this" object and to the private (scope) members via scope, just as usual for a JavaScript method.

runMethod() lacks a context parameter that is available for runFunction(). Executing object methods under custom contextes is not possible as this would break the relation of the method to its object.

Parameters

object (JavaScript object):

The TMLScript object whose method to call under master rights

function (JavaScript function):

The method function to run under master session rights.

param1...paramN (Object, optional):

Parameters that will be given to the method as function parameters (NOT WebTML action parameters!)
Examples An example of a custom TMLScript object definition. There is a public method "outerMethod" which calls the private method "theMasterMethod" under master session rights. This private method therefor has access to the public field of this object:

this.publicField = "abc";


function theMasterMethod(p1) {
  return "Called with param " + p1 + " and receiving public field " + this.publicField;
}


this.outerMethod = function(param1) {
  return WGA.Master.runMethod(this, theMasterMethod, param1);
}