Compartir a través de


WinJS.Utilities.markSupportedForProcessing function

Marks a function as being compatible with declarative processing. Declarative processing is performed by WinJS.UI.processAll or WinJS.Binding.processAll.

Syntax

var functionRef = WinJS.Utilities.markSupportedForProcessing(func);

Parameters

  • func
    Type: Function

    The function to be marked as compatible with declarative processing.

Return value

Type: Function

The input function, marked as compatible with declarative processing.

Remarks

All functions that have been declared using WinJS.Class.define, WinJS.Class.derive, WinJS.UI.Pages.define, or WinJS.Binding.converter are automatically marked as supported for declarative processing. Any other function that you use from a declarative context (that is, a context in which an HTML element has a data-win-control or data-win-options attribute) must be marked manually by calling this function.

Caution  A function that is marked as supported for declarative processing can be called from static HTML, potentially allowing an attacker to perform privileged actions. For this reason, only mark a function as supported for declarative processing if you are completely confident that it is secure from the injection of third-party content.

 

Examples

The following code shows how to use this function. If randomizeValue had not been set with WinJS.Utilities.markSupportedForProcessing, WinJS.Utilities.requireSupportedForProcessing would throw an exception.

function randomizeValue() {
     var value = Math.floor((Math.random() * 1000) % 8);
     if (value < 0)
          value = 0;
     else if (value > 9)
          value = 9;
      return value;
}

WinJS.Utilities.markSupportedForProcessing(randomizeValue);

WinJS.Utilities.requireSupportedForProcessing(randomizeValue);

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Utilities