mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 11:00:08 +00:00 
			
		
		
		
	some cleanup and refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									e3948d3a3a
								
							
						
					
					
						commit
						d17981f90f
					
				| @ -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( | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user