Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7e7b265f
authored
Dec 25, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
u
parent
84eafea4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
database/dev-tools.ts
database/dev-tools.ts
View file @
7e7b265f
...
...
@@ -48,10 +48,12 @@ class DevAppTools {
if
(
!
this
.
db
)
{
return
resolve
(
false
);
}
const
store
=
this
.
buildStore
(
this
.
table
);
const
r
=
store
.
getKey
(
1
);
r
.
onsuccess
=
(
o
)
=>
resolve
((
o
.
target
as
any
).
result
);
r
.
onerror
=
()
=>
resolve
(
false
);
setTimeout
(()
=>
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
r
=
store
.
getKey
(
1
);
r
.
onsuccess
=
(
o
)
=>
resolve
((
o
.
target
as
any
).
result
);
r
.
onerror
=
()
=>
resolve
(
false
);
},
200
);
});
});
}
...
...
@@ -59,19 +61,21 @@ class DevAppTools {
public
toggle
()
{
return
new
Promise
<
boolean
>
((
resolve
)
=>
{
this
.
onReady
().
finally
(()
=>
{
this
.
isOpen
().
then
(
r
=>
{
if
(
r
)
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
d
=
store
.
delete
(
1
);
d
.
onsuccess
=
()
=>
resolve
(
false
);
d
.
onerror
=
()
=>
resolve
(
false
);
}
else
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
d
=
store
.
add
({
value
:
1
});
d
.
onsuccess
=
()
=>
resolve
(
true
);
d
.
onerror
=
()
=>
resolve
(
true
);
}
});
setTimeout
(()
=>
{
this
.
isOpen
().
then
(
r
=>
{
if
(
r
)
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
d
=
store
.
delete
(
1
);
d
.
onsuccess
=
()
=>
resolve
(
false
);
d
.
onerror
=
()
=>
resolve
(
false
);
}
else
{
const
store
=
this
.
buildStore
(
this
.
table
);
const
d
=
store
.
add
({
value
:
1
});
d
.
onsuccess
=
()
=>
resolve
(
true
);
d
.
onerror
=
()
=>
resolve
(
true
);
}
});
},
300
);
});
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment