Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember.js - What purpose does Ember.lookup serve

Tags:

ember.js

Can anyone tell me what purpose Ember.lookup serves?

It is used to lookup string keys.

An example of its use in the ember source is:

if(typeof modelType === "string"){
  return Ember.get(Ember.lookup, modelType);
} else {
  return modelType;
}

I can see that it returns a type from a string but I don't see where it is set or what the bigger picture is for its usage.

like image 523
dagda1 Avatar asked Dec 05 '12 12:12

dagda1


People also ask

What is the use of Ember js?

js is an open-source JavaScript web framework that utilizes a component-service pattern. It allows developers to create scalable single-page web applications by incorporating common idioms, best practices, and patterns from other single-page-app ecosystem patterns into the framework.

What is an ember service?

A Service is an Ember object that lives for the duration of the application, and can be made available in different parts of your application. Services are useful for features that require shared state or persistent connections. Example uses of services might include: User/session authentication.

What is an ember model?

In Ember Data, models are objects that represent the underlying data that your application presents to the user. Note that Ember Data models are a different concept than the model method on Routes, although they share the same name.

What is store in Ember js?

The store contains all of the data for records loaded from the server. It is also responsible for creating instances of Model that wrap the individual data for a record, so that they can be bound to in your Handlebars templates.


1 Answers

Ember.lookup was introduced along with Ember.imports and Ember.exports as a way to remove the dependency on window.

If you are running Ember in the browser, all three values will refer to the window, however if you are running without the browser, for instance, through NodeJS or with AMD, you will need to supply values yourself.

See the commit message for more information.

like image 198
Bradley Priest Avatar answered Oct 12 '22 03:10

Bradley Priest