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

@errorgamer2000/scratch-cloud

v0.1.0

Published

A TypeScript library that allows communication with the scratch cloud servers.

Downloads

5

Readme

scratch-cloud

A TypeScript library that allows communication with the scratch cloud servers.

A short example:

import { ScratchCloud } from "@errorgamer2000/scratch-cloud";

async function main() {
  const cloud = new ScratchCloud();

  await cloud.login("<username>", "<password>");

  const session = cloud.createSession(
    "<project_id>",
    false /* do not use TurboWarp servers */
  );

  session.on("set", (name: string, value: string) => {
    console.log(`${name} was set to ${value}.`);
  });
}

This is a rewrite of the cloudsession api from my original scratch3-api module. This module provides only methods to communicate with the Scratch/TurboWarp cloud servers. To use methods that are not centered around the cloud servers, use scratch-connect(not yet published). For string to number conversions, see stringstonumbers.

Installation

Install with npm or other package manager:

npm install @errorgamer2000/scratch-cloud

Or by cloning this repository:

git clone https://github.com/ErrorGamer2000/scratch-cloud.git

Exports:

Classes

ScratchCloud

Kind: global class

new ScratchCloud()

scratchCloud.login(username, password)

Kind: instance method of ScratchCloud Throws:

  • TypeError If the username or password are incorrect.
  • Error If the scratch server gives an invalid response.

| Param | Description | | -------- | -------------------------------------------------- | | username | The username of the account to log in with. | | password | The password of the account to log in with. |

scratchCloud.createSession(project, turbowarp)

Kind: instance method of ScratchCloud

| Param | Default | Description | | --------- | ------------------ | ----------------------------------------------------------------------------- | | project | | The ID of the project to connect to. | | turbowarp | false | Use the TurboWarp cloud servers rather than the Scratch cloud servers. |

Session

Kind: global class

new Session(userData, projectId, turbowarp)

| Param | Default | Description | | --------- | ------------------ | ------------------------------------------------------------------------------------ | | userData | | Data used to validate the user's login and connect using the correct account. | | projectId | | The ID of the project to connect to. | | turbowarp | false | Use the TurboWarp cloud servers rather than the Scratch cloud servers. |

session.set(name, value)

Kind: instance method of Session

| Param | Description | | ----- | -------------------------------------------------------------------------------------------------- | | name | The name of the cloud variable. | | value | The value to set it to. Can be a string or a number, but can only include numerical digits. |

session.get(name)

Kind: instance method of Session

| Param | Description | | ----- | ------------------------------------- | | name | The name of the cloud variable |

session.enableAutoPrefix()

Kind: instance method of Session See: Session.autoPrefix

session.disableAutoPrefix()

Kind: instance method of Session See: Session.autoPrefix

session.on(eventName, listener)

Kind: instance method of Session

| Param | Description | | --------- | ----------------------------- | | eventName | The name of the event. | | listener | The callback function. |

session.once(eventName, listener)

Kind: instance method of Session

| Param | Description | | --------- | ----------------------------- | | eventName | the name of the event. | | listener | the callback listener. |

© 2022 ErrorGamer2000