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 FrameMethods
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>| Parameter | Type | Description |
|---|---|---|
params | FrameParams | Initialization parameters |
initializeFrame() events:
| Event | Parameter | Type | Description |
|---|---|---|---|
'onReady' | Fired after iframe content is loaded (DOMContentLoaded), Frame is initialized and context is received, embedded content is displayed | ||
context | FrameContext | Application 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}`)
}
}
})