Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Add missing statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Scandurra committed Feb 17, 2017
1 parent a403cb9 commit 5c08577
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/cache-panel-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export default class CachePanelView {

getLessCompiles () {
const lessCache = atom.themes.lessCache
if (lessCache && lessCache.cache && less.cache.stats && less.cache.stats.misses) {
return less.cache.stats.misses || 0
if (lessCache && lessCache.cache && lessCache.cache.stats && lessCache.cache.stats.misses) {
return lessCache.cache.stats.misses || 0
} else {
return 0
}
Expand Down
3 changes: 2 additions & 1 deletion lib/package-panel-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/** @jsx etch.dom */

import {Disposable} from 'atom'
import etch from 'etch'

export default class PackagePanelView {
constructor ({title}) {
Expand Down Expand Up @@ -40,7 +41,7 @@ export default class PackagePanelView {
}

addPackages (packages, timeKey) {
for (const package of packages) {
for (const pack of packages) {
this.addPackage(pack, timeKey)
}
}
Expand Down
39 changes: 21 additions & 18 deletions lib/timecop-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import _ from 'underscore-plus'
import dedent from 'dedent'
import {Disposable} from 'atom'
import etch from 'etch'
import CachePanelView from './cache-panel-view'
import PackagePanelView from './package-panel-view'
import WindowPanelView from './window-panel-view'
Expand Down Expand Up @@ -54,22 +55,11 @@ export default class TimecopView {
this.showActiveThemes()
}

getSlowPackages (packages, timeKey) {
let time = 0
let count = 0
packages = packages.filter(function (pack) {
time += pack[timeKey]
count++
return pack[timeKey] > 5
})
packages.sort((pack1, pack2) => pack2[timeKey] - pack1[timeKey])
return {time, count, packages}
}

showLoadedPackages () {
let count, time
let packages = atom.packages.getLoadedPackages().filter(pack => pack.getType() !== 'theme')
{time, count, packages} = this.getSlowPackages(packages, 'loadTime')
const {time, count, packages} = this.getSlowPackages(
atom.packages.getLoadedPackages().filter(pack => pack.getType() !== 'theme'),
'loadTime'
)
this.refs.packageLoadingPanel.addPackages(packages, 'loadTime')
this.refs.packageLoadingPanel.refs.summary.textContent = dedent`
Loaded ${count} packages in ${time}ms.
Expand All @@ -78,9 +68,10 @@ export default class TimecopView {
}

showActivePackages () {
let count, time
let packages = atom.packages.getActivePackages().filter(pack => pack.getType() !== 'theme');
{time, count, packages} = this.getSlowPackages(packages, 'activateTime')
const {time, count, packages} = this.getSlowPackages(
atom.packages.getActivePackages().filter(pack => pack.getType() !== 'theme'),
'activateTime'
)
this.refs.packageActivationPanel.addPackages(packages, 'activateTime')
this.refs.packageActivationPanel.refs.summary.textContent = dedent`
Activated ${count} packages in ${time}ms.
Expand All @@ -106,6 +97,18 @@ export default class TimecopView {
`
}

getSlowPackages (packages, timeKey) {
let time = 0
let count = 0
packages = packages.filter(function (pack) {
time += pack[timeKey]
count++
return pack[timeKey] > 5
})
packages.sort((pack1, pack2) => pack2[timeKey] - pack1[timeKey])
return {time, count, packages}
}

serialize () {
return {
deserializer: this.constructor.name,
Expand Down
1 change: 1 addition & 0 deletions lib/window-panel-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/** @jsx etch.dom */

import {CompositeDisposable} from 'atom'
import etch from 'etch'

export default class WindowPanelView {
constructor () {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"atom-space-pen-views": "^2.0.0",
"dedent": "^0.7.0",
"etch": "^0.8.0",
"underscore-plus": "^1.0.0"
},
"devDependencies": {
Expand Down

0 comments on commit 5c08577

Please sign in to comment.