Pixela API for JavaScript written in TypeScript.
yarn add @mikazuki/pixela
CDN : UNPKG | jsDelivr | Pika CDN
<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(r => {
if (r.isSuccess) {
console.log("Pixel Incremented!");
} else {
console.log("Error");
}
});
</script>
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!
Generated using TypeDoc