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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@moskva/runtime

v0.1.9

Published

JavaScript-рантайм «Москва» с Java-подобной моделью выполнения: вызываемые Runnable-экземпляры, изоляция памяти и предсказуемая инициализация.

Downloads

34

Readme

Рантайм Москва

Этот рантайм предоставляет вызываемые экземпляры функциональных интерфейсов Выполнимый. Выполнимый — это экземпляр класса, который можно вызывать как функцию, аналогично лямбда-выражениям в Java.

// java:
interface Выполнимый {
 void вып() {}
}

Использование

Пример ниже показывает, что несмотря на то, что выполнимый является экземпляром класса, его всё равно можно вызывать как функцию:

var{Выполнимый}=require('@moskva/runtime')

var выполнимый=new class extends Выполнимый {
 конструктор(){
  this.тест=[new Date]
 }
 тест2(){
  return this.тест
 }
 вып(){
  console.log(' < Привет, выполнимый; тест =',this.тест2())
 }
}

console.log('вызов выполняемого:')
выполнимый()
создан новый функциональный [class Выполнимый]
вызов выполнимого:
 < Привет выполнимый; тест = [ 2026-01-28T02:20:37.339Z ]

Назначение

Экземпляры стандартных, не-выполнимых классов нельзя вызывать. Такое поведение доступно только при наследовании от Выполнимый и предназначено для эмуляции функциональных интерфейсов Java, которые предполагают реализацию одного метода.

Требования к реализации

  • Метод вып обязан быть реализован. Он является точкой входа, которая вызывается при обращении к экземпляру как к функции.
  • Реализация может получать доступ к дополнительным внутренним API через this.

Правила инициализации

Поля экземпляра должны инициализироваться внутри конструктор-а.

Синтаксис полей класса не поддерживается. Реализация основана на Прокси, и создание Выполнимых с инициализаторами полей приведёт к бесконечной рекурсии при попытке вызвать конструктор для инициализации полей. В настоящее время не существует безопасного способа перехватить или извлечь инициализаторы полей.


Runtime Moskva

This runtime provides callable instances of Runnable functional interfaces. A Runnable is a class instance that can be invoked like a function. Read more >

interface IRunnable {
 run() {}
}

Usage

An example below shows that even though runner is an instance, it can still be invoked as a function:

var{Runnable}=require('@moskva/runtime')

var runner=new class extends Runnable {
 const(){
  this.test=[]
  this.test.push(new Date)
  // or this.test=['test']
 }
 test2(){
  return this.test
 }
 run(){
  console.log(' < Hello runner; test =',this.test2())
 }
}

console.log('calling runner:')
runner()
created new functional [class Runnable]
calling runner:
 < Hello runner; test = [ 2026-01-27T23:19:34.106Z ]

Purpose

Since instances of standard, non-runnable classes cannot be invoked. This behaviour is only available when extending Runnable, to enable emulation of Java's functional interfaces that are supposed to implement 1 method.

Implementation requirements

  • The run method must be implemented. It is the entry point invoked when the instance is called.
  • The implementation can access additional internal APIs via this.

Initialisation rules

Instance fields must be initialised inside the const method.

Class field syntax is not supported. The implementation relies on a proxy, and constructing a Runnable with field initialisers would cause infinite recursion. There is currently no safe way to intercept or extract field initialisers.

Unless a viable solution is found, this limitation will remain.


(c) 2026