Micro-channel base applet API

  In fact, there are some components, not to mention, because those components with similar functionality of the API, API might be a little better than him; 

  Specific seen official documentation 

  basis:

    Determining whether the interface is available: wx.canIUse (a)  

      On behalf of a: Interface name Returns: Boolean true representative of success, on behalf of false interface is not available

    System Information: wx.getSystemInfo ({}) using the second

      Parameters: {} success: equal success

             fail: for failure

             complete: After the completion of the interface calls the callback function

      Case:

        wx.getSystemInfo({

          success(res) {

            console.log (res) // res is to get the object parameter information

          }

        })

    System Update API: wx.getUpdateManager () // return value he has a lot of ways

      Case:

        const sd = wx.getUpdateManager () // more detailed information about the system has a method on sd const the initial value can not be modified

        sd.applyUpdate () to force a small program and use the new version, after the download is complete applet calling (callback must use this method to be effective in onUpdateReady); direct call to

        sd.onCheckForUpdate () listens for requests to check for updates to the results of the event micro letter backstage, micro-channel cold start small program checks for updates automatically, without the initiative triggered by the developer; Parameters: callback

        sd.onUpdateReady () listener applet has an updated version of the event, download the client active trigger (no need to take the initiative to trigger developer), download success callback; Parameters: callback

        sd.onUpdateFailed () listener small program update failed events, client actively trigger download (no need to take the initiative to trigger developer), after the download failed callback (probably due to network reasons); Parameters: callback

     usage:

        const sd=wx.getUpdateManager()

        sd.onCheckForUpdate(function(e){

          console.log(e)

        }) 

    Lifecycle API: wx.getLaunchOptionsSync ()

Guess you like

Origin www.cnblogs.com/shangjun6/p/10942303.html