var React = require('react'); var Util = require('../util'); module.exports = React.createClass({ getInitialState: function() { return { icon: '' }; }, render: function() { var desktopEntry = this.props.desktopEntry; var label = desktopEntry.Name; var category = desktopEntry.Categories; // Search for best icon var icon = ''; if(!this.state.icon) { this._findIcon(desktopEntry.Icon); } else { icon = this.state.icon; } return (
  • {label}
  • ); }, _findIcon: function(iconPath) { var desktopEntry = this.props.desktopEntry; Util.DesktopApps.findIcon(iconPath) .then(function(iconPath) { this.setState({ icon: iconPath }); }.bind(this)) ; } });