diff --git a/js/js.libraries/src/html5/localstorage.kt b/js/js.libraries/src/html5/localstorage.kt new file mode 100644 index 00000000000..35b00c8483c --- /dev/null +++ b/js/js.libraries/src/html5/localstorage.kt @@ -0,0 +1,11 @@ +package html5.localstorage + +import js.native + +native +val localStorage : LocalStorageClass = js.noImpl +native +class LocalStorageClass() { + fun getItem(key : String) : Any? = js.noImpl + fun setItem(key : String, value : Any?) : Unit = js.noImpl +} \ No newline at end of file diff --git a/js/js.translator/testFiles/kotlin_lib.js b/js/js.translator/testFiles/kotlin_lib.js index 66d36df1ee1..82ad77cca64 100644 --- a/js/js.translator/testFiles/kotlin_lib.js +++ b/js/js.translator/testFiles/kotlin_lib.js @@ -894,9 +894,19 @@ var Kotlin; }; }; - this.keys = createBucketAggregator("keys"); - this.values = createBucketAggregator("values"); - this.entries = createBucketAggregator("getEntries"); + this._keys = createBucketAggregator("keys"); + this._values = createBucketAggregator("values"); + this._entries = createBucketAggregator("getEntries"); + + this.values = function() { + var values = this._values(); + var i = values.length + var result = new Kotlin.ArrayList(); + while (--i) { + result.add(values[i]); + } + return result; + }; this.remove = function (key) { checkKey(key); @@ -964,7 +974,7 @@ var Kotlin; this.keySet = function () { var res = new Kotlin.HashSet(); - var keys = this.keys(); + var keys = this._keys(); var i = keys.length; while (i--) { res.add(keys[i]); @@ -1001,7 +1011,7 @@ var Kotlin; }; this.values = function () { - return hashTable.keys(); + return hashTable._keys(); }; this.iterator = function () {