rename can.Component scope to context? #1300

Closed
stevenvachon opened this Issue Nov 3, 2014 · 4 comments

Comments

Projects
None yet
4 participants
@stevenvachon
Contributor

stevenvachon commented Nov 3, 2014

It was suggested way back in #635 and I agree with it.

scope may be good for those migrating from AngularJS but to everyone else, I think that context makes more sense. It also causes less confusion with can-EVENT function arguments:

context: {
    canEventFunction: function(scope, element, event) {
        // scope vs context
    }
}

Maybe a 3.0 feature?

@zkat

This comment has been minimized.

Show comment
Hide comment
@zkat

zkat Dec 6, 2014

Contributor

I still favor viewModel because it emphasizes its role. context, scope and options are all overloaded terminology in CanJS. Even model would be nicer, although that might conflict with the idea of can.Model somewhat (since they default to being Maps), and I think map is overloaded enough as-is, in comp sci talk :\

tl;dr: I favor viewModel and model, in that order -- the latter conveniently lets you avoid casing annoyances. :)

Contributor

zkat commented Dec 6, 2014

I still favor viewModel because it emphasizes its role. context, scope and options are all overloaded terminology in CanJS. Even model would be nicer, although that might conflict with the idea of can.Model somewhat (since they default to being Maps), and I think map is overloaded enough as-is, in comp sci talk :\

tl;dr: I favor viewModel and model, in that order -- the latter conveniently lets you avoid casing annoyances. :)

@stevenvachon

This comment has been minimized.

Show comment
Hide comment
@stevenvachon

stevenvachon Dec 6, 2014

Contributor

Hmm, yeah, I think I agree. viewModel is more descriptive without resorting to nicknames.

Contributor

stevenvachon commented Dec 6, 2014

Hmm, yeah, I think I agree. viewModel is more descriptive without resorting to nicknames.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Mar 4, 2015

Contributor

Some definitions:

In Mustache

  • context - the initial object a template will look within for key values
  • key - an identifier
  • scope - a can.view.Scope that represents a context and a parent context.
  • scope chain - all contexts a key might be found within for a certain area of a template

In attribute helpers

  • can-scope - a helper that binds a component's "scope" to a particular key value in the current context.

In can.Component

  • scope - A definition of a can.Map that is used to render the component's template. This is normally used as a view model.
Contributor

justinbmeyer commented Mar 4, 2015

Some definitions:

In Mustache

  • context - the initial object a template will look within for key values
  • key - an identifier
  • scope - a can.view.Scope that represents a context and a parent context.
  • scope chain - all contexts a key might be found within for a certain area of a template

In attribute helpers

  • can-scope - a helper that binds a component's "scope" to a particular key value in the current context.

In can.Component

  • scope - A definition of a can.Map that is used to render the component's template. This is normally used as a view model.
@daffl

This comment has been minimized.

Show comment
Hide comment
@daffl

daffl Mar 11, 2015

Contributor

Will be renamed to viewModel via #1512.

Contributor

daffl commented Mar 11, 2015

Will be renamed to viewModel via #1512.

@daffl daffl closed this in #1512 Mar 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment