JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48
  • Score
    100M100P100Q46562F
  • License MIT

A powerful NPM module/library to interact with the Scratch API

Package Exports

  • scratchlib

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (scratchlib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Scratchlib

A powerful library to interact with the Scratch API 🚀

npm shit Libraries.io dependency status for latest release, scoped npm package NPM license npm travis

Table of contents

About

ScratchLib is a powerful Node.JS module to work with the Scratch API. It provides many methods and properties you never heard of, and does requests for you.

Installation

NPM

Open a terminal. If you are beginning your project, init the folder with npm init. It will create a package.json file.
Then, you have to install the dependencies, by doing npm install in the console.

How to use

Start by requiring the module.

const Scratchlib = require("scratchlib");

Congrats - you can now access to the many properties this module offers!

Documentation

In order to use a method, you must choose between creating an async function or by adding a callback with .then().
async function():

async function test() {
    try {
        let info = await ScratchLib.getStatus();
        console.log(info);
    } catch (err) {
        console.error(err);
    }
}

test();

.then() callback:

ScratchLib.getStatus().then(info => {
    console.log(info);
}).catch(err => {
    console.error(err);
});

Both equals to:

{
  version: '1d96065a1ea1d017949e2bd8e179762744d231f0',
  uptime: 1013664,
  load: [ 0.1611328125, 0.134765625, 0.09619140625 ],
  sql: { ssl: true, min: 0, max: 40 },
  cache: { connected: true, ready: true }
}

⚠ Don't forget to catch the promise.

ScratchLib.getUserActivity().then(info => {
    console.log(info);
}).catch(err => {
    console.error(err);
});
Output: Parameter of type string is missing!

↪ You can get methods/documentation here: https://en.scratch-wiki.info/wiki/Scratch_API

Contributing

You can contribute to this project by doing a PR, that are very appreciated 😉

Help

Do you need help? Message me on Discord: Mazz#4946.