From 6b3864a12d84c563f748b4fd06c39a047b3a4590 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 24 May 2012 16:18:59 +0100 Subject: [PATCH] starting to annotate JavaScript APIs in the standard library --- libraries/stdlib/src/js/Annotations.kt | 13 +++++++++++++ libraries/stdlib/src/kotlin/browser/Properties.kt | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 libraries/stdlib/src/js/Annotations.kt diff --git a/libraries/stdlib/src/js/Annotations.kt b/libraries/stdlib/src/js/Annotations.kt new file mode 100644 index 00000000000..2be217ef843 --- /dev/null +++ b/libraries/stdlib/src/js/Annotations.kt @@ -0,0 +1,13 @@ +package js + +/** + * This annotation marks code as being a native JavaScript expression + */ +native +annotation class native(name : String = "") {} + +/** + * Represents a function in the standard library + */ +native +annotation class library(name : String = "") {} \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/browser/Properties.kt b/libraries/stdlib/src/kotlin/browser/Properties.kt index 5c2061f298b..b28f2af9eb7 100644 --- a/libraries/stdlib/src/kotlin/browser/Properties.kt +++ b/libraries/stdlib/src/kotlin/browser/Properties.kt @@ -1,13 +1,14 @@ package kotlin.browser import org.w3c.dom.Document +import js.native private var _document: Document? = null /** * Provides access to the current active browsers DOM for the currently visible page. */ -var document: Document +native var document: Document get() = _document!! set(value) { _document = value