Tint SDK
A SDK for TINT Clients. A bunch of methods that allow to building own themes.
Installation
npm install @tintup/tint-sdk
Or
yarn install @tintup/tint-sdk
Quick start
- Create the Tint instance:
const tint = new Tint(tintSlug)
You can get the tint slug by going to Tint website and creating a new Tint. - After you crate the new instance you should run
up
method on the instance to get the basic data:tint.up()
.
Examples:
Pagination
const tint = new Tint('mySlug');
const { postsResponse } = await tint.up();
const links = postsResponse.links;
if (links.next) {
const { posts: nextPosts, inks: getPageNewLinks, postsRelationships: nextPostRelationships } = await tint.getPage(
links.next
);
}
Long polling events
const tint = new Tint('mySlug');
const { pollingObserver, postsResponse } = await tint.up();
let postsToDisplay = postsResponse.posts;
if (pollingObserver) {
pollingObserver.subscribe(async (posts) => {
postsToDisplay = posts;
});