3 changed files with 22 additions and 23 deletions
			
			
		| @ -0,0 +1,6 @@ | |||||
|  | global:Router = require('pro-router') | ||||
|  | require './router/router' | ||||
|  | require './ref/ref' | ||||
|  | require './switch/switch' | ||||
|  | require './not_found/not_found' | ||||
|  | 
 | ||||
| @ -0,0 +1,16 @@ | |||||
|  | tag router | ||||
|  | 
 | ||||
|  | 	prop component watch: yes | ||||
|  | 
 | ||||
|  | 	def setup | ||||
|  | 		@component = null | ||||
|  | 		@cache = {} | ||||
|  | 
 | ||||
|  | 	def componentDidSet val, prev | ||||
|  | 		removeChild(prev) if prev | ||||
|  | 		appendChild(val) if val | ||||
|  | 		self | ||||
|  | 
 | ||||
|  | 	def render | ||||
|  | 		component = @cache[@data] ||= Imba.createElement(@data,null,null,self) | ||||
|  | 		component.end | ||||
| @ -1,23 +0,0 @@ | |||||
| global:Router = require('pro-router') |  | ||||
| require './ref/ref' |  | ||||
| require './switch/switch' |  | ||||
| require './not_found/not_found' |  | ||||
| 
 |  | ||||
| tag router |  | ||||
| 
 |  | ||||
| 	prop component watch: yes |  | ||||
| 
 |  | ||||
| 	def setup |  | ||||
| 		@r = R |  | ||||
| 		@component = null |  | ||||
| 		@cache = {} |  | ||||
| 
 |  | ||||
| 	def componentDidSet val, prev |  | ||||
| 		removeChild(prev) if prev |  | ||||
| 		appendChild(val) if val |  | ||||
| 		self |  | ||||
| 
 |  | ||||
| 	def render |  | ||||
| 		var view = @data || @r:view |  | ||||
| 		component = @cache[view] ||= Imba.createElement(view,null,null,self) |  | ||||
| 		component.end |  | ||||
					Loading…
					
					
				
		Reference in new issue
	
	