mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
ready to test
Testing Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
@val external localStorage: {..} = "localStorage"
|
||||
|
||||
let storageKey = (courseId: string, lessonId: string) =>
|
||||
`annotation:${courseId}:${lessonId}`
|
||||
|
||||
let saveNote = (courseId: string, lessonId: string, note: string) => {
|
||||
let key = storageKey(courseId, lessonId)
|
||||
localStorage["setItem"](key, note)
|
||||
}
|
||||
|
||||
let loadNote = (courseId: string, lessonId: string) => {
|
||||
let key = storageKey(courseId, lessonId)
|
||||
let value: Nullable.t<string> = localStorage["getItem"](key)
|
||||
Nullable.toOption(value)
|
||||
}
|
||||
|
||||
let deleteNote = (courseId: string, lessonId: string) => {
|
||||
let key = storageKey(courseId, lessonId)
|
||||
localStorage["removeItem"](key)
|
||||
}
|
||||
Reference in New Issue
Block a user