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

@funtico/gameloop-sdk

v0.0.4

Published

Funtico Gameloop SDK

Downloads

15

Readme

Installation

npm

npm install @funtico/gameloop-sdk

yarn

yarn add @funtico/gameloop-sdk

pnpm

pnpm add @funtico/gameloop-sdk

CDN

For quick prototyping or simple integrations, you can use the CDN version:

<script src="https://funtico-frontend-js-sdk.pages.dev/funtico-sdk.min.js"></script>
<script>
  const sdk = new FunticoSDK({
    authClientId: 'your-client-id',
    env: 'sandbox' // or 'production'
  });
  // Use the SDK...
</script>

Quick Start

import { FunticoSDK } from '@funtico/gameloop-sdk';

// Initialize SDK for frontend use (no client secret needed)
const sdk = new FunticoSDK({
  authClientId: 'your-auth-client-id',
  env: 'sandbox' // or 'production'
});

// Start authentication flow - simple one-line call
await sdk.signInWithFuntico(
  window.location.origin + '/auth/callback'
);

// Get user info - tokens handled automatically
const userInfo = await sdk.getUserInfo();

// Submit game scores - authentication included
await sdk.saveScore(1500);

// Get leaderboard data - shows top players with their scores
const leaderboard = await sdk.getLeaderboard();

// Sign out - cleanup handled automatically
await sdk.signOut('/login');

Configuration

Basic Setup

import { FunticoSDK } from '@funtico/gameloop-sdk';

const sdk = new FunticoSDK({
  authClientId: 'your-auth-client-id', // Required
  env: 'sandbox' // Optional: 'sandbox' or 'production' (default: 'production')
});

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | authClientId | string | - | Your Funtico OAuth client ID (required) | | env | 'sandbox' \| 'production' | 'production' | Environment to use |

Environment Setup

  • sandbox: For development and testing
  • production: For live applications

📖 Step-by-Step Explanation

1. User Initiates Sign-In

// In your login button handler
const handleLogin = async () => {
  await sdk.signInWithFuntico(
    window.location.origin + '/auth/callback'
  );
  // User is now redirected to Funtico authentication and after he logs in he will be redirected to /auth/callback
};

2. User is authenticated

// Get current user information
const user = await sdk.getUserInfo();

// Submit game scores
await sdk.saveScore(1500);

// Get leaderboard data
const leaderboard = await sdk.getLeaderboard();
console.log('Top player:', leaderboard[0].user.username, 'with score:', leaderboard[0].score);

// Sign out when done (redirects to /login)
await sdk.signOut('/login');

Error Handling

The SDK uses a structured error system for reliable error handling:

import { SDKError, isSDKError } from '@funtico/gameloop-sdk';

try {
  const userInfo = await sdk.getUserInfo();
} catch (error) {
  if (isSDKError(error)) {
    console.error('SDK Error:', error.name, error.status);
    
    switch (error.name) {
      case 'auth_error':
        // User needs to re-authenticate
        console.log('Please log in again');
        await sdk.signInWithFuntico('/auth/callback');
        break;
        
      case 'internal_server_error':
        // Server or network issues
        console.error('Service temporarily unavailable');
        break;
    }
  } else {
    console.error('Unexpected error:', error);
  }
}

Error Types

| Error Type | Status Codes | Description | Recommended Action | |------------|--------------|-------------|-------------------| | auth_error | 401, 403 | Authentication required or expired | Redirect to login | | internal_server_error | 400, 500+ | Server or request errors | Show error message, retry |

Error Class

class SDKError {
  name: 'auth_error' | 'internal_server_error';
  status: number;
}

// Type guard function
function isSDKError(error: unknown): error is SDKError