Closed zimt28 closed 8 years ago
Hmm, good point. I'll think about a solution.
I chose to use the same name as Manuel, because the name really makes sense. But it's kind of inconvenient in this situation.
Do you have any preferences as to the naming of the new ViewModel
class and viewmodel
hook during the migration?
Ideally, the name should be able to convey to new developers what is going on.
ViewModel2
looks a bit too much like it's the next major version of the same library. NewViewModel
doesn't really say anything. Maybe DalgardViewModel
and dalgardViewmodel
would be the least ambiguous choice...
I finally arrived at the simplest possible solution and will be releasing a new version shortly, with the necessary steps described in the docs.
The steps are:
dalgard:viewmodel
is included before any package that exports a ViewModel
and/or assigns something to Blaze.Template.prototype.viewmodel
.For example:
// E.g. /client/lib/dalgard-viewmodel.js
DalgardViewModel = Package["dalgard:viewmodel"].ViewModel;
Blaze.Template.prototype.dalgardViewmodel = DalgardViewModel.viewmodelHook;
Great, thanks! I'll just try that! The name I'd use here is just vm
, but it's a good solution to allow any!
Whatever rocks your boat :) Kindly close the issue, once you've ascertained yourself that things are in order.
Works fine :)
Please note that in the next version ViewModel.referenceName
is changed to ViewModel.referenceKey
. Thanks.
dalgard:viewmodel
andmanuel:viewmodel
both use the sameTemplate.$.viewmodel
syntax; so I can't have both in my app. But I'd like to move to your package step by step. How could I do that?