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

@jolibox/sdk

v1.0.11

Published

Jolibox JavaScript SDK for Ads

Downloads

922

Readme

Jolibox SDK

Jolibox SDK is a JavaScript library that provides a simple way to integrate with Jolibox Ads, Runtime, and other services.

Installation

We recommend using the SDK via CDN so that you can automatically get updates in future SDK versions.

Via CDN

If you want to use the library via CDN, you add the following script tag to your HTML file.

In such case, you should not write the import statement in your JavaScript file.

<script src="https://cdn.jsdelivr.net/npm/@jolibox/sdk@1/dist/index.iife.js"></script>

Via NPM

If you want to use the library via NPM, you can install it via the following command:

In such case, you should not include the script tag in your HTML file but write the import statement in your JavaScript file.

  • npm

    npm install @jolibox/sdk
  • pnpm

    pnpm add @jolibox/sdk
  • yarn

    yarn add @jolibox/sdk

Basic usage

  • Initialization

    // If you are importing the library via NPM, you can use the following import statement
    // import { JoliboxSDK } from "@jolibox/sdk";
    
    const jolibox = new JoliboxSDK();
    const { ads, runtime } = jolibox;
    
    // When your game is loading, call notifyLoadProgress to notify the loading progress
    runtime.notifyLoadProgress(30);
    runtime.notifyLoadProgress(60);
    runtime.notifyLoadProgress(90);
    
    // When your game is loaded, call loadFinished to notify the loading is finished
    runtime.loadFinished();
    
    // Initialize ads
    ads.init();
    
    // somewhere when you need to preload ads (e.g. in the game loading screen)
    ads.adConfig({
      preloadAdBreaks: "on",
      sound: "off",
      onReady: () => {
        console.log("onReady");
      },
    });
    
    // Somewhere when you need a popup ads for reward
    ads.adBreak({
      type: "reward",
      beforeReward(showAdFn) {
        showAdFn();
      },
      adDismissed: () => {
        console.log("adDismissed");
      },
      adViewed: () => {
        console.log("adViewed");
      },
      adBreakDone: () => {
        console.log("adBreakDone");
      },
    });
    
    // If you need to show a banner ad, you should call the following function when you start the App
    // You have you make sure the element with the id "banner" is in your HTML file and it is together with the game canvas
    ads.adUnit({
      el: "#banner", // or document.getElementById("banner")
    });