mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
minor tweak...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3d06fda888
commit
4bab2bed8d
25
pwiki2.html
25
pwiki2.html
@ -168,6 +168,19 @@ document.pwikiloaded = new Event('pwikiloaded')
|
||||
|
||||
REFRESH_DELAY = 20
|
||||
|
||||
// helper...
|
||||
var logTime = async function(promise, msg=''){
|
||||
var t = Date.now()
|
||||
var res = await promise
|
||||
t = Date.now() - t
|
||||
DEBUG
|
||||
&& console.log(`## ${
|
||||
typeof(msg) == 'function' ?
|
||||
msg(res)
|
||||
: msg
|
||||
} (${t}ms)`)
|
||||
return res }
|
||||
|
||||
// start loading pWiki...
|
||||
require(['./browser'], function(browser){
|
||||
pwiki = window.pwiki = browser.pwiki
|
||||
@ -205,11 +218,9 @@ require(['./browser'], function(browser){
|
||||
: ''))
|
||||
// NOTE: we are intentionally not awaiting for this -- this
|
||||
// separates the navigate and load events...
|
||||
var t = Date.now()
|
||||
this.refresh()
|
||||
.then(function(){
|
||||
DEBUG
|
||||
&& console.log(`## ${pwiki.path} (${Date.now() - t}ms)`) }) })
|
||||
logTime(
|
||||
this.refresh(),
|
||||
this.path) })
|
||||
.onLoad(function(evt){
|
||||
var that = this
|
||||
// stop spinner...
|
||||
@ -228,7 +239,9 @@ require(['./browser'], function(browser){
|
||||
lnk.addEventListener('click', function(evt){
|
||||
startSpinner()
|
||||
setTimeout(function(){
|
||||
that.refresh() }, REFRESH_DELAY) }) } })
|
||||
logTime(
|
||||
that.refresh(),
|
||||
that.path) }, REFRESH_DELAY) }) } })
|
||||
|
||||
// wait for stuff to finish...
|
||||
browser.setup.then(function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user