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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@bobfrankston/msgapidefs

v0.1.29

Published

TypeScript definitions for msgapi JavaScript API (msgview/msger)

Downloads

1,536

Readme

@bobfrankston/msgapidefs

TypeScript definitions for the msgapi JavaScript API used in msgview and msger.

Installation

npm install @bobfrankston/msgapidefs

Usage

// Import to register global window.msgapi type
import '../node_modules/@bobfrankston/msgapidefs/msgapidefs.js';
// Note: '../node_modules/@bobfrankston/msgapidefs/index.js' may also work via package.json exports

// Or import types explicitly
import type { MsgAPI, MsgResult } from '../node_modules/@bobfrankston/msgapidefs/msgapidefs.js';

// msgapi provides APIs not available in browsers/webviews
if (window.msgapi) {
    // Window control beyond browser capabilities
    window.msgapi.setFullscreen(true);
    window.msgapi.setAlwaysOnTop(true);

    // File system access (requires allowFs flag)
    const file = await window.msgapi.fs?.selectFile();
}

// For standard browser APIs, use native methods:
document.title = 'My App';  // Instead of msgapi.setTitle()
localStorage.setItem('key', 'value');  // Instead of msgapi.saveData()
window.close();  // Instead of msgapi.close() if not passing result

API Reference

Window Control

  • toggleFullscreen() - Toggle fullscreen mode
  • setFullscreen(enabled: boolean) - Set fullscreen state
  • minimize() - Minimize window
  • maximize() - Toggle maximize/restore
  • setSize(width, height) - Set window size
  • setPosition(x, y) - Set window position
  • setAlwaysOnTop(enabled: boolean) - Keep window on top
  • close(result?) - Close window and return result to parent process

File System

  • fs.selectFile(options?) - Open file picker
  • fs.selectFiles(options?) - Open multi-file picker
  • fs.saveFileAs(content, filename?, options?) - Save file dialog
  • fs.selectFolder(options?) - Folder picker
  • fs.read(path) - Read file (requires allowFs flag)
  • fs.write(path, content) - Write file (requires allowFs flag)
  • fs.list(path) - List directory (requires allowFs flag)
  • fs.exists(path) - Check if file exists (requires allowFs flag)
  • fs.delete(path) - Delete file (requires allowFs flag)

Examples

See samples.html for interactive examples and demos of all API features!

Test in msgview:

msgview -url "file:///path/to/node_modules/@bobfrankston/msgapidefs/samples.html"

Test in msger:

msger -url "file:///path/to/node_modules/@bobfrankston/msgapidefs/samples.html"

Test in browser:

# Open samples.html in your browser to test browser compatibility

The samples demonstrate:

  • Window control (fullscreen, minimize, maximize, resize, position)
  • Data persistence (save/load user preferences, session data, recent files)
  • Presentation mode example
  • Session management
  • And more!

Related Packages

License

ISC