0.2.1 • Published 4 years ago

@mikazuki/pixela v0.2.1

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

Pixela.js

GitHub npm (scoped) FOSSA Status

Pixela API for JavaScript written in TypeScript.

Install

yarn add @mikazuki/pixela

CDN : UNPKG | jsDelivr

How to use

In Browser

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@mikazuki/pixela"></script>
<script>
  const client = new window.Pixela("YOUR_NAME", "YOUR_TOKEN");
  client
    .incrementPixel("graph_id")
    .then(() => {
      console.log("Increment Pixel!");
    })
    .catch(() => {
      console.log("Error!");
    });
</script>

In Node.js

import Pixela from "@mikazuki/pixela";

const graphId = "tweets";

const client = new Pixela("username", "token");

// if you don't have an account, create a new account
await client.createUser({ agreeTermsOfService: true, notMinor: true });

// create new graph
await client.createGraph({ id: graphId, name: "Tweets Per Day", unit: "tweets", ...});

// increment today's pixel
await client.incrementPixel(graphId);

If you want to see real-world example?
Please check-out Knockru/Crouton repository!

License

FOSSA Status

0.2.1

4 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago