kmalakoff/knockback

Simplify factories path notation

kmalakoff opened this issue · 1 comments

Can and should something like:

class PersonViewModel extends kb.ViewModel
  constructor: (model, options) ->
    super model, {factories: {
       'friends.models': FriendViewModel
       'best_friend': BestFriendViewModel
       'occupies': HouseViewModel
     }, options: options}

kb.collectionObservable({
  factories:
    models: BookViewModel
    'models.author.books.models': BookViewModel
})

be simplified to:

class PersonViewModel extends kb.ViewModel
  constructor: (model, options) ->
    super model, {factories: {
       friends: FriendViewModel
       best_friend: BestFriendViewModel
       occupies: HouseViewModel
     }, options: options}

kb.collectionObservable({
  factories:
    models: BookViewModel
    'models.author.books': BookViewModel
})

Not possible. May need to refer to the collection observable or the models, but they would be aliased.