hyperapp: Crashes Without View
Believe it or not, one instance of hyperapp in one of my projects isn’t using any view whatsoever. So here I am submitting a bug report to a frontend library that it crashes when no view is given…
Broken Code ▶️
app({
state: 'Example',
events: { loaded: () => console.info('Loaded!') }
})
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (13 by maintainers)
@dodekeract Good news! I’ll add support for view-less apps in the next release. 👍
I’ll implement this simply by not calling the
render
function. An app without a view will not fire arender
event either.EDIT: The new
patch
event won’t fire either, evidently! 😄@jbucaran Thanks for assuming I don’t know what I’m doing, but I really don’t want a mixin instead. The hyperapp instance I’m talking about is running inside an iframe to take advantage of cross origin iframe policies (and CORS) to protect user privacy. It doesn’t show anything and only communicates with an API. However, since it shares a lot of code with other iframes running in the same tab I need to take advantage of the rest of hyperapp’s architecture (state, actions, events) to re-use code.
Why do we have to render anything at all? Neither
root
norview
is specified so the most sane thing is to render nothing.@dodekeract Implemented in #317.
@selfup nice one! This is how I saw it being useful 👍