Skip to content

LoicMahieu/handlebars-async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handlebars-Async

Make Handlebars async!

Install

npm install handlebars-async

Usage

var Handlebars = require('handlebars');
var handlebarsAsync = require('handlebars-async');

handlebarsAsync(Handlebars);

Handlebars.registerHelper('async', function(arg1) {
  var done = this.async();

  setTimeout(function() {
    done(null, arg1.toUpperCase())
    done();
  }, 1000);
});

var tpl = Handlebars.compile('{{asyncHelper "value"}}');

tpl(function (err, result) {
  // result == "VALUE"
});

Copyright

Copyright (c) 2010 Loïc Mahieu.