diff --git a/pwiki/page.js b/pwiki/page.js index e2eeb9e..5b59833 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -141,13 +141,13 @@ object.Constructor('BasePage', { // // NOTE: path variables are resolved relative to the page BEFORE // navigation... - // NOTE: the actual work is done by the .onNavigate(..) method... + // NOTE: the actual work is done by the .navigate(..) method... __location: undefined, get location(){ return this.__location ?? '/' }, set location(path){ // trigger the event... - this.onNavigate(path) }, + this.navigate(path) }, // referrer -- a previous page location... referrer: undefined, @@ -159,14 +159,14 @@ object.Constructor('BasePage', { // // XXX revise naming... // XXX should this be able to prevent navigation??? - onBeforeNavigate: types.event.Event('beforeNavigate', + onBeforeNavigate: types.event.PureEvent('beforeNavigate', function(_, location){ '__beforenavigate__' in this && this.__beforenavigate__(location) }), - onNavigate: types.event.Event('navigate', + navigate: types.event.Event('navigate', function(handle, location){ var {path, args} = pwpath.splitArgs(location) - this.onBeforeNavigate(location) + this.trigger("onBeforeNavigate", location) this.referrer = this.location var cur = this.__location = this.resolvePathVars( diff --git a/pwiki2.html b/pwiki2.html index 0a83f66..0763783 100755 --- a/pwiki2.html +++ b/pwiki2.html @@ -359,7 +359,7 @@ require(['./browser'], function(browser){ pwiki .onBeforeNavigate(function(){ saveAll() }) - .onNavigate(async function(){ + .navigate(async function(){ // NOTE: we do not need to directly update location.hash here as // that will push an extra history item... history.replaceState( @@ -413,7 +413,7 @@ require(['./browser'], function(browser){ lnk.addEventListener('click', refresh) } }) // handle special file updates... - // NOTE: the actual updates are done .onNavigate(..) + // NOTE: the actual updates are done .navigate(..) pwiki.store .update(function(_, path){ // XXX GLOBAL_STYLE diff --git a/pwiki2.js b/pwiki2.js index acede5a..bdd782a 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -18,8 +18,9 @@ * - CLI - * * -* XXX STYLE: should style loading be done via the event mechanics or via -* the base templates??? +* XXX STYLE: should style loading be done via the event mechanics +* (see: pwiki2.html) or via the base templates (see: pwiki/page.js:_view +* template)??? * XXX NAMING: revise .onNavigate(..) and .onBeforeNavigate(..) event names... * XXX BUG: parser: * This will break: