Giter VIP home page Giter VIP logo

extension's Introduction

CS2 Inventory Extension

Our goal is to standarize the window.cs2inventory api for all extensions to use. Any extension can provide spec-compliant implementation of window.cs2inventory for any site to use. This way users can benefit from extension on all websites, similarly to how many web3 wallets share the same API.

Discuss: https://discord.gg/kXJGt9vPhy

API

function loadInventory(appId: number, contextId: number | string): Promise<SteamInventory>

Usage (host site)

Check if cs2inventory is present in user browser. Fetch inventory using the extension and send to your API for processing

<script>
  // Client-side code, this is executed in browser
  if ('cs2inventory' in window) {
    const inventory = await window.cs2inventory.loadInventory(730, 2)
    reportUserInventory(inventory)
  }

  async function reportUserInventory(inventory) {
    // All request to this endpoint should be treated as UNSAFE
    return fetch('/api/report-user-inventory', {
      method: 'POST',
      body: JSON.stringify(inventory)
    })
  }
</script>

Install (dev)

  1. Visit chrome://extensions
  2. Enable developer mode (upper right corner)
  3. Click "Load unpacked"
  4. Select extension directory from this repository

Logs

  1. Visit chrome://extensions
  2. Click "service worker" under the extension card

Open Service Worker

extension's People

Contributors

aareksio avatar daniandl avatar pepzwee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.