From 1b7e27d8a472653310db1ed30010ab36b9d55c9f Mon Sep 17 00:00:00 2001 From: liabru Date: Tue, 7 Jul 2015 21:07:48 +0100 Subject: [PATCH] added options to Metrics.create --- src/core/Engine.js | 2 +- src/core/Metrics.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/Engine.js b/src/core/Engine.js index eb22aa2..a6a3014 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -75,7 +75,7 @@ var Engine = {}; engine.metrics = engine.metrics || { extended: false }; // @if DEBUG - engine.metrics = engine.metrics || Metrics.create(); + engine.metrics = Metrics.create(engine.metrics); // @endif return engine; diff --git a/src/core/Metrics.js b/src/core/Metrics.js index 03d3eb9..13c1aaf 100644 --- a/src/core/Metrics.js +++ b/src/core/Metrics.js @@ -14,8 +14,8 @@ var Metrics = {}; * @private * @return {metrics} A new metrics */ - Metrics.create = function() { - return { + Metrics.create = function(options) { + var defaults = { extended: false, narrowDetections: 0, narrowphaseTests: 0, @@ -31,6 +31,8 @@ var Metrics = {}; bodies: 0, pairs: 0 }; + + return Common.extend(defaults, false, options); }; /**