From 21d15f69e69870292c30e5b2a17b541b22f5b098 Mon Sep 17 00:00:00 2001 From: Gavin Joyce Date: Thu, 12 Jan 2017 16:58:46 +0000 Subject: [PATCH] exclude function from production builds --- .../lib/system/application.js | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/packages/ember-application/lib/system/application.js b/packages/ember-application/lib/system/application.js index 974aaf7bb25..8d5fdc1e531 100644 --- a/packages/ember-application/lib/system/application.js +++ b/packages/ember-application/lib/system/application.js @@ -1050,24 +1050,28 @@ function registerLibraries() { } } -function logLibraryVersions() { - if (ENV.LOG_VERSION) { - // we only need to see this once per Application#init - ENV.LOG_VERSION = false; - let libs = libraries._registry; +let logLibraryVersions; - let nameLengths = libs.map(item => get(item, 'name.length')); +runInDebug(() => { + logLibraryVersions = function() { + if (ENV.LOG_VERSION) { + // we only need to see this once per Application#init + ENV.LOG_VERSION = false; + let libs = libraries._registry; - let maxNameLength = Math.max.apply(this, nameLengths); + let nameLengths = libs.map(item => get(item, 'name.length')); - debug('-------------------------------'); - for (let i = 0; i < libs.length; i++) { - let lib = libs[i]; - let spaces = new Array(maxNameLength - lib.name.length + 1).join(' '); - debug([lib.name, spaces, ' : ', lib.version].join('')); + let maxNameLength = Math.max.apply(this, nameLengths); + + debug('-------------------------------'); + for (let i = 0; i < libs.length; i++) { + let lib = libs[i]; + let spaces = new Array(maxNameLength - lib.name.length + 1).join(' '); + debug([lib.name, spaces, ' : ', lib.version].join('')); + } + debug('-------------------------------'); } - debug('-------------------------------'); } -} +}); export default Application;