Parallelix
DemoGitRoadmapAbout Us
  • Get Started
    • Welcome to Parallelix
    • Installation and Usage
    • Develop your modules
  • Roadmap
  • API Reference
    • General Client
    • VK Bridge (Mini Apps)
    • Telegram Mini Apps
    • PWA and Web Applications
    • WeChat
    • Direct Games
    • Yandex Games
  • Android and iOS (Apache Cordova)
  • Windows, Mac, Linux (Electron)
  • About
    • Product Page
    • GitHub
    • Our Website
Powered by GitBook
On this page
  • About General Client Classes (parallelix.js)
  • General Client API Reference (Parallelix)
  • Basic Virtual Class for Platform Modules (ParallelixWrapper)
  • Platform-Specific References
  1. API Reference

General Client

Detailed parsing and description of all basic system methods of the main class and virtual platform class

About General Client Classes (parallelix.js)

The main script parallelix.js contains two classes, the main one - Parallelix and an additional virtual class ParallelixWrapper. Let's analyze why they are needed in general.

  • Parallelix (class) - It contains basic methods and events for initialization of required platforms. Further work after platform definition is done with its instance through the unified API described in ParallelixWrapper, as all modules are inherited from it.

  • ParallelixWrapper (class) - Contains virtual properties and methods that describe a single and unified API for each module and platform.

Now that we are clear, we can start describing the methods and their parameters.


General Client API Reference (Parallelix)

To work with Parallelix you need to create an instance of the class of the same name. Below we will consider description of all fields and types.

Parallelix Class

Field
Type
Description

constructor(options)

Basic Parallelix Constructor. Setup general configuration and handlers

OnError(error)

Callback Handler [Error]

Fired on any initialization errors from General Class or Platfrom-specific initialization

OnInitialized()

Callback Handler

Fired when General Class and Platform-specific class are completely initialized

Initialize()

Function

Starts initialization of the class and all necessary classes for the required platforms, determines the current application platform and calls OnInitialized in case of success or OnError in case of an error

LoadLibraries(libraries, onSucces, onError)

Function [Array, Callback, Callback]

Loads the necessary libraries and plugs them into the body tag of your page, then calls onSuccess. Or onError is called in case of an error

LoadLibrary(library, onSuccess, onError)

Function [string, Callback, Callback]

Load the necessary library by url and plugs them into the body tag of your page, then calls onSuccess. Or onError is called in case of an error

GetPlatformName()

Function

Returns current loaded and detected platform name (string)

Platform

Invoker

object

Returns an object that contains a reference to an instance of an SDK or API class used for the internal workings of the current platform.

ConnectWrappers(onConnected)

Internal Function [Callback]

This function is executed inside Parallelix initialization to connect the necessary platforms from the class configuration

DetectPlatform()

Internal Function

Sorts the classes of different connected platforms by priority, after which each of them calls a method to check the current platform and sets the current platform to the Parallelix class

ParallelixConfig

Field
Type
Description

baseModulesPath

string

Sets the base storage path of libraries to be loaded by name from the supportedPlatforms array

supportedPlatforms

Array [string]

Example:

["vk","telegram","web"]

An array of supported platforms. It will always include the "web" platform as the default platform, so scripts must be present in baseModulesPath

specificLibraries

Array [object]

Example:

[{

platform: "vk",

script: "script_url.js"

}]

Stores an array of objects indicating the need to connect certain scripts for specific platform

[dynamic objects]

object(s)

For Example:

vk: {

// VK Specific Options

}

Dynamic configuration objects can also be added to the constructor object for each module. The name of the object is the same as the name of the module.


Basic Virtual Class for Platform Modules (ParallelixWrapper)

Now let's consider the description of types and methods used in the ParallelixWrapper virtual class. All modules you use in your project are inherited from it.

ParallelixWrapper class

Field
Type
Description

constructor(instance, options)

Priority

Number [int]

Returns Platform Detection Priority from 0 to 1000 (do not use 1000 - it is for default "web" module)

Invoker

object

Returns a platform-specific SDK or API instance

GetLaunchParams(onSuccess, onError)

Function [Callback, Callback]

Request a launch parameters for current platform. Returns an object in onSuccess callback.

launchParams

object

Platform-specific launch parameters object.

ToggleFullscreen(isEnabled)

Function [boolean]

Toggle fullscreen for this platform

AddToHomeScreen(onSuccess, onError)

Function [Callback, Callback]

Add your web application to device home screen on specific platform

OpenPaymentForm(parameters, onSucces, onError)

Open platform specific native payment form with parameters object and fire Callbacks.

AddToFavorites(parameters, onSucces, onError)

Add applicaiton to platform-specific favourites section

ShareApplication(parameters, onSuccess, onError)

Platform-specific application sharing with callbacks. onSuccess callback returns platform specific result data object.

PublishStory(mediaURL, parameters, onSuccess, onError)

Platform-specific stories publication. onSuccess callback returns platform specific result data object.

AllowNotifications(onSuccess, onError)

Function [Callback, Callback]

Platform-specific push-notification request. onSuccess callback returns platform specific result data object.

ShowQRReader(parameters, onSuccess, onError)

Platform-specific QR code reader request. onSuccess callback returns platform specific result data object.

RequestUserEmail(onSuccess, onError)

Function [Callback, Callback]

Platform-specific user email request. onSuccess callback returns platform specific result data object.

RequestLocation(onSuccess, onError)

Function [Callback, Callback]

Platform-specific geolocation request. onSuccess callback returns platform specific result data object.

RequestUserPhone(onSuccess, onError)

Function [Callback, Callback]

Platform-specific user phone number request. onSuccess callback returns platform specific result data object.

GetUserInfo(parameters, onSuccess, onError)

Platform-specific user information request. onSuccess callback returns platform specific result data object.

RequestAuthToken(parameters, onSuccess, onError)

Platfrom-specific authentication token request. onSuccess callback returns platform specific result data object.

GetStorage(parameters, onSuccess, onError)

Platform-specific user storage key request. onSuccess callback returns platform specific result data object.

SetStorage(parameters, onSuccess, onError)

Platform-specific user storage set key values. onSuccess callback returns platform specific result data object.

CallCustomMethod(methodName, parameters, onSuccess, onError)

Platform-specific request to internal method. onSuccess callback returns platform specific result data object.

CallCustomMethod(methodName, onSuccess, onError)

Function [string, Callback, Callback]

CallCustomMethod override without parameters object.

CallAPI(methodName, parameters, onSuccess, onError)

Platfrom-specific raw API request. onSuccess callback returns platform specific result data object.

OpenLink(url)

Function [string]

Platform-specific open external link. onSuccess callback returns platform specific result data object.

CloseApplication(onSuccess, onError)

Function [Callback, Callback]

Platform-specific application close.

GoBack()

Function

Plafrom-specific emulation of GoBack button.

AddEventListener(eventName, eventHandler)

Function [string, Callback]

Add platform-specific listener for events fired by platform

RemoveEventListener(eventName, eventHandler)

Function [string, Callback]

Remove platform specific event listener

GetEventListener(eventName)

Function [Callback]

Returns Callback for event listener by name

Initialize()

Internal Function

IsCurrentPlatform()

Internal Function

PlatformSpecificParameters

When forming a parameter object to call certain methods in inherited classes from ParallelixWrapper, you must pass parameters for each platform you need with a key name corresponding to your platform.

For example:

client.Platform.PublishStory("mediaURL", { 
    vk: {
        // Options from VK Bridge Documentation
    }, telegram: {
        // Options from Telegram SDK for Mini Apps Documentation
    }
}, (data)=> {
    console.log(data);
}, (error)=> {
    console.error(error.message);
})

So, now having learned the common API for all platforms, you can learn the specific method overrides for each platform


Platform-Specific References

Now that you have learned the basics, you can see the specific API description for each currently available Parallelix platform:

PreviousRoadmapNextVK Bridge (Mini Apps)

Last updated 2 months ago

Function []

Returns an instance of the currently loaded module class defined for the current platform, inherited from the virtual

For example, for the “vk” platform, an instance of the vkBridge class will be returned (see the for its API Reference).

Can be used in case of unrealized functionality in .

Function [, object]

A common constructor for all inherited modules. Can contain an object for customizing a specific module. It is loaded into the constructor under the module name.

Function [, Callback, Callback]

Function [, Callback, Callback]

Function [, Callback, Callback]

Function [string, , Callback, Callback]

Function [, Callback, Callback]

Function [, Callback, Callback]

Function [, Callback, Callback]

Function [, Callback, Callback]

Function [, Callback, Callback]

Function [string, , Callback, Callback]

Function [string, , Callback, Callback]

Initialize Current Platfrom. Called from class.

Check the current platfrom. Returns boolean. Called from class.

;

;

(Default Provider);

(Coming Soon);

(Coming Soon);

(Coming Soon);

(Coming Soon);

(Coming Soon);

Or .

VK Bridge / Mini-Apps
Telegram Mini Apps
Basic Web Applications / PWA
WeChat Mini Apps
Android, iOS powered by Cordova
Windows, Linux, Mac powered by Electron
VK Direct Games
Yandex Games
create your own platform module
VK Bridge documentation
ParallelixConfig
ParallelixWrapper
ParallelixWrapper
ParallelixWrapper
Parallelix
Parallelix
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
PlatformSpecificParameters
Parallelix
Parallelix