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

@qt-test/apex-runtime

v0.1.0

Published

Mini-app runtime framework for APEX platform

Readme

@interswitch/apex-runtime

Mini-app runtime framework for APEX platform

This package provides the core runtime framework for APEX mini-apps, including app lifecycle management, page routing, component system, and reactivity.

Installation

npm install @interswitch/apex-runtime

Usage

App Definition

// app.js
import { createApp } from '@interswitch/apex-runtime';

createApp({
  onLaunch(options) {
    console.log('App launched with:', options);
  },

  onShow() {
    console.log('App shown');
  },

  onHide() {
    console.log('App hidden');
  },

  globalData: {
    userInfo: null
  }
});

Page Definition

// pages/index/index.js
import { createPage } from '@interswitch/apex-runtime';

createPage({
  data: {
    message: 'Hello APEX!',
    count: 0
  },

  onLoad(query) {
    console.log('Page loaded with query:', query);
  },

  onShow() {
    console.log('Page shown');
  },

  onReady() {
    console.log('Page ready');
  },

  onHide() {
    console.log('Page hidden');
  },

  onUnload() {
    console.log('Page unloaded');
  },

  // Event handlers
  handleTap() {
    this.setData({
      count: this.data.count + 1
    });
  },

  // Async data update
  async fetchData() {
    const result = await apex.request({ url: '/api/data' });
    this.setData({ items: result.data });
  }
});

Component Definition

// components/button/button.js
import { createComponent } from '@interswitch/apex-runtime';

createComponent({
  properties: {
    text: {
      type: String,
      value: 'Button'
    },
    type: {
      type: String,
      value: 'default' // 'default' | 'primary' | 'danger'
    },
    disabled: {
      type: Boolean,
      value: false
    }
  },

  data: {
    pressed: false
  },

  lifetimes: {
    created() {
      console.log('Component created');
    },
    attached() {
      console.log('Component attached to page');
    },
    detached() {
      console.log('Component detached');
    }
  },

  methods: {
    handleTap() {
      if (!this.properties.disabled) {
        this.triggerEvent('tap', { timestamp: Date.now() });
      }
    }
  }
});

Architecture

Dual-Thread Model

APEX uses a dual-thread architecture to ensure 60fps UI performance:

┌─────────────────────────────┐          ┌─────────────────────────────┐
│       LOGIC THREAD          │          │        VIEW THREAD          │
│                             │          │                             │
│  ┌───────────────────────┐  │          │  ┌───────────────────────┐  │
│  │  JavaScriptCore / V8  │  │  JSON    │  │   WebView Renderer    │  │
│  │                       │  │  Patch   │  │                       │  │
│  │  • app.js execution   │──┼──────────┼─▶│  • AXML rendering     │  │
│  │  • State management   │  │          │  │  • DOM manipulation   │  │
│  │  • API calls          │  │          │  │  • 60fps animations   │  │
│  │  • Business logic     │◀─┼──────────┼──│  • User interactions  │  │
│  │                       │  │  Events  │  │                       │  │
│  │  NO DOM ACCESS        │  │          │  │  NO BUSINESS LOGIC    │  │
│  └───────────────────────┘  │          │  └───────────────────────┘  │
└─────────────────────────────┘          └─────────────────────────────┘

Why Dual-Thread?

  • Scrolling and animations stay at 60fps regardless of JS processing
  • Heavy computations don't block UI
  • Better security isolation

Runtime Components

┌─────────────────────────────────────────────────────────┐
│                    Mini-App Code                         │
│  (app.js, pages/*.js, components/*.js)                  │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                  @interswitch/apex-runtime               │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
│  │ LogicThread │  │ ViewThread  │  │  Component  │     │
│  │             │  │             │  │   System    │     │
│  └─────────────┘  └─────────────┘  └─────────────┘     │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
│  │ JSON Patch  │  │   Router    │  │   Events    │     │
│  │ (RFC 6902)  │  │             │  │             │     │
│  └─────────────┘  └─────────────┘  └─────────────┘     │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
│  │ Reactivity  │  │  Scheduler  │  │  Lifecycle  │     │
│  │   System    │  │             │  │   Hooks     │     │
│  └─────────────┘  └─────────────┘  └─────────────┘     │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                  @interswitch/apex-sdk                   │
│            (Bridge communication layer)                  │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                   Native Host App                        │
└─────────────────────────────────────────────────────────┘

Runtime Usage

import { createRuntime } from '@interswitch/apex-runtime';

const runtime = createRuntime({
  mode: 'single-thread', // or 'dual-thread' for production
  appConfig: {
    appId: 'my-app',
    version: '1.0.0',
    pages: ['/pages/index/index'],
  },
  initialRoute: '/pages/index/index',
  debug: true,
});

// Register pages
runtime.registerPage(
  '/pages/index/index',
  {
    data: { count: 0 },
    onLoad(query) {
      console.log('Page loaded', query);
    },
    handleTap() {
      this.setData({ count: this.data.count + 1 });
    },
  },
  template
);

// Start the runtime
await runtime.start();

API Reference

App Lifecycle

| Event | Description | |-------|-------------| | onLaunch | Triggered when app is launched (once) | | onShow | Triggered when app comes to foreground | | onHide | Triggered when app goes to background | | onError | Triggered when script error occurs | | onPageNotFound | Triggered when page not found |

Page Lifecycle

| Event | Description | |-------|-------------| | onLoad | Triggered when page is loaded | | onShow | Triggered when page is shown | | onReady | Triggered when page rendering is complete | | onHide | Triggered when page is hidden | | onUnload | Triggered when page is unloaded | | onPullDownRefresh | Triggered on pull-down refresh | | onReachBottom | Triggered when scrolled to bottom | | onShareAppMessage | Triggered when user shares |

Component Lifecycle

| Event | Description | |-------|-------------| | created | Component instance created | | attached | Component attached to page | | ready | Component layout complete | | moved | Component moved in tree | | detached | Component detached from page |

License

MIT