SlideShare a Scribd company logo
Loadrunner



@danwrong
Script loader
Script loader
Dependency Manager
Thing(s) that need to
happen before other
things can happen
Vital Statistics
• http://github.com/danwrong/loadrunner
• 4.6KB minified
• MIT License
• Used by: Phoenix, TfW
Built-in features
Load arbitrary JavaScript
using('/javascripts/app.js', '/javascripts/underscore.js', function() {

  _([1, 2, 3]).each(function(i) {
    Application.load(i);
  });

});

var utils = using('/javascripts/jquery.js', '/javascripts/underscore.js');

utils.then(function() {
  // do some stuff
});

// somewhere else in your code
utils.then(function() {
  // do other stuff
});
Define/import modules
// define with object
provide({
  original: 'nuttah',
  booyaka: "booyaka"
});
// define with a factory function (in modules/dancehall.js)
provide(function(exports) {
  var beenieMan = 'badman';

 function whoGotTheKeysToMaBeamer(person) {
   if (person == beenieMan) {
     return "De girls dem suga";
   }
 }

  exports({
    beenieMan: beenieMan,
    whoGotTheKeysToMaBeamer: whoGotTheKeysToMaBeamer
  });
});
using.path = '/modules';

using('dancehall', function(dancehall) {
  console.log(dancehall.whoGotTheKeysToMaBeamer('badman'))
  //=> "De girls dem suga"
});
provide(function(exports) {
  using('soundsystem', function(soundsystem) {
    var beenieMan = 'badman';

    function whoGotTheKeysToMaBeamer(person) {
      if (person == beenieMan) {
        return soundsystem.play("De girls dem suga");
      }
    }

    exports({
      beenieMan: beenieMan,
      whoGotTheKeysToMaBeamer: whoGotTheKeysToMaBeamer
    });
  });
});
Define/import AMD
Modules
http://wiki.commonjs.org/wiki/Modules/
AsynchronousDefinition
// in modules/amd/dancehall.js
define(['soundsystem'], function(soundsystem) {
  var beenieMan = 'badman';

  function whoGotTheKeysToMaBeamer(person) {
    if (person == beenieMan) {
      return soundsystem.play("De girls dem suga");
    }
  }

  return {
     beenieMan: beenieMan,
     whoGotTheKeysToMaBeamer: whoGotTheKeysToMaBeamer
  };
});
using.path = '/modules';

using('amd/dancehall', function(dancehall) {
  console.log(dancehall.whoGotTheKeysToMaBeamer('badman'));
  //=> "De girls dem suga"
});
Under the hood
loadrunner.Dependency
var dep = new loadrunner.Dependency;

dep.then(function(results){
  console.log(results);
});

dep.then(function(results) {
  console.log(results + 10);
});

dep.complete(15);
// logs 15 and 25;

dep.then(function(results) {
   console.log(results - 5);
})
// logs 10 immediately

dep.completed === true;
using()
using('thing', '/javascripts/thing.js');

// is the same as:

new loadrunner.Combination([
  new loadrunner.Module('thing'),
  new loadrunner.Script('/javascripts/thing.js')
]);
using.matchers.add(/.js$/, function(path) {
  return new Script(
     path.replace(/^$/, using.path.replace(//$/, '') + '/')
  );
});

using.matchers.add(/^[a-zA-Z0-9_-/]+$/, function(id) {
  return new Module(id);
});
Building in to Loadrunner
function Template(path) {}
Template.prototype = new loadrunner.Dependency;
Template.prototype.start = function() {
   // called when first callback is added
   // start the template load
   this.load(function(source) {
      // call complete when its done
      var template = this.compile(source)
      this.complete(template);
   })
};

using.matchers.add(/.mustache$/, function(path) {
  return loadrunner.Template(path);
});

using('example.mustache', function(template) {
  template.eval({ a: 1, b: 2 });
});
Loadbuilder is coming
• Based on Node.js, NPM module
• Builds and minifies dependency trees defined with
 Loadrunner
Questions?

More Related Content

PDF
World of Logging
PDF
Go Mobile with Apache Cordova, Zagreb 2014
PDF
clara-rules
PDF
Ember background basics
PDF
Ember and containers
PDF
Javascript Frameworks for Joomla
PDF
ActionHeroJS Talk
KEY
Playing With Fire - An Introduction to Node.js
World of Logging
Go Mobile with Apache Cordova, Zagreb 2014
clara-rules
Ember background basics
Ember and containers
Javascript Frameworks for Joomla
ActionHeroJS Talk
Playing With Fire - An Introduction to Node.js

What's hot (20)

PDF
Workshop 10: ECMAScript 6
PDF
Complex Architectures in Ember
PPT
CoffeeScript: A beginner's presentation for beginners copy
PDF
JavaScript OOP Pattern
PPTX
Avoiding callback hell in Node js using promises
PDF
Firefox OS learnings & visions, WebAPIs - budapest.mobile
ZIP
Web+GISという視点から見たGISの方向性
PDF
Asynchronous programming patterns in Perl
PDF
JavaScript Promise
PDF
Containers & Dependency in Ember.js
PPTX
Vue.js + Django - configuración para desarrollo con webpack y HMR
PDF
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24
PDF
Asynchronous programming done right - Node.js
KEY
Lazy Loading Because I'm Lazy
PDF
Asynchronous Programming FTW! 2 (with AnyEvent)
PPTX
Leap Motion Development (Rohan Puri)
PPTX
Spine.js
PDF
Callbacks, promises, generators - asynchronous javascript
PPTX
Avoiding Callback Hell with Async.js
PDF
Asynchronous Programming with JavaScript
Workshop 10: ECMAScript 6
Complex Architectures in Ember
CoffeeScript: A beginner's presentation for beginners copy
JavaScript OOP Pattern
Avoiding callback hell in Node js using promises
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Web+GISという視点から見たGISの方向性
Asynchronous programming patterns in Perl
JavaScript Promise
Containers & Dependency in Ember.js
Vue.js + Django - configuración para desarrollo con webpack y HMR
Nevyn — Promise, It's Async! Swift Language User Group Lightning Talk 2015-09-24
Asynchronous programming done right - Node.js
Lazy Loading Because I'm Lazy
Asynchronous Programming FTW! 2 (with AnyEvent)
Leap Motion Development (Rohan Puri)
Spine.js
Callbacks, promises, generators - asynchronous javascript
Avoiding Callback Hell with Async.js
Asynchronous Programming with JavaScript
Ad

Similar to Loadrunner (20)

PDF
Sane Async Patterns
KEY
How and why i roll my own node.js framework
KEY
BlackBerry DevCon 2011 - PhoneGap and WebWorks
PDF
jQuery: Events, Animation, Ajax
PPTX
Angular Workshop_Sarajevo2
PDF
DrupalCon jQuery
KEY
JavaScript Growing Up
PPTX
Beyond DOMReady: Ultra High-Performance Javascript
PDF
YUI on the go
PDF
Clean Javascript
PDF
The 2016 Android Developer Toolbox [MOBILIZATION]
PDF
Writing Maintainable JavaScript
PDF
Build Web Apps using Node.js
PDF
Desymfony 2011 - Habemus Bundles
PDF
Workflow para desenvolvimento Web & Mobile usando grunt.js
PPTX
Security testing of YUI powered applications
PDF
Reliable Javascript
PDF
Building Large jQuery Applications
KEY
Android workshop
PDF
meet.js - QooXDoo
Sane Async Patterns
How and why i roll my own node.js framework
BlackBerry DevCon 2011 - PhoneGap and WebWorks
jQuery: Events, Animation, Ajax
Angular Workshop_Sarajevo2
DrupalCon jQuery
JavaScript Growing Up
Beyond DOMReady: Ultra High-Performance Javascript
YUI on the go
Clean Javascript
The 2016 Android Developer Toolbox [MOBILIZATION]
Writing Maintainable JavaScript
Build Web Apps using Node.js
Desymfony 2011 - Habemus Bundles
Workflow para desenvolvimento Web & Mobile usando grunt.js
Security testing of YUI powered applications
Reliable Javascript
Building Large jQuery Applications
Android workshop
meet.js - QooXDoo
Ad

More from danwrong (9)

PDF
Building Non-shit APIs with JavaScript
PDF
Bringing the Same-Origin Policy to its Knees
KEY
Building @Anywhere (for TXJS)
PDF
8 Minutes On Rack
PDF
Taming The Beast
PDF
Metaprogramming JavaScript
PDF
The Mysteries Of JavaScript-Fu (@media Europe Edition)
PDF
The Mysteries Of JavaScript-Fu (@media SF Edition)
PDF
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
Building Non-shit APIs with JavaScript
Bringing the Same-Origin Policy to its Knees
Building @Anywhere (for TXJS)
8 Minutes On Rack
Taming The Beast
Metaprogramming JavaScript
The Mysteries Of JavaScript-Fu (@media Europe Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
KodekX | Application Modernization Development
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Cloud computing and distributed systems.
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Electronic commerce courselecture one. Pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KodekX | Application Modernization Development
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Empathic Computing: Creating Shared Understanding
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Cloud computing and distributed systems.
Review of recent advances in non-invasive hemoglobin estimation
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
Electronic commerce courselecture one. Pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Programs and apps: productivity, graphics, security and other tools
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx

Loadrunner

Editor's Notes