minor tweak...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-17 12:05:00 +03:00
parent 3d06fda888
commit 4bab2bed8d
2 changed files with 20 additions and 6 deletions

View File

@ -168,6 +168,19 @@ document.pwikiloaded = new Event('pwikiloaded')
REFRESH_DELAY = 20 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... // start loading pWiki...
require(['./browser'], function(browser){ require(['./browser'], function(browser){
pwiki = window.pwiki = browser.pwiki pwiki = window.pwiki = browser.pwiki
@ -205,11 +218,9 @@ require(['./browser'], function(browser){
: '')) : ''))
// NOTE: we are intentionally not awaiting for this -- this // NOTE: we are intentionally not awaiting for this -- this
// separates the navigate and load events... // separates the navigate and load events...
var t = Date.now() logTime(
this.refresh() this.refresh(),
.then(function(){ this.path) })
DEBUG
&& console.log(`## ${pwiki.path} (${Date.now() - t}ms)`) }) })
.onLoad(function(evt){ .onLoad(function(evt){
var that = this var that = this
// stop spinner... // stop spinner...
@ -228,7 +239,9 @@ require(['./browser'], function(browser){
lnk.addEventListener('click', function(evt){ lnk.addEventListener('click', function(evt){
startSpinner() startSpinner()
setTimeout(function(){ setTimeout(function(){
that.refresh() }, REFRESH_DELAY) }) } }) logTime(
that.refresh(),
that.path) }, REFRESH_DELAY) }) } })
// wait for stuff to finish... // wait for stuff to finish...
browser.setup.then(function(){ browser.setup.then(function(){

View File

@ -201,6 +201,7 @@
* XXX DEPENDS/CACHE @macro(..) introduces a dependency on count (pattern) * XXX DEPENDS/CACHE @macro(..) introduces a dependency on count (pattern)
* ...not sure how we track these... * ...not sure how we track these...
* XXX revise how we handle .strict mode in page's .raw and .text... * XXX revise how we handle .strict mode in page's .raw and .text...
* XXX might be a good idea to export HTML from a specific path/pattern...
* *
* *
* *