New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

binance-fiat-widget

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binance-fiat-widget

``` npm install binance-fiat-widget ```

  • 0.0.25
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

install

    npm install binance-fiat-widget

used

    <div id="widget"></div>
    import {Widget} from 'binance-fiat-widget'

    const options = {
        locale: 'en',
        width: 200,
        theme: 'dark',
        urlParmas: {
            ref: '',
            utm_source: ''
        }
    }

    Widget('#widget', options)

Parameters

  • el: selector or DOM element

    • react
        import {Widget, unloadWidget} from 'binance-fiat-widget'
        const app = () => {
            const t = useRef<HTMLDivElement>(null)
            // or
            // const t = document.querySelector('#test')
    
            useEffect(() => {
                if (t) {
                    Widget(t)
                }
                return () => unloadWidget()
            }, [])
            return (<div id="#test" ref={r}></div>)
        }
        
    
    • cdn
        <script src="https://bin.bnbstatic.com/static/js/ocbs/binance-fiat-widget.js"></script>
        <div id="widget"></div>
    
        const t = document.querySelector('#test')
        window.binanceFiatWidget.Widget(t)
    
  • options.locale: string

    i18n, nullable, default: 'en'

    opts: 'en'|'cn'|'tw'|'kr'|'ru'|'vn'|'it'|'es'|'de'|'fr', unsupported locale will fallback to english

  • options.width: number

    width, nullable,

    if width is not set, default is el.offsetWidth

    range: 200 - 500

  • options.theme: string

    theme, nullable, default: 'light'

    opts: 'light' | 'dark'

  • options.urlParmas

    • options.urlParmas.ref: string

      ref id, nullable

    • options.urlParmas.utm_source: string

      UTM source, nullable

  • options.api_host: string

    overlay getCoinListApi, nullable

API

  • render

    render the widget(after .setXXX() is necessary)

        const w = widget(container, opt)
        w.setTheme('dark').render()
    
    
  • setTheme

    change the theme

        const w = widget(container, opt)
        w.setTheme('dark').render()
    
  • setLocale

    change the locale

        const w = widget(container, opt)
        w.setLocale('cn').render()
    
  • unloadWidget

    remove the widget from page, maybe you will use it in React hooks to replace setXXX

        useEffect(() => {
            if (t?.current) {
                w = Widget(t.current, {
                    theme: theme
                })
            }
            return () => unloadWidget()
    }, [theme])
    

FAQs

Package last updated on 31 Jan 2020

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