Clear Up
SharpKit Reference

JsTypeAttribute Class

Sets the rules that SharpKit will use when converting this .NET type into JavaScript. This attribute can be used on any type, and as assembly attribute, when used as an assembly attribute, and TargetType is not supplied, it will affect ALL types in the assembly

Namespace: SharpKit.JavaScript

Base Types

System.Attribute

Base Interfaces

System.Runtime.InteropServices._Attribute

Constructors

Name Description
JsTypeAttribute() Creates an instance of a JsTypeAttribute
JsTypeAttribute(JsMode) Creates an instance of a JsTypeAttribute in the specified JsMode
JsTypeAttribute(JsMode, string) Creates an instance of a JsTypeAttribute in the specified JsMode, and exported to the specified filename

Properties

Name Description
AutomaticPropertiesAsFields Forces all automatic properties to be treated as JavaScript native fields without any getter and setter methods
Export Indicates that SharpKit compiler will generate javascript code for this type / member This property is inherited and applied to all derived types. Default value is true
Exporter The type of js exporter to use
Filename The target filename to generate the javascript code into, when using a relative path, it will be relative to the current cs file, You may use the ~ (tilda) operator to designate the project directory
ForceDelegatesAsNativeFunctions Forces any delegate used in the current type to be created a native js function without an instance context
GlobalObject When set, the class methods and properties will be declared on the window object, instead of a class.
IgnoreGenericMethodArguments Omits and ignores any generic argument in any method inside the class (Equivalent to JsMethod(IgnoreGenericArguments=true) on each method)
IgnoreGenericTypeArguments Omits and ignores any generic type argument
InlineFields Declares fields and PropertiesAsFields in object definition, and does not move them to the constructor
Mode Controls the JavaScript mode of this type, a mode is a combination of several boolean settings of the JsTypeAttribute
Name When set, changes the type name in the client code
Native Indicates that this type will be exported as native js type, only one constructor is allowed, all instance members will be exported to the constructor's prototype all static members will be exported to the constructor's members
NativeArrayEnumerator When true, foreach statements will use the for loop syntax of Javascript
NativeCasts When set to true, casting/as/is will be generated using the native "instanceof" keyword
NativeConstructors When true, instanciations of this class will use the native Javascript method, rather than calling a constructor
NativeDelegates Indicates that all delegate parameters in all members are native javascript functions
NativeEnumerator When true, foreach statements will use the for..in syntax of Javascript
NativeError Treats the class as a native "Error" object and prevents smart exception throwing
NativeFunctions Any anonymous delegate creation will be exported as a native inline function in javascript
NativeJsons Anonymous objects will be created and treated as Json objects
NativeOperatorOverloads When true, operator overloads will be exported as native js binary operations: if System.Int32 has a '/' operator overload then: x / y -> System.Int32.op_div(x, y); //NativeOperatorOverloads=false x / y -> x / y; //NativeOperatorOverloads=true
NativeOverloads When true, instanciations of this class will use the native Javascript method, rather than calling a constructor
NativeParams When set to true - SharpKit will ignore all params[] keywords in all methods
OmitCasts When true, omits all casts to this type
OmitDefaultConstructor When set to true, if no instance constructor was defined in this class, no constructor will be generated. This is helpful when extending existing classes, and avoiding overwriting existing constructors
OmitInheritance Specifies whether or not to declare inheritance of a class to a base class
OmitOptionalParameters Omits optional parameters in methods, when not sent by caller
OrderInFile Precendece between JsTypes in the same file, negative values will put the type before other types, and positive value will put it after other types
PostCode Js code that will be written after exporting the type
PreCode Js code that will be written before exporting the type
PropertiesAsFields Forces all properties to be treated as JavaScript native fields without any getter and setter methods
PrototypeName Allows to customize the 'prototype' token for instance method, by default, this value is: "prototype" This property is useful for creating jQuery plugins class MyClass { public void foo() } MyClass.prototype.foo = function() { }
SharpKitVersion Targets the attribute for a specific SharpKit version, this attribute will be ignored if the current SharpKit version isn't in the range of the value specified
TargetType When used as assembly attribute, indicates the type for which to apply this attribute on. This feature should be used when trying to describe classes on external assemblies that has no SharpKit support
TargetTypeName When used as assembly attribute, indicates the type for which to apply this attribute on. This feature should be used when trying to describe classes on external assemblies that has no SharpKit support
© Copyright 2005-2011 SharpKit. All rights reserved.