index.js
function prepareAndResolveMarkers (fn, args) {
    if (markers) {
      // The Markers-object has already been created for this cycle of the event loop:
      // Just run the wraped function
      return fn.apply(this, args)
    }
    try {
      // No Markers yet. This is the initial call or some call that occured during a promise resolution
      // Create markers, apply the function and resolve placeholders (i.e. promises) created during the
      // function execution
      markers = new Markers(engine, options.placeholder)
      var resultWithPlaceholders = fn.apply(this, args)
      return markers.resolve(resultWithPlaceholders)
    } finally {
      // Reset promises for the next execution run
      markers = null
    }
  }
function prepareAndResolveMarkers (fn, args) {
    if (markers) {
      // The Markers-object has already been created for this cycle of the event loop:
      // Just run the wraped function
      return fn.apply(this, args)
    }
    try {
      // No Markers yet. This is the initial call or some call that occured during a promise resolution
      // Create markers, apply the function and resolve placeholders (i.e. promises) created during the
      // function execution
      markers = new Markers(engine, options.placeholder)
      var resultWithPlaceholders = fn.apply(this, args)
      return markers.resolve(resultWithPlaceholders)
    } finally {
      // Reset promises for the next execution run
      markers = null
    }
  }
function prepareAndResolveMarkers ( fn , args ) { if ( markers ) { // The Markers-object has already been created for this cycle of the event loop: // Just run the wraped function return fn . apply ( this , args ) } try { // No Markers yet. This is the initial call or some call that occured during a promise resolution // Create markers, apply the function and resolve placeholders (i.e. promises) created during the // function execution markers = new Markers ( engine , options . placeholder ) var resultWithPlaceholders = fn . apply ( this , args ) return markers . resolve ( resultWithPlaceholders ) } finally { // Reset promises for the next execution run markers = null } }
Wrapper for templates, partials and block-helper callbacks

1) the `markers` variable is initialized with a new instance of Markers
2) a promise is returned instead of a string
3) promise placeholder-values are replaced with the promise-results
in the returned promise
Wrapper for templates partials and block - helper callbacks