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

flow-launcher-helper

v2.2.0

Published

A simple lib to help build plugins for Flow Launcher

Downloads

16

Readme

Installation

npm install flow-launcher-helper

Usage

I recommend you read the Flow docs before writing your plugin. This example is based on their example.

import { Flow } from 'flow-launcher-helper';

const { on, showResult, run } = new Flow();

on('query', (params) => {
  showResult({
    title: 'Hello World',
    subtitle: `Showing your query parameters: ${params}. Click to open Flow's website`,
    method: 'do_something_for_query',
    params: ['https://github.com/Flow-Launcher/Flow.Launcher'],
    iconPath: 'Images\\app.png',
  });
});

on('do_something_for_query', () => {
  const url = params;
  open(url);
});

run();

Flow

Parameters

  • defaultIconPathstring (optional): the default icon path that will be sent to Flow, so you don't need to specify everytime in the showResult function.

Methods

  • methodstring: current method.
  • requestParams - FlowParameters: array of parameters sent from Flow.
  • settingsobject: plugin settings.
  • on(params: T extends FlowParameters) => void: receives a method (string) and a callback function that will be executed when the method matches the current method.
  • showResult(...results: JSONRPCResponse<TMethods>[]) => void: receives an array of results, where you specify the title, subtitle, method, params and icon path, and logs the data to be displayed in Flow.
  • runfunction: runs the current method. You should call this function at the end of your script, or after all the on functions have been called.
  • ~~paramsstring: current parameters.~~
    • Note: it is no longer recommended to get the params from this method, as it returns only the first parameter as a string.
Typescript

If you're writing a plugin in Typescript, you can add types to method and settings.

Example
type Methods = 'my_method' | 'my_other_method'

interface Settings {
  username: string;
  api_token: string;
}

const { method, settings } = new Flow<Methods, Settings>()

console.log(method === 'my_method') // ✅ true
console.log(method === 'another_method') // ❌ false
console.log(settings.username) // ✅
console.log(settings.name) // ❌ Property 'name' does not exist on type 'Settings'