• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Loadrunner
 

Loadrunner

on

  • 3,407 views

Brief talk on Loadrunner as given at the Twitter Front-end Summit on 4/13.

Brief talk on Loadrunner as given at the Twitter Front-end Summit on 4/13.

Statistics

Views

Total Views
3,407
Views on SlideShare
3,404
Embed Views
3

Actions

Likes
3
Downloads
21
Comments
0

2 Embeds 3

https://twitter.com 2
http://www.twylah.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Loadrunner Loadrunner Presentation Transcript

  • Loadrunner@danwrong
  • Script loader
  • Script loader
  • Dependency Manager
  • Thing(s) that need tohappen before otherthings 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 codeutils.then(function() { // do other stuff});
  • Define/import modules
  • // define with objectprovide({ 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 AMDModuleshttp://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition
  • // in modules/amd/dancehall.jsdefine([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 immediatelydep.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?