grecha.js icon indicating copy to clipboard operation
grecha.js copied to clipboard

#2: customizable `route404` variable

Open synzr opened this issue 2 years ago • 1 comments

i just added an options argument that can define route404 to the router() function.

synzr avatar Nov 19 '23 06:11 synzr

Passing in two objects inline might be a bit ugly, maybe make a symbol or look for a hard-coded global var-name, which gets called (assuming it's an object, and has routes), if errors or <...>?.<...> == falsey, throw at each.

window[Symbol.for('G_RouterOptions')] = { 'route404': ... }

OR

window.GrechaOptions = { 'route404': ... }

Otherwise, this is fine:

let routes = { ... }
let options = { ... }
let router = router(routes, options)

SpcFORK avatar Nov 27 '23 17:11 SpcFORK