Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
J
jensen
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Skye Yu
jensen
Commits
ebf14f90
Commit
ebf14f90
authored
Oct 22, 2024
by
Skye Yu
Committed by
Skye Yu
Oct 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename and add log
(cherry picked from commit
49eb6e93
)
parent
bc938d2b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
jensen.js
src/jensen.js
+6
-5
No files found.
src/jensen.js
View file @
ebf14f90
...
...
@@ -706,7 +706,7 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
let
wakeLock
=
null
;
let
timer
=
null
;
async
function
visibilitychange
()
{
function
visibilitychange
()
{
let
audio
=
document
.
getElementById
(
'test_audio'
);
if
(
!
audio
)
{
audio
=
document
.
createElement
(
'audio'
);
...
...
@@ -741,11 +741,12 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
}
}
function
removeAudio
()
{
function
clearEventAndTask
()
{
const
audio
=
document
.
getElementById
(
'test_audio'
);
audio
&&
audio
.
pause
()
&&
audio
.
remove
();
wakeLock
&&
wakeLock
.
release
();
timer
&&
clearInterval
(
timer
)
console
.
log
(
'Clear event and task.'
);
}
visibilitychange
();
...
...
@@ -758,17 +759,17 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
flen
+=
msg
.
body
.
length
||
msg
.
body
.
byteLength
;
ondata
(
msg
.
body
);
Logger
.
info
(
'jensen'
,
'getFile length'
,
`
${
length
}
${
flen
}
`
)
removeAudio
();
clearEventAndTask
();
if
(
flen
>=
length
)
{
document
.
removeEventListener
(
'visibilitychange'
,
visibilitychange
);
Logger
.
info
(
'jensen'
,
'getFile'
,
'file download finish.'
)
removeAudio
();
clearEventAndTask
();
// return OK indicates all file blocks received
return
'OK'
;
}
}
else
{
document
.
removeEventListener
(
'visibilitychange'
,
visibilitychange
);
removeAudio
();
clearEventAndTask
();
Logger
.
info
(
'jensen'
,
'getFile'
,
'file download fail.'
)
ondata
(
'fail'
);
}
...
...
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