Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ember-Data

Nathan
July 07, 2014

 Ember-Data

A place to store all of your mistakes.

Nathan

July 07, 2014
Tweet

Other Decks in Programming

Transcript

  1. Who’s  this  guy   •  Not  Jim  Halpert    

    •  Senior  Dev  @  Radialogica   •  Leading  Ember.js/Web  development  for  Oncology   AnalyKcs  PlaMorm  
  2. What’s  Radialogica   •  Healthcare  IT  company  focused  on  advanced

      soPware  soluKons  for  radiology  and  radiaKon   oncology.     •  Our  mission  is  to  improve  the  safety,  quality   and  efficiency  of  care  with  innovaKve  tools   that  change  how  informaKon  is  accessed,   analyzed  and  shared  by  members  of  the   treatment  team.  
  3. Benefits   •  Model  your  domain   •  Interchangeable  backend

     (Adapter)   •  Caching  Layer  (Store)   •  Lazy  loading     •  Side  loading   •  Default  data  values   •  CustomizaKon  
  4. Parts   •  Models   •  DS.Store   •  Adapters

      •  Serializers   •  Transformers  
  5. DS.Model   •  DS.Model  API   •  Defines  a\ributes  and

     relaKonships   •  Supported  Data  Types   – String/Bool/Dates/Numbers   •  Errors  
  6. RelaKonships   1-­‐1   DS.belongsTo   DS.belongsTo   0-­‐1  

    None   DS.belongsTo   1-­‐*   DS.belongsTo   DS.hasMany   *-­‐*   DS.hasMany   DS.hasMany   0-­‐*   None   DS.hasMany  
  7. DS.Store   •  h\p://emberjs.com/api/data/classes/ DS.Store.html   •  Caches  all  of

     the  data  for  records  loaded  from   the  server   •  Find  One   •  Find  Many   •  Find  By  Query  
  8. DS.Adapter   •  DS.Adapter   •  ApplicaKonAdapter  =  Default  Adapter

      •  Every  model  has  Model-­‐specific  adapters     –  (ModelName  +  Adapter)   –  ApplicaKon  Adapter  is  Backup   •  CustomizaKons   –  Headers   –  Hostname   –  Namespace  
  9. DS.Adapter   •  Naming  inconsistencies?  No  worries!   – Ember.Inflector  

      Ac#on   HTTP  Verb   URL   Find   GET   /photos/123   Find  All   GET   /photos   Update   PUT   /photos/123   Create   POST   /photos   Delete   DELETE   /photos/123  
  10. Transformers   •  De/Serialize  model  a\ributes   – String/Date/Bool/Number   • 

    You  can  write  your  own  for  your  backend’s   special  datatypes  
  11. Upcoming  changes   •  Single  Source  of  Truth   – A

     guarantee  that  if  one  side  of  a  two-­‐way   relaKonship  changes,  the  other  side  will  remain  in   sync,  even  if  it  hasn't  loaded  yet.   •  {async  =  true}  for  All   – DataBoundPromises  will  make  them  work  well  in   observers,  computed  properKes  and  in  templates.