Hyperapp: Invert mixin initialization order.

Created on 16 Aug 2017  路  5Comments  路  Source: jorgebucaran/hyperapp

Currently we are initializing the app, _then_ mixins. This makes it impossible for the app to overwrite a definition added by a mixin.

Your app should have the highest precedence and not mixins.

Discussion Feature

Most helpful comment

I'll create a PR with the changes. 馃挴

As a side effect, I'd prefer to drop presets (builtin mixin group merging) with this change since it complicates the implementation.

Less is more remember? @zaceno :)

All 5 comments

That makes sense!

Totally agree !

馃挴 agree app should take precedence

I'll create a PR with the changes. 馃挴

As a side effect, I'd prefer to drop presets (builtin mixin group merging) with this change since it complicates the implementation.

Less is more remember? @zaceno :)

I don't think that the current idea of "presets" (or "mixins in mixins") is especially important anyway. In fact it only complicates things when you're trying to do things like scoped mixins.

Anyhow, presets, or bundling mixins, can still be done in an ok-nice way with array spreads.

const MyMixinPreset = [MixinA, MixinB]

app({
  mixins: [AMixin, ...MyMixinPreset, AnotherMixin],
  ...
})

EDIT: Code fences.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

guy-kdm picture guy-kdm  路  4Comments

rbiggs picture rbiggs  路  4Comments

SkaterDad picture SkaterDad  路  3Comments

jamen picture jamen  路  4Comments