I'm developing Android app using Kotlin and Chrome Extension using plain HTML, CSS, JavaScript.
In Kotlin I use this @DocumentId annotation in my model class, it helps me get an object with a parameter id, because the id is key of the document in Cloud Firestore.
data class Word(
@DocumentId
val id: String = "",
var term: String = "",
var translation: String = "",
var bookmark: Boolean = false,
var reviewInterval: Int = 1
)
Then I use this code in JavaScript. But how to use @DocumentId annotation like in previous example. JavaScript doesn't support annotation and I haven't found anything in docs. How to achieve the same result in JavaScript?
class Word {
constructor(
id = "",
term = "",
translation = "",
bookmark = false,
reviewInterval = 1
) {
this.id = id;
this.term = term;
this.translation = translation;
this.bookmark = bookmark;
this.reviewInterval = reviewInterval;
}
}