Add primitive api for using html5 local storage.
Lib fixes.
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
@@ -894,9 +894,19 @@ var Kotlin;
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
this.keys = createBucketAggregator("keys");
|
this._keys = createBucketAggregator("keys");
|
||||||
this.values = createBucketAggregator("values");
|
this._values = createBucketAggregator("values");
|
||||||
this.entries = createBucketAggregator("getEntries");
|
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) {
|
this.remove = function (key) {
|
||||||
checkKey(key);
|
checkKey(key);
|
||||||
@@ -964,7 +974,7 @@ var Kotlin;
|
|||||||
|
|
||||||
this.keySet = function () {
|
this.keySet = function () {
|
||||||
var res = new Kotlin.HashSet();
|
var res = new Kotlin.HashSet();
|
||||||
var keys = this.keys();
|
var keys = this._keys();
|
||||||
var i = keys.length;
|
var i = keys.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
res.add(keys[i]);
|
res.add(keys[i]);
|
||||||
@@ -1001,7 +1011,7 @@ var Kotlin;
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.values = function () {
|
this.values = function () {
|
||||||
return hashTable.keys();
|
return hashTable._keys();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.iterator = function () {
|
this.iterator = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user