Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@telazer/zilana_client_sdk

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telazer/zilana_client_sdk

The Zilana SDK is a lightweight library for managing player sessions, tracking events, and syncing data with a backend server. This guide explains the available public methods and provides examples for integration.

  • 1.0.0-beta.14
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
200
decreased by-28.06%
Maintainers
0
Weekly downloads
 
Created
Source

Zilana SDK

The Zilana SDK is a lightweight library for managing player sessions, tracking events, and syncing data with a backend server. This guide explains the available public methods and provides examples for integration.


Installation

npm i @telazer/zilana_client_sdk

Configuration

The SDK requires configuration details such as userId, gameId, and a mapping of event names to eventIds.


Initialization

Method: initialize

Initializes the SDK, setting up sessions and enabling event tracking.

Parameters:

  • config: An object containing:
  • userId: The unique identifier for the user.
  • gameId: The unique identifier for the game.
  • eventMap: A key-value pair mapping event names to their corresponding IDs.
  • debug (optional): Enables debug logging if set to true.

Example:

import { Zilana } from './zilana-sdk';

const config = {
  userId: '<UUID>',
  gameId: '<UUID>',
};

const eventMap = {
  USER_LOGGED_IN: '<UUID>',
  LEVEL_COMPLETED: '<UUID>',
  ITEM_PURCHASED: '<UUID>',
};

// Initialize the SDK
Zilana.initialize({ config, eventMap, debug: true });

Public Methods

1. recordEvent

Records an event for the current active session.

Parameters:

  • eventName: The name of the event to be recorded. Must exist in the eventMap provided during initialization.

Example:

Zilana.recordEvent('LEVEL_COMPLETED');

Features

  1. Automatic Session Management: Sessions are automatically created when the SDK initializes.
  2. Event Tracking: Record custom events and associate them with active sessions.
  3. Health Checks: Regular integrity checks for session and player data.
  4. Debug Logging: Detailed logs for debugging when debug is enabled.

Local Storage

The SDK uses the browser's localStorage to persist session data under the key com.telazer.zilana-data.


Debugging

Enable debug mode during initialization:

Zilana.initialize({ config, eventMap, debug: true });

This will log all informational and warning messages to the console.


Example Usage

import { Zilana } from './zilana-sdk';

const config = {
  userId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
  gameId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
};

const eventMap = {
  USER_LOGGED_IN: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
  LEVEL_COMPLETED: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
  ITEM_PURCHASED: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
};

// Initialize the SDK
Zilana.initialize({ config, eventMap, debug: true });

// Record a user login event
Zilana.recordEvent('USER_LOGGED_IN');

// Record a level completion event
Zilana.recordEvent('LEVEL_COMPLETED');

Support

For assistance or to report issues, contact the development team at dev@telazer.com.

FAQs

Package last updated on 05 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc