npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tray

v2.0.1

Published

Node library for creating simple System Tray applications on OSX

Downloads

20

Readme

tray

Node library for creating simple System Tray applications in OSX

Currently only working on node 0.10.x. Support for 0.12.x and io.js will come when NodObjC is updated.

##Installation

npm install native-app tray --save

##Usage

tray relies upon native-app. You must call createApp and pass the app instance to createTray.

var createApp = require('native-app')
var createTray = require('tray')

createApp(function (err, app) {
  createTray(app, function (err, tray) {
    tray.specify({
      title: 'Hello, world!',
      menuItems: [
        {title: 'Informational'},
        {
          title: 'Do something',
          shortcut: 'x',
          action: function () { console.log('You pressed a menuItem!') }
        }
      ]
    })
  })
})

##API Reference

createTray(app, callback)

callback is passed a Tray once it is ready to use.

Each program should only call createTray once. If you want multiple Items in your Tray, simply pass an array to Tray.specify.

Tray

specify(options)

options is an object containing these properties:

  • title: String - Text displayed in the Tray (required)
  • menuItems: [MenuItem] - Items to display in the menu. Each MenuItem is an object containing these properties:
    • title: String - Text displayed for the menuItem (required)
    • action: Function(data) - called when the menuItem is selected. Passed data if it is provided.
    • data - arbitrary data passed to action when it is invoked
    • shortcut: String - Keyboard shortcut that can be pressed when the menu is open. Currently, it must be a single symbol, which is invoked with the cmd modifier. Capitals are OK. For example, k becomes cmd-k and P becomes cmd-shift-p.

close()

Closes the Tray, releasing all memory and removing all items. Any further calls to this Tray will throw.

##Roadmap

  • [ ] Tray icons or styled text in Tray (currently only supports plain text)
  • [ ] Nested menuItems
  • [ ] Separators
  • [ ] State (checkmarks on menuItems)
  • [ ] Keyboard Alternates (different options when holding alt)
  • [ ] Indentation Level
  • [ ] Fancy keyboard shortcuts (support shift-cmd-ctrl-alt-y)
  • [ ] Images in menuItems
  • [ ] Test for memory leaks
  • [ ] API for changing existing Tray Items (rather than re-creating every time, for performance)
  • [ ] Global activation keyboard shortcut (this is non-trivial)