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

new App(config);

new App(config);

JavaScript apps that build themselves

Rebecca Murphey

April 15, 2013
Tweet

More Decks by Rebecca Murphey

Other Decks in Technology

Transcript

  1. exibility support arbitrary combinations of components interactivity support arbitrary interactions

    between components speed individual apps shouldn’t contain anything they don’t need 3 key problems to solve Monday, April 15, 13
  2. bootstrapper {""foo"":"{"…"}"} ui request handler customer ui request initialize components

    init "top model" w/component data init submodels request data init "top view" w/component data init subviews delegate events initialize "outlets" request batcher components initialized render components model data loaded $BV.ui('rr',  'show_reviews',  {  /*  ...  */  }); Monday, April 15, 13
  3. "reviewContentList1"  :  {    "features"  :  {      

     "self"  :  ["headToHead",  "contentFilter",  "contentItemColl        "contentItem"  :  ["has:stars",  "has:secondaryRatings",  "ha        "pagination"  :  ["ugcCount"],        "secondaryContentList"  :  ["secondaryContentItemCollection        "secondaryContentItem"  :  ["avatar",  "feedback"],        "contentFilter"  :  ["has:filterButton"]    },    //  ... }, Monday, April 15, 13
  4. "reviewContentList1"  :  {    "features"  :  {      

     "self"  :  ["headToHead",  "contentFilter",  "contentItemColl        "contentItem"  :  ["has:stars",  "has:secondaryRatings",  "ha        "pagination"  :  ["ugcCount"],        "secondaryContentList"  :  ["secondaryContentItemCollection        "secondaryContentItem"  :  ["avatar",  "feedback"],        "contentFilter"  :  ["has:filterButton"]    },    //  ... }, Monday, April 15, 13
  5. "contentItem"  :  [    "has:stars",      "has:secondaryRatings",    

     "has:tags",      "feedback",      "secondaryContentList",      "has:secondaryContentBtn" ], Monday, April 15, 13
  6. <div  class="bv-­‐content-­‐data-­‐summary">    <div  class="bv-­‐content-­‐header-­‐meta">        {{>  responseFrom

     .}}        {{#ifHasFeature  "stars"}}            {{>  contentStars  }}        {{/ifHasFeature}}        {{>  contentMeta  }}    </div>    <div  class="bv-­‐content-­‐title-­‐container">        {{>  contentTitle  }}    </div> {{{mountView  "secondaryContentList"  .}}} </div> Monday, April 15, 13
  7. "contentSearch1"  :  {    //  ...    "outlets"  :  {

           "showreviews"  :  [{              "component"  :  "reviewContentList1",              "event"  :  "scrolltocontent"          }],        "showquestions"  :  [{              "component"  :"questionContentList1",              "event"  :  "scrolltocontent"          }]    } }, Monday, April 15, 13
  8. _(outlets).each(function  (targets,  key)  {    _(targets).each(function  (target)  {    

       model.on(key,  createEventHandler(target));    }); }); function  createEventHandler  (target)  {    return  function  ()  {        var  targetComponent  =  components.find(target.component);        if  (!targetComponent)  {  return;  }        var  scope  =  targetComponent.getScope(targetComponent.contentType);        var  args  =  [                    scope  +  ':'  +  target.event                ].concat(  [].slice.call(arguments)  );        ENV.trigger.apply(ENV,  args);        return;    }; } Monday, April 15, 13
  9. //  events  on  a  contentItem  view events  :  {  

     'click  .bv-­‐rating-­‐stars-­‐container'  :  'clickStars',    'click  .bv-­‐content-­‐secondary-­‐btn'  :  'showSecondarySubmission',    'click  .bv-­‐media-­‐item':  'showMedia',    'click  .bv-­‐secondary-­‐content-­‐link'  :  'preventDefault',    'click  .bv-­‐content-­‐item-­‐close'  :  'closeQuestion',    'click  .bv-­‐fullprofile-­‐popup-­‐target'  :  'launchProfile',    "click  .bv-­‐show-­‐more-­‐link"  :  "showFullContent" }, Monday, April 15, 13
  10. _(subview.events).each(function  (methodName,  signature)  {    var  match  =  signature.match(eventSplitter);  

     var  eventName  =  match[1]  +  '.delegated'  +  subview.id;    var  selector    =  match[2];    var  method  =  subview[methodName];    this.$el.delegate(          selector,  eventName,  makeResponder(signature,  method)      ); },  this); Monday, April 15, 13
  11. " init submodels request data init subviews delegate events s"

    request batcher components initialized render components model data loaded " init submodels request data init subviews delegate events s" request batcher components initialized render components model data loaded Monday, April 15, 13
  12. what’s great self-serve app creation preview any customer’s app economies

    of scale writing new features is more fun than implementation, amirite? Monday, April 15, 13
  13. huge initial investment, ramp-up time it helps to have a

    legacy app no one-size- ts-all framework automated tests become imperative document all the things what’s challenging Monday, April 15, 13
  14. is there a future where we can generalize this DSL?

    how does this work for apps with more dynamic data? what’s next Monday, April 15, 13