Skip to content

App

The main entrypoint of the library. Provides the method to initialize a client application inside the Аспро.Cloud platform iframe initializeFrame().

ts
import App from '@aspro-cloud/miniapp-jssdk'

Properties

Frame

Reference to the Frame class

ts
static Frame: typeof Frame

Methods

initializeFrame

Initializes a mini‑application inside the Аспро.Cloud platform iframe and returns a singleton instance of Frame. Acts as a wrapper for Frame.initialize()

ts
static async initializeFrame(params?: FrameParams): Promise<Frame>
ParameterTypeDescription
paramsFrameParamsInitialization parameters

initializeFrame() events:

EventParameterTypeDescription
'onReady'Fired after iframe content is loaded (DOMContentLoaded), Frame is initialized and context is received, embedded content is displayed
contextFrameContextApplication context

Errors

The method will throw an error if:

  • the application is not running in a browser
  • the application is not inside an iframe
  • the platform account domain could not be determined

Example

ts
import App from '@aspro-cloud/miniapp-jssdk'

const frame = await App.initializeFrame({
  events: {
    onReady: (context) => {
      console.log(`Application is ready, received context: ${context}`)
    }
  }
})
js
const App = window.ACloudMiniApp

const frame = await App.initializeFrame({
  events: {
    onReady: (context) => {
      console.log(`Application is ready, received context: ${context}`)
    }
  }
})

Published under the MIT license.