var hinoki = require('hinoki');
var trace = require('hinoki-trace');
var Promise = require('bluebird');

var container = {};

container.factories = {
  times: function() {
    return function(a, b) {
      return a * b;
    };
  },
  squared: function(times) {
    return function(a) {
      return Promise.delay(times(a, a), Math.random() * 500);
    };
  }
};

traceTheseFunctions = ['times', 'squared'];

tracingFactoryResolver = trace.newTracingFactoryResolver(traceTheseFunctions);

container.factoryResolvers = [tracingFactoryResolver];

hinoki.get(container, 'squared').then(function(squared) {
  Promise.all([1, 2, 3, 4, 5].map(function(x) {
    return squared(x);
  })).then(console.log);
});

var hinoki = require('hinoki');
var trace = require('hinoki-trace');
var Promise = require('bluebird');

var container = {};

container.factories = {
  times: function() {
    return function(a, b) {
      return a * b;
    };
  },
  squared: function(times) {
    return function(a) {
      return Promise.delay(times(a, a), Math.random() * 500);
    };
  }
};

traceTheseFunctions = ['times', 'squared'];

container.resolvers = [
  trace.newTracingResolver(traceTheseFunctions)
];

hinoki.get(container, 'squared').then(function(squared) {
  Promise.all([1, 2, 3, 4, 5].map(function(x) {
    return squared(x);
  })).then(console.log);
});

make example work again