Artem Musatenko
05/28/2024, 7:29 PMimplementation(npm("js-cookie", "^3.0.5"))
There is no errors with compilation or in runtime, but I can't use functions from this library:
package ru.cororo.songpay.util.js
@JsModule("js-cookie")
@JsNonModule
external object Cookies {
fun set(key: String, value: String)
fun get(key: String): String?
fun remove(key: String)
}
I got error while accessing to Cookies.get:
TypeError: Cookies.get is not a function
When I printed the Cookies
object, I got [object Module]
(JSONified: {"default": {}}
).
I tried to downgrade version to 2.2.1 and... it works! Cookies.get
now is correct function. I think reason is that 3.0.0 version now provides ES module. How I can fix it? (library: https://github.com/js-cookie/js-cookie/)Artem Musatenko
05/28/2024, 7:31 PMEdoardo Luppi
05/29/2024, 9:32 AMCookies
is assigned to global.Cookies
With global
being Window
in a browserEdoardo Luppi
05/29/2024, 9:35 AM@file:JsModule("js-cookie")
package ru.cororo.songpay.util.js
@JsName("default")
external object Cookies {
fun set(key: String, value: String)
fun get(key: String): String?
fun remove(key: String)
}
Should workArtem Musatenko
05/29/2024, 10:45 AM