mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 19:10: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 
 | 	// NOTE: path variables are resolved relative to the page BEFORE 
 | ||||||
| 	// 		navigation...
 | 	// 		navigation...
 | ||||||
| 	// NOTE: the actual work is done by the .onNavigate(..) method...
 | 	// NOTE: the actual work is done by the .navigate(..) method...
 | ||||||
| 	__location: undefined, | 	__location: undefined, | ||||||
| 	get location(){ | 	get location(){ | ||||||
| 		return this.__location ?? '/' }, | 		return this.__location ?? '/' }, | ||||||
| 	set location(path){ | 	set location(path){ | ||||||
| 		// trigger the event...
 | 		// trigger the event...
 | ||||||
| 		this.onNavigate(path) }, | 		this.navigate(path) }, | ||||||
| 	// referrer -- a previous page location...
 | 	// referrer -- a previous page location...
 | ||||||
| 	referrer: undefined, | 	referrer: undefined, | ||||||
| 
 | 
 | ||||||
| @ -159,14 +159,14 @@ object.Constructor('BasePage', { | |||||||
| 	//
 | 	//
 | ||||||
| 	// XXX revise naming...
 | 	// XXX revise naming...
 | ||||||
| 	// XXX should this be able to prevent navigation???
 | 	// XXX should this be able to prevent navigation???
 | ||||||
| 	onBeforeNavigate: types.event.Event('beforeNavigate', | 	onBeforeNavigate: types.event.PureEvent('beforeNavigate', | ||||||
| 		function(_, location){ | 		function(_, location){ | ||||||
| 			'__beforenavigate__' in this | 			'__beforenavigate__' in this | ||||||
| 				&& this.__beforenavigate__(location) }), | 				&& this.__beforenavigate__(location) }), | ||||||
| 	onNavigate: types.event.Event('navigate', | 	navigate: types.event.Event('navigate', | ||||||
| 		function(handle, location){ | 		function(handle, location){ | ||||||
| 			var {path, args} = pwpath.splitArgs(location) | 			var {path, args} = pwpath.splitArgs(location) | ||||||
| 			this.onBeforeNavigate(location) | 			this.trigger("onBeforeNavigate", location) | ||||||
| 			this.referrer = this.location | 			this.referrer = this.location | ||||||
| 			var cur = this.__location =  | 			var cur = this.__location =  | ||||||
| 				this.resolvePathVars( | 				this.resolvePathVars( | ||||||
|  | |||||||
| @ -359,7 +359,7 @@ require(['./browser'], function(browser){ | |||||||
| 	pwiki | 	pwiki | ||||||
| 		.onBeforeNavigate(function(){ | 		.onBeforeNavigate(function(){ | ||||||
| 			saveAll() }) | 			saveAll() }) | ||||||
| 		.onNavigate(async function(){ | 		.navigate(async function(){ | ||||||
| 			// NOTE: we do not need to directly update location.hash here as | 			// NOTE: we do not need to directly update location.hash here as | ||||||
| 			//		that will push an extra history item... | 			//		that will push an extra history item... | ||||||
| 			history.replaceState( | 			history.replaceState( | ||||||
| @ -413,7 +413,7 @@ require(['./browser'], function(browser){ | |||||||
| 				lnk.addEventListener('click', refresh) } }) | 				lnk.addEventListener('click', refresh) } }) | ||||||
| 
 | 
 | ||||||
| 	// handle special file updates... | 	// handle special file updates... | ||||||
| 	// NOTE: the actual updates are done .onNavigate(..) | 	// NOTE: the actual updates are done .navigate(..) | ||||||
| 	pwiki.store | 	pwiki.store | ||||||
| 		.update(function(_, path){ | 		.update(function(_, path){ | ||||||
| 			// XXX GLOBAL_STYLE | 			// XXX GLOBAL_STYLE | ||||||
|  | |||||||
| @ -18,8 +18,9 @@ | |||||||
| * 		- CLI										-  | * 		- CLI										-  | ||||||
| * | * | ||||||
| * | * | ||||||
| * XXX STYLE: should style loading be done via the event mechanics or via  | * XXX STYLE: should style loading be done via the event mechanics  | ||||||
| * 		the base templates??? | * 		(see: pwiki2.html) or via the base templates (see: pwiki/page.js:_view  | ||||||
|  | * 		template)??? | ||||||
| * XXX NAMING: revise .onNavigate(..) and .onBeforeNavigate(..) event names... | * XXX NAMING: revise .onNavigate(..) and .onBeforeNavigate(..) event names... | ||||||
| * XXX BUG: parser: | * XXX BUG: parser: | ||||||
| * 		This will break: | * 		This will break: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user