Created
December 3, 2011 17:25
-
-
Save kg/1427632 to your computer and use it in GitHub Desktop.
Replacing type names with arbitrary JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[JSReplacement("UnqualifiedTypeName")] | |
public static class MyClass { | |
public static string StringField = "StringField"; | |
public static string StringProperty { | |
get; | |
set; | |
} | |
public static string GetString () { | |
return "MyClass"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UnqualifiedTypeName.get_StringProperty = function () { | |
return UnqualifiedTypeName.StringProperty$value; | |
}; | |
UnqualifiedTypeName.set_StringProperty = function (value) { | |
UnqualifiedTypeName.StringProperty$value = value; | |
}; | |
UnqualifiedTypeName.GetString = function () { | |
return "MyClass"; | |
}; | |
UnqualifiedTypeName.StringField = null; | |
UnqualifiedTypeName.StringProperty$value = null; | |
UnqualifiedTypeName._cctor = function () { | |
UnqualifiedTypeName.StringField = "StringField"; | |
}; | |
JSIL.MakeProperty(UnqualifiedTypeName, "StringProperty", | |
UnqualifiedTypeName.get_StringProperty, UnqualifiedTypeName.set_StringProperty); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment