Pages Html

NuGet packageOwin.Framework.Pages.Html
GitHub sourceOwinFramework.Pages.Html

Home |  Readme

[DeployFunction] attribute | The OWIN Framework Pages

The [DeployFunction] Attribute

You can attach one or more of these attributes to any visual element and it will cause a Javascript function to be included in any page containing that element. Where the Javascript will be rendered is defined by the [DeployedAs] attribute.

This attribute is useful for very small amounts of Javascript that is very specific to this element. It is recommended that larger amounts of Javascript should be contained in a Javascript file instead.

Note that even if this element is rendered many times on the pages, the Javascript function will only be rendered once.

Example Usage

[DeployFunction(null, "sayHello", null, "alert('Hello');")]
internal class MyComponent { }

The [DeployFunction()] attribute has the following properties you can set.


Must be a syntactically valid Javascript function name that is unique within the package namespace. The namespace is defined by the [PartOf()] attribute attached to the element.

This function can be called directly from any other function in the same package namespace. To call this function from another namespace the function name must be qualified with the ns.{namespace}. prefix, where {namespace} is the namespace of the package containing the function you want to call.


The type of data returned by the function is provided here for documentation only. Javascript does not have strong typing, so this property has no impact on the execution of the function.


This is a comma separated list of parameters that can be passed to the function. Note that all parameter values are optional in Javascript.


This is the body of the Javascript function. You do not need to enclose this in curly braces, these will be added automatically.


Setting this value to false will make this function only visible within the namespace where it is defined.