
198 - 프로그레시브 웹 앱
db
.
open
();
db
.
reservations
.
where
("
guests
")
.
above
(
8
)
.
each
(
function
(
reservation
)
{
console
.
log
(
"
Reservation
"
+
reservation
.
id
+
"
for
"
+
reservation
.
nights
+
"
nights
"
);
});
6
.
8
.
4
IndexedDB
Promised
IndexedDB
Promised
(https
://
pwabook
.
com
/
idbpromised)
는
IndexedDB
사용 경험 개선을 목표로 생성된 작은 래퍼 라이브러리 입니다. “
IndexedDB
,
but
with
promises
(IndexedDB
, 하지만 프로미스와 함께
)
”라는 네 단어짜리 슬로건
을 보면 정확히
IndexedDB
Promised
가 무엇을 하는지 알 수 있습니다.
idb
.
open
("
reservations
",
1
,
function
(
upgradeDB
)
{
return upgradeDB
.
createObjectStore
("
reservations
");
}).
then
(
function
(
db
)
{
return db
.
transaction
("
reservations
").
objectStore
("
reservations
").
get
(
1
);
}).
then
(
function
(
reservation ...