成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

由零開始學(xué)習(xí)小程序架構(gòu)

Shonim / 2874人閱讀

摘要:背景,大公司占據(jù)入口流量,小程序百花齊放的,你如何由零開始學(xué)習(xí)小程序架構(gòu)。大綱查看億級(jí)小程序?qū)W習(xí)源碼學(xué)習(xí)小程序常用構(gòu)建常用的小程序基礎(chǔ)庫構(gòu)建自己的小程序框架查看億級(jí)小程序?qū)W習(xí)源碼安裝模擬器,或者已經(jīng)的舊手機(jī)。

背景,大公司占據(jù)入口流量,小程序百花齊放的2019,你如何由零開始學(xué)習(xí)小程序架構(gòu)。

大綱:

1、查看億級(jí)小程序?qū)W習(xí)源碼
2、學(xué)習(xí)小程序常用API
3、構(gòu)建常用的小程序基礎(chǔ)庫
4、構(gòu)建自己的小程序框架

1、查看億級(jí)小程序?qū)W習(xí)源碼:

安裝mumu模擬器,或者已經(jīng)root的舊手機(jī)。http://mumu.163.com/
安裝ES文件瀏覽器,微信。

安裝 adb 工具
參考:
https://www.xda-developers.co...

https://developer.android.com...

在命令行運(yùn)行,獲得文件

adb devices

adb pull /data/data/com.tencent.mm/MicroMsg/xxxxxxxxxxxxxxxx/appbrand/pkg ./pkg

當(dāng)然需要進(jìn)入系統(tǒng)查找,那么adb如何連接mumu模擬器

【win版】

adb connect 127.0.0.1:7555
adb shell

【mac版】

adb kill-server && adb server && adb shell

進(jìn)入后,cd, ls, 進(jìn)入到 /data/data/com.tencent.mm/MicroMsg/

參考:

http://mumu.163.com/2017/12/1...

adb幫助說明:
adb --help

Android Debug Bridge version 1.0.40
Version 4986621
Installed as /usr/local/bin/adb

global options:

-a listen on all network interfaces, not just localhost
-d use USB device (error if multiple devices connected)
-e use TCP/IP device (error if multiple TCP/IP devices available)
-s SERIAL use device with given serial (overrides $ANDROID_SERIAL)
-t ID use device with given transport id
-H name of adb server host [default=localhost]
-P port of adb server [default=5037]
-L SOCKET listen on given socket for adb server [default=tcp:localhost:5037]

general commands:

devices [-l] list connected devices (-l for long output)
help show this help message
version show version num

networking:

connect HOST[:PORT] connect to a device via TCP/IP [default port=5555]
disconnect [HOST[:PORT]]

 disconnect from given TCP/IP device [default port=5555], or all

forward --list list all forward socket connections
forward [--no-rebind] LOCAL REMOTE

 forward socket connection using:
   tcp: ( may be "tcp:0" to pick any open port)
   localabstract:
   localreserved:
   localfilesystem:
   dev:
   jdwp: (remote only)

forward --remove LOCAL remove specific forward socket connection
forward --remove-all remove all forward socket connections
ppp TTY [PARAMETER...] run PPP over USB
reverse --list list all reverse socket connections from device
reverse [--no-rebind] REMOTE LOCAL

 reverse socket connection using:
   tcp: ( may be "tcp:0" to pick any open port)
   localabstract:
   localreserved:
   localfilesystem:

reverse --remove REMOTE remove specific reverse socket connection
reverse --remove-all remove all reverse socket connections from device

file transfer:

push [--sync] LOCAL... REMOTE

 copy local files/directories to device
 --sync: only push files that are newer on the host than the device

pull [-a] REMOTE... LOCAL

 copy files/dirs from device
 -a: preserve file timestamp and mode

sync [all|data|odm|oem|product|system|vendor]

 sync a local build from $ANDROID_PRODUCT_OUT to the device (default all)
 -l: list but don"t copy
shell:

shell [-e ESCAPE] [-n] [-Tt] [-x] [COMMAND...]

 run remote shell command (interactive shell if no command given)
 -e: choose escape character, or "none"; default "~"
 -n: don"t read from stdin
 -T: disable PTY allocation
 -t: force PTY allocation
 -x: disable remote exit codes and stdout/stderr separation

emu COMMAND run emulator console command

app installation:

install [-lrtsdg] [--instant] PACKAGE
install-multiple [-lrtsdpg] [--instant] PACKAGE...

 push package(s) to the device and install them
 -l: forward lock application
 -r: replace existing application
 -t: allow test packages
 -s: install application on sdcard
 -d: allow version code downgrade (debuggable packages only)
 -p: partial application install (install-multiple only)
 -g: grant all runtime permissions
 --instant: cause the app to be installed as an ephemeral install app

uninstall [-k] PACKAGE

 remove this app package from the device
 "-k": keep the data and cache directories
backup/restore:

to show usage run "adb shell bu help"

debugging:

bugreport [PATH]

 write bugreport to given PATH [default=bugreport.zip];
 if PATH is a directory, the bug report is saved in that directory.
 devices that don"t support zipped bug reports output to stdout.

jdwp list pids of processes hosting a JDWP transport
logcat show device log (logcat --help for more)

security:

disable-verity disable dm-verity checking on userdebug builds
enable-verity re-enable dm-verity checking on userdebug builds
keygen FILE

 generate adb public/private key; private key stored in FILE,
 public key stored in FILE.pub (existing files overwritten)
scripting:

wait-for[-TRANSPORT]-STATE

 wait for device to be in the given state
 State: device, recovery, sideload, or bootloader
 Transport: usb, local, or any [default=any]

get-state print offline | bootloader | device
get-serialno print
get-devpath print
remount remount partitions read-write
reboot [bootloader|recovery|sideload|sideload-auto-reboot]

 reboot the device; defaults to booting system image but
 supports bootloader and recovery too. sideload reboots
 into recovery and automatically starts sideload mode,
 sideload-auto-reboot is the same but reboots after sideloading.

sideload OTAPACKAGE sideload the given full OTA package
root restart adbd with root permissions
unroot restart adbd without root permissions
usb restart adb server listening on USB
tcpip PORT restart adb server listening on TCP on PORT

internal debugging:

start-server ensure that there is a server running
kill-server kill the server if it is running
reconnect kick connection from host side to force reconnect
reconnect device kick connection from device side to force reconnect
reconnect offline reset offline/unauthorized devices to force reconnect

environment variables:

$ADB_TRACE

 comma-separated list of debug info to log:
 all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp

$ADB_VENDOR_KEYS colon-separated list of keys (files or directories)
$ANDROID_SERIAL serial number to connect to (see -s)
$ANDROID_LOG_TAGS tags to be used by logcat (see logcat --help)

接下來使用wxappUnpacker 反編譯

2、學(xué)習(xí)小程序常用API

像瀏覽器一樣,小程序少不了學(xué)習(xí)文檔:

教程 | 《小程序開發(fā)指南》

全局變量 App , Page, Component,
getApp, global, getCurrentPages, wx

其中 wx 308 個(gè), 提供各種橋接服務(wù)。

wx.drawCanvas
wx.createContext
wx.createCanvasContext
wx.canvasToTempFilePath
wx.canvasGetImageData
wx.canvasPutImageData
wx.getAccountInfoSync
wx.getShareInfo
wx.pageScrollTo
wx.chooseInvoiceTitle
wx.chooseInvoice
wx.arrayBufferToBase64
wx.base64ToArrayBuffer
wx.openSetting
wx.getExtConfig
wx.chooseMedia
wx.chooseMultiMedia
wx.chooseWeChatContact
wx.uploadEncryptedFileToCDN
wx.onUploadEncryptedFileToCDNProgress
wx.getExtConfigSync
wx.showShareMenu
wx.hideShareMenu
wx.updateShareMenu
wx.shareAppMessageForFakeNative
wx.openUrl
wx.setNavigationBarColor
wx.setNavigationBarAlpha
wx.vibrateShort
wx.vibrateLong
wx.getSetting
wx.checkIsSupportFacialRecognition
wx.startFacialRecognitionVerify
wx.startFacialRecognitionVerifyAndUploadVideo
wx.startCustomFacialRecognitionVerify
wx.startCustomFacialRecognitionVerifyAndUploadVideo
wx.sendBizRedPacket
wx.sendGoldenRedPacket
wx.openGoldenRedPacketDetail
wx.addPhoneContact
wx.setScreenBrightness
wx.getScreenBrightness
wx.getWeRunData
wx.uploadWeRunData
wx.addWeRunData
wx.canIUse
wx.setPageStyle
wx.triggerGettingWidgetData
wx.navigateToMiniProgram
wx.navigateToDevMiniProgram
wx.navigateBackMiniProgram
wx.setNavigationBarRightButton
wx.onTapNavigationBarRightButton
wx.setTopBarText
wx.setTabBarBadge
wx.removeTabBarBadge
wx.showTabBarRedDot
wx.hideTabBarRedDot
wx.showTabBar
wx.hideTabBar
wx.setTabBarStyle
wx.setTabBarItem
wx.setBackgroundColor
wx.setBackgroundTextStyle
wx.setEnableDebug
wx.captureScreen
wx.onUserCaptureScreen
wx.setKeepScreenOn
wx.checkIsSupportSoterAuthentication
wx.startSoterAuthentication
wx.checkIsSoterEnrolledInDevice
wx.openDeliveryList
wx.reportIDKey
wx.reportKeyValue
wx.setNavigationBarTitle
wx.showNavigationBarLoading
wx.hideNavigationBarLoading
wx.startPullDownRefresh
wx.stopPullDownRefresh
wx.operateWXData
wx.getOpenDeviceId
wx.getMenuButtonBoundingClientRect
wx.openBluetoothAdapter
wx.closeBluetoothAdapter
wx.getBluetoothAdapterState
wx.onBluetoothAdapterStateChange
wx.startBluetoothDevicesDiscovery
wx.stopBluetoothDevicesDiscovery
wx.getBluetoothDevices
wx.getConnectedBluetoothDevices
wx.createBLEConnection
wx.closeBLEConnection
wx.getBLEDeviceServices
wx.getBLEDeviceCharacteristics
wx.notifyBLECharacteristicValueChanged
wx.notifyBLECharacteristicValueChange
wx.readBLECharacteristicValue
wx.writeBLECharacteristicValue
wx.onBluetoothDeviceFound
wx.onBLEConnectionStateChanged
wx.onBLEConnectionStateChange
wx.onBLECharacteristicValueChange
wx.startBeaconDiscovery
wx.stopBeaconDiscovery
wx.getBeacons
wx.onBeaconUpdate
wx.onBeaconServiceChange
wx.startWifi
wx.stopWifi
wx.getWifiList
wx.getConnectedWifi
wx.connectWifi
wx.presetWifiList
wx.setWifiList
wx.onGetWifiList
wx.onWifiConnected
wx.onEvaluateWifi
wx.getHCEState
wx.startHCE
wx.stopHCE
wx.sendHCEMessage
wx.onHCEMessage
wx.startLocalServiceDiscovery
wx.stopLocalServiceDiscovery
wx.onLocalServiceFound
wx.offLocalServiceFound
wx.onLocalServiceLost
wx.offLocalServiceLost
wx.onLocalServiceDiscoveryStop
wx.offLocalServiceDiscoveryStop
wx.onLocalServiceResolveFail
wx.offLocalServiceResolveFail
wx.redirectTo
wx.reLaunch
wx.navigateTo
wx.switchTab
wx.navigateBack
wx.onAppShow
wx.offAppShow
wx.onAppHide
wx.offAppHide
wx.onError
wx.offError
wx.getLaunchOptionsSync
wx.onWindowResize
wx.offWindowResize
wx.getStorage
wx.getStorageSync
wx.setStorage
wx.setStorageSync
wx.removeStorage
wx.removeStorageSync
wx.clearStorage
wx.clearStorageSync
wx.getStorageInfo
wx.getStorageInfoSync
wx.request
wx.connectSocket
wx.closeSocket
wx.sendSocketMessage
wx.onSocketOpen
wx.onSocketClose
wx.onSocketMessage
wx.onSocketError
wx.uploadFile
wx.downloadFile
wx.addNativeDownloadTask
wx.calRqt
wx.secureTunnel
wx.chooseImage
wx.previewImage
wx.getImageInfo
wx.saveImageToPhotosAlbum
wx.compressImage
wx.startRecord
wx.stopRecord
wx.playVoice
wx.pauseVoice
wx.stopVoice
wx.onVoicePlayEnd
wx.chooseVideo
wx.saveVideoToPhotosAlbum
wx.loadFontFace
wx.getLocation
wx.openLocation
wx.chooseLocation
wx.startLocationUpdate
wx.stopLocationUpdate
wx.onLocationChange
wx.getNetworkType
wx.onNetworkStatusChange
wx.getSystemInfo
wx.getSystemInfoSync
wx.getBatteryInfo
wx.getBatteryInfoSync
wx.startAccelerometer
wx.stopAccelerometer
wx.onAccelerometerChange
wx.startCompass
wx.stopCompass
wx.onCompassChange
wx.startDeviceMotionListening
wx.stopDeviceMotionListening
wx.onDeviceMotionChange
wx.startGyroscope
wx.stopGyroscope
wx.onGyroscopeChange
wx.reportAction
wx.getBackgroundAudioManager
wx.getRecorderManager
wx.getBackgroundAudioPlayerState
wx.playBackgroundAudio
wx.pauseBackgroundAudio
wx.seekBackgroundAudio
wx.stopBackgroundAudio
wx.onBackgroundAudioPlay
wx.onBackgroundAudioPause
wx.onBackgroundAudioStop
wx.joinVoIPChat
wx.exitVoIPChat
wx.updateVoIPChatMuteConfig
wx.onVoIPChatMembersChanged
wx.onVoIPChatSpeakersChanged
wx.onVoIPChatInterrupted
wx.login
wx.checkSession
wx.authorize
wx.getUserInfo
wx.requestPayment
wx.verifyPaymentPassword
wx.bindPaymentCard
wx.requestPaymentToBank
wx.requestVirtualPayment
wx.openOfflinePayView
wx.openWCPayCardList
wx.requestMallPayment
wx.faceVerifyForPay
wx.addCard
wx.openCard
wx.scanCode
wx.openQRCode
wx.chooseAddress
wx.saveFile
wx.openDocument
wx.getSavedFileList
wx.getSavedFileInfo
wx.getFileInfo
wx.removeSavedFile
wx.getFileSystemManager
wx.chooseContact
wx.removeUserCloudStorage
wx.setUserCloudStorage
wx.makePhoneCall
wx.makeVoIPCall
wx.onAppRoute
wx.onAppRouteDone
wx.onAppEnterBackground
wx.onAppEnterForeground
wx.onAppUnhang
wx.onPageReload
wx.onPageNotFound
wx.offPageNotFound
wx.createAnimation
wx.createInnerAudioContext
wx.getAvailableAudioSources
wx.setInnerAudioOption
wx.createAudioContext
wx.createVideoContext
wx.createMapContext
wx.createCameraContext
wx.createLivePlayerContext
wx.createLivePusherContext
wx.onWebviewEvent
wx.onNativeEvent
wx.hideKeyboard
wx.getPublicLibVersion
wx.showModal
wx.showToast
wx.hideToast
wx.showLoading
wx.hideLoading
wx.showActionSheet
wx.reportAnalytics
wx.reportMonitor
wx.getClipboardData
wx.setClipboardData
wx.createSelectorQuery
wx.createIntersectionObserver
wx.nextTick
wx.updatePerfData
wx.traceEvent
wx.onMemoryWarning
wx.getUpdateManager
wx.createWorker
wx.voiceSplitJoint
wx.uploadSilkVoice
wx.downloadSilkVoice
wx.getResPath
wx.setResPath
wx.setCookies
wx.getCookies
wx.getLabInfo
wx.setLabInfo
wx.env
wx.getLogManager
wx.cloud
wx.version
wx.enterContact
3、構(gòu)建常用的小程序基礎(chǔ)庫

常用庫,一般地為各種函數(shù),如時(shí)間封裝,wxs,等
與js 基礎(chǔ)庫差不多。

假如需要進(jìn)行封裝并 npm 分享 可以使用以下webpack配置打包,

要注意的是 libraryTarget: "commonjs2"

const path = require("path");
module.exports = {
  mode: "production",
  entry: "./src/index.js",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "whybug.min.js",
    libraryTarget: "commonjs2"
  },
  module: {
    rules: [
      {
        test: /.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env"]
          }
        }
      }
    ]
  }
};
4、構(gòu)建自己的小程序框架

造輪子,當(dāng)然也是先參考別人怎么造,難道自己去撿

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/11996.html

相關(guān)文章

  • Json-path學(xué)習(xí)筆記<一>

    摘要:簡(jiǎn)介是用于結(jié)構(gòu)化數(shù)據(jù)序列化的一種文本格式,包含種基礎(chǔ)類型字符串,數(shù)字,布爾和和兩種結(jié)構(gòu)類型對(duì)象和數(shù)組。對(duì)象是一個(gè)由零或者多個(gè)名值對(duì)組成的無序集合,其中名值對(duì)中名是字符串類型,值則可以是字符串,數(shù)字,布爾,,對(duì)象或數(shù)組類型。 Json JavaScript Object Notation (JSON)是一個(gè)輕量級(jí)的,基于文本的,跨語言的數(shù)據(jù)交換格式。它從ECMAScript編程語言標(biāo)準(zhǔn)(...

    Vicky 評(píng)論0 收藏0
  • Java 面向?qū)ο? 類 對(duì)象 方法 變量 封裝

    摘要:因?yàn)橥ǔ0巡皇褂眯揎椀某蓡T變量和方法也稱為實(shí)例變量實(shí)例方法。形參個(gè)數(shù)可變的方法允許定義形參個(gè)數(shù)可變的參數(shù),從而允許為方法指定數(shù)量不確定的形參。方法返回值類型修飾符等,與方法重載沒有任何關(guān)系。 類和對(duì)象 定義類 面向?qū)ο蟮某绦蛟O(shè)計(jì)過程中有兩個(gè)重要概念:類(class)和對(duì)象(object,也被稱為實(shí)例,instance),其中類是某一批對(duì)象的抽象,可以把類理解成某種概念;對(duì)象才是一個(gè)具體...

    huangjinnan 評(píng)論0 收藏0
  • http

    摘要:響應(yīng)行由協(xié)議,狀態(tài)碼,狀態(tài)碼的文本描述組成,他們之間使用空格隔開。狀態(tài)碼的文本描述狀態(tài)碼描述說明表示客戶端請(qǐng)求成功。 簡(jiǎn)介 在1990年,HTTP就成為WWW的支撐協(xié)議。當(dāng)時(shí)由其創(chuàng)始人WWW之父蒂姆·貝納斯·李(TimBemers—Lee)提出,隨后WWW聯(lián)盟(WWW Consortium)成立,組織了IETE(Internet Engineering Task Force)小組進(jìn)一步...

    rockswang 評(píng)論0 收藏0
  • http

    摘要:響應(yīng)行由協(xié)議,狀態(tài)碼,狀態(tài)碼的文本描述組成,他們之間使用空格隔開。狀態(tài)碼的文本描述狀態(tài)碼描述說明表示客戶端請(qǐng)求成功。 簡(jiǎn)介 在1990年,HTTP就成為WWW的支撐協(xié)議。當(dāng)時(shí)由其創(chuàng)始人WWW之父蒂姆·貝納斯·李(TimBemers—Lee)提出,隨后WWW聯(lián)盟(WWW Consortium)成立,組織了IETE(Internet Engineering Task Force)小組進(jìn)一步...

    lijinke666 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<