0.0.33 • Published 3 months ago

@wepin/modal-js v0.0.33

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

@wepin/modal-js

npm version npm downloads

The Wepin Modal Library is designed for web environments. This package is not available for other platforms.

⏩ Installation

To install the Wepin Modal Library, you can use npm or yarn:

npm install @wepin/modal-js

or

yarn add @wepin/modal-js

⏩ Import Wepin Modal Library

import { WepinModal } from '@wepin/modal-js'

const wepinModal = new WepinModal()

With the Wepin Modal Library imported, you can now use the WepinModal instance to call various methods.

⏩ Methods

openModal

await wepinModal.openModal(url, EL, options?)

This method opens a Wepin modal iframe with the provided URL. The EL parameter is a function that handles postMessage events. The options parameter is an optional object that can be used to customize the modal's behavior.

Parameters

  • url \ - The URL to be loaded in the Wepin modal iframe.
  • EL \ - The function to handle postMessage events from the iframe.
  • options \ optional - settings for the modal. Currently supports:
    • isHide \ - If true, the modal will be hidden initially

Returns

  • WidgetFrame - The frame of the opened modal.

Example

await wepinModal.openModal('wepin url', (event)=>{})

closeModal

await wepinModal.closeModal()

If the iframe Wepin modal is open, this method will close it.

Parameters

  • void

Example

await wepinModal.closeModal()

openAuthBrowser

await wepinModal.openAuthBrowser(url, EL)

This method opens a new window for the Wepin browser to handle OAuth provider login.

Parameters

  • url \ - The URL to open in the Wepin browser.
  • EL \ - The postMessage event handler.

Returns

  • WidgetWindow - The browser of the opened window.

Example

await wepinModal.openAuthBrowser('wepin url', (event)=>{})

closeAuthBrowser

await wepinModal.closeAuthBrowser()

This method closes the Wepin browser window that was previously opened for OAuth provider login.

Parameters

  • void

Example

await wepinModal.closeAuthBrowser()
0.0.33

3 months ago

0.0.31

4 months ago

0.0.32

4 months ago

0.0.30

6 months ago

0.0.29

6 months ago

0.0.25

6 months ago

0.0.26

6 months ago

0.0.27

6 months ago

0.0.28

6 months ago

0.0.23

7 months ago

0.0.24

7 months ago

0.0.22

8 months ago

0.0.21

8 months ago

0.0.20

8 months ago

0.0.18

8 months ago

0.0.19

8 months ago

0.0.17

8 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

12 months ago

0.0.1

1 year ago