Imba integration with pro-router.js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
434 B

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