WinJS.Utilities.markSupportedForProcessing function

1 out of 5 rated this helpful - Rate this topic

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

Syntax


var function = 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. When you mark a function as supported for declarative processing, you are guaranteeing that the code in the function is secure from 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

Namespace

WinJS.Utilities

Library

Base.js

 

 

Build date: 12/5/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.