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

bg-atom-utils

v2.3.2

Published

Utilities for writing Atom packages in spirit of bg-lib system

Downloads

29

Readme

bg-atom-utils package

2020-09 Status

As of 2020-09 this is a work in progress and is on its second version. The dependency between this and bg-redom-ui has flipped. That will evolve into an independent JS / DOM component library and this package will use that library to provide an Atom specific API.

A new feature in this release that I am excited about is the PolyfillObjectMixin pattern. I submitted several PR to Atom projects in the beginning of the year that have gotten no attention despite asking for advice in the atom slack group. This pattern allows me to publish Atom plugins that depend on those changes by including a dynamically applied patch which will automatically turn off if the PR is ever accepted.

This package provides extensions to most of the atom.* objects using PolyfillObjectMixin that are currently unconditionally installed when the first atom package imports this npm. If this becomes popular, I will have to improve the mechanism to deal with different versions of this npm being used and other packages also using PolyfillObjectMixin to provide extensions that might conflict.

Summary

This is an NPM Package that provides utilities to for writing Atom plugins.

It extends many of the objects found at atom.* in the global namespace by providing PollyfillObjectMixin classes that are installed when the first atom package that depends on this package is loaded.

See the atom package bg-atom-packageDev (WIP) which (will) demonstrate how to use this package and provide some tools for development.

Classes

  • class BGAtomPlugin : base class for creating the main entrypoint for Atom packages.
  • class BGAtomView : base class for creating new Atom WorkspaceItems displayed in panes.
  • class BGTimer : class for simple timing of code
  • class BGFeedbackDialog : class for displaying feedback for long tasks

Functions

  • function bgAsyncSleep(ms) : delay function to be used in sync functions
  • function DispatchCommand -- wrapper for atom.commands.dispatch on the active target
  • function BGRemoveKeybindings -- dynamically disable some keystroke from your package

Dynamic Patches (aka Atom polyfills)

These are enhancements to the Atom API. The global objects or classes are patched to add or change methods. These each use the PolyfillObjectMixin class to extend global objects in a controlled way.

  • atom.config
    • removeSchema : there was already an addSchema but this adds the ability to undo what addSchema does at runtime.
    • existsSchema : check to see if a schema exists at a particular key
    • addDep, addDep_ : family of methods that integrate with the DependentsGraph. alternative to onDidChange
    • onDidChangeAny : enhancement to onDidChange that can register the callback on multiple keys at once and adds key to {key,newValue,oldValue}
    • getConfigKeys : query the set of available config keys
  • atom.workspace
    • addDep, addDep_ : family of methods that integrate with the DependentsGraph. alternative to onDidChange
    • getItemByURI : return the first WorkspaceItem that matches the uri
    • getItemsByURI : return all WorkspaceItems that matches the uri in an array
    • hide : enhances to be more flexible in matching uri
  • atom.packages
    • addDep, addDep_ : family of methods that integrate with the DependentsGraph. alternative to onDidChange
  • atom.project
    • addPath : overridden to recognize when a sandbox folder is being added and replaces the sandbox folder with the subprojects instead. This is like a shortcut to add multiple top-level root folders.