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

@aplazame/browser

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aplazame/browser

Aplazame SDK for browser

  • 0.1.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-90.91%
Maintainers
0
Weekly downloads
 
Created
Source

browser-sdk

npm i @aplazame/browser
import { AplazameIFrame } from '@aplazame/browser'

const apzIframe = new AplazameIFrame({
    url: 'https://aplazame.com/app',
    searchParams: {
        publicKey: 'foobar',
    },
})

apzIframe
    .mount(document.querySelector('#iframe_container'))

apzIframe
    .on('status', e => {
        console.log('status received from iframe:')
        console.log('details', e.details)
    })

function onSubmit () {
    apzIframe.request('submit')
}

AplazameIFrame object

constructor

const apzIframe = new AplazameIFrame({
    url,
    searchParams,
})

methods

apzIframe.send(event: string, payload: unknown)
// received by the iframe as MessageEvent<{ data: { event, payload } }>

apzIframe.request(request: string, payload: unknown)
// received by the iframe as MessageEvent<{ data: { request, payload } }>

apzIframe.mount(el: HTMLElement)
// iframe is created and attached to el when calling this method

apzIframe.setStyles(styles: string | { [key: string]: string })
// applies styles to iframe DOM Element
// when styles is a string, it refers to a preset
// otherwise applies styles key by key

apzIframe.addStylesPreset(name: string, styles: { [key: string]: string })
// Adds a new preset to presets

apzIframe.resetStyles()
// clears all styles applied to the iframe

apzIframe.unmount()
// removes iframe from DOM tree and emits 'unmount' event

default styles presets

const defaulsIframeStylesPresets: {
  fill_fixed: {
    position: 'fixed',
    top: '0',
    left: '0',
    width: '100%',
    height: '100%',
    border: 'none',
  },
  fill_absolute: {
    position: 'absolute',
    top: '0',
    left: '0',
    width: '100%',
    height: '100%',
    border: 'none',
  },
}

Keywords

FAQs

Package last updated on 02 Aug 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