lib.wx.api.d.ts 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824
  1. /*! *****************************************************************************
  2. Copyright (c) 2023 Tencent, Inc. All rights reserved.
  3. Permission is hereby granted, free of charge, to any person obtaining a copy of
  4. this software and associated documentation files (the "Software"), to deal in
  5. the Software without restriction, including without limitation the rights to
  6. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  7. of the Software, and to permit persons to whom the Software is furnished to do
  8. so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in all
  10. copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  17. SOFTWARE.
  18. ***************************************************************************** */
  19. declare namespace WechatMiniprogram {
  20. interface AccessFailCallbackResult {
  21. /** 错误信息
  22. *
  23. * 可选值:
  24. * - 'fail no such file or directory ${path}': 文件/目录不存在;
  25. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  26. errMsg: string
  27. }
  28. interface AccessOption {
  29. /** 要判断是否存在的文件/目录路径 (本地路径) */
  30. path: string
  31. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32. complete?: AccessCompleteCallback
  33. /** 接口调用失败的回调函数 */
  34. fail?: AccessFailCallback
  35. /** 接口调用成功的回调函数 */
  36. success?: AccessSuccessCallback
  37. }
  38. /** 帐号信息 */
  39. interface AccountInfo {
  40. /** 小程序帐号信息 */
  41. miniProgram: MiniProgram
  42. /** 插件帐号信息(仅在插件中调用时包含这一项) */
  43. plugin: Plugin
  44. }
  45. interface AddArcOption {
  46. /** 终点 */
  47. end: MapPostion
  48. /** 圆弧 id */
  49. id: number
  50. /** 起始点 */
  51. start: MapPostion
  52. /** 夹角角度 */
  53. angle?: number
  54. /** 线的颜色 */
  55. color?: number
  56. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  57. complete?: AddArcCompleteCallback
  58. /** 接口调用失败的回调函数 */
  59. fail?: AddArcFailCallback
  60. /** 途经点 */
  61. pass?: MapPostion
  62. /** 接口调用成功的回调函数 */
  63. success?: AddArcSuccessCallback
  64. /** 线宽 */
  65. width?: number
  66. }
  67. interface AddCardOption {
  68. /** 需要添加的卡券列表 */
  69. cardList: AddCardRequestInfo[]
  70. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  71. complete?: AddCardCompleteCallback
  72. /** 接口调用失败的回调函数 */
  73. fail?: AddCardFailCallback
  74. /** 接口调用成功的回调函数 */
  75. success?: AddCardSuccessCallback
  76. }
  77. /** 需要添加的卡券列表 */
  78. interface AddCardRequestInfo {
  79. /** 卡券的扩展参数。需将 CardExt 对象 JSON 序列化为**字符串**传入 */
  80. cardExt: string
  81. /** 卡券 ID */
  82. cardId: string
  83. }
  84. /** 卡券添加结果列表 */
  85. interface AddCardResponseInfo {
  86. /** 卡券的扩展参数,结构请参考下文 */
  87. cardExt: string
  88. /** 用户领取到卡券的 ID */
  89. cardId: string
  90. /** 加密 code,为用户领取到卡券的code加密后的字符串,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */
  91. code: string
  92. /** 是否成功 */
  93. isSuccess: boolean
  94. }
  95. interface AddCardSuccessCallbackResult {
  96. /** 卡券添加结果列表 */
  97. cardList: AddCardResponseInfo[]
  98. errMsg: string
  99. }
  100. interface AddCustomLayerOption {
  101. /** 个性化图层id */
  102. layerId: string
  103. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  104. complete?: AddCustomLayerCompleteCallback
  105. /** 接口调用失败的回调函数 */
  106. fail?: AddCustomLayerFailCallback
  107. /** 接口调用成功的回调函数 */
  108. success?: AddCustomLayerSuccessCallback
  109. }
  110. interface AddFileToFavoritesOption {
  111. /** 要收藏的文件地址,必须为本地路径或临时路径 */
  112. filePath: string
  113. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  114. complete?: AddFileToFavoritesCompleteCallback
  115. /** 接口调用失败的回调函数 */
  116. fail?: AddFileToFavoritesFailCallback
  117. /** 自定义文件名,若留空则使用filePath中的文件名 */
  118. fileName?: string
  119. /** 接口调用成功的回调函数 */
  120. success?: AddFileToFavoritesSuccessCallback
  121. }
  122. interface AddGroundOverlayOption {
  123. /** 图片覆盖的经纬度范围 */
  124. bounds: MapBounds
  125. /** 图片图层 id */
  126. id: string
  127. /** 图片路径,支持网络图片、临时路径、代码包路径 */
  128. src: string
  129. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  130. complete?: AddGroundOverlayCompleteCallback
  131. /** 接口调用失败的回调函数 */
  132. fail?: AddGroundOverlayFailCallback
  133. /** 图层透明度 */
  134. opacity?: number
  135. /** 接口调用成功的回调函数 */
  136. success?: AddGroundOverlaySuccessCallback
  137. /** 是否可见 */
  138. visible?: boolean
  139. /** 图层绘制顺序 */
  140. zIndex?: number
  141. }
  142. interface AddMarkersOption {
  143. /** 同传入 map 组件的 marker 属性 */
  144. markers: any[]
  145. /** 是否先清空地图上所有 marker */
  146. clear?: boolean
  147. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  148. complete?: AddMarkersCompleteCallback
  149. /** 接口调用失败的回调函数 */
  150. fail?: AddMarkersFailCallback
  151. /** 接口调用成功的回调函数 */
  152. success?: AddMarkersSuccessCallback
  153. }
  154. interface AddPhoneCalendarOption {
  155. /** 开始时间的 unix 时间戳 */
  156. startTime: number
  157. /** 日历事件标题 */
  158. title: string
  159. /** 是否提醒,默认 true */
  160. alarm?: boolean
  161. /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */
  162. alarmOffset?: number
  163. /** 是否全天事件,默认 false */
  164. allDay?: boolean
  165. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  166. complete?: AddPhoneCalendarCompleteCallback
  167. /** 事件说明 */
  168. description?: string
  169. /** 结束时间的 unix 时间戳,默认与开始时间相同 */
  170. endTime?: string
  171. /** 接口调用失败的回调函数 */
  172. fail?: AddPhoneCalendarFailCallback
  173. /** 事件位置 */
  174. location?: string
  175. /** 接口调用成功的回调函数 */
  176. success?: AddPhoneCalendarSuccessCallback
  177. }
  178. interface AddPhoneContactOption {
  179. /** 名字 */
  180. firstName: string
  181. /** 联系地址城市 */
  182. addressCity?: string
  183. /** 联系地址国家 */
  184. addressCountry?: string
  185. /** 联系地址邮政编码 */
  186. addressPostalCode?: string
  187. /** 联系地址省份 */
  188. addressState?: string
  189. /** 联系地址街道 */
  190. addressStreet?: string
  191. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  192. complete?: AddPhoneContactCompleteCallback
  193. /** 电子邮件 */
  194. email?: string
  195. /** 接口调用失败的回调函数 */
  196. fail?: AddPhoneContactFailCallback
  197. /** 住宅地址城市 */
  198. homeAddressCity?: string
  199. /** 住宅地址国家 */
  200. homeAddressCountry?: string
  201. /** 住宅地址邮政编码 */
  202. homeAddressPostalCode?: string
  203. /** 住宅地址省份 */
  204. homeAddressState?: string
  205. /** 住宅地址街道 */
  206. homeAddressStreet?: string
  207. /** 住宅传真 */
  208. homeFaxNumber?: string
  209. /** 住宅电话 */
  210. homePhoneNumber?: string
  211. /** 公司电话 */
  212. hostNumber?: string
  213. /** 姓氏 */
  214. lastName?: string
  215. /** 中间名 */
  216. middleName?: string
  217. /** 手机号 */
  218. mobilePhoneNumber?: string
  219. /** 昵称 */
  220. nickName?: string
  221. /** 公司 */
  222. organization?: string
  223. /** 头像本地文件路径 */
  224. photoFilePath?: string
  225. /** 备注 */
  226. remark?: string
  227. /** 接口调用成功的回调函数 */
  228. success?: AddPhoneContactSuccessCallback
  229. /** 职位 */
  230. title?: string
  231. /** 网站 */
  232. url?: string
  233. /** 微信号 */
  234. weChatNumber?: string
  235. /** 工作地址城市 */
  236. workAddressCity?: string
  237. /** 工作地址国家 */
  238. workAddressCountry?: string
  239. /** 工作地址邮政编码 */
  240. workAddressPostalCode?: string
  241. /** 工作地址省份 */
  242. workAddressState?: string
  243. /** 工作地址街道 */
  244. workAddressStreet?: string
  245. /** 工作传真 */
  246. workFaxNumber?: string
  247. /** 工作电话 */
  248. workPhoneNumber?: string
  249. }
  250. interface AddPhoneRepeatCalendarOption {
  251. /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */
  252. startTime: number
  253. /** 日历事件标题 */
  254. title: string
  255. /** 是否提醒,默认 true */
  256. alarm?: boolean
  257. /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */
  258. alarmOffset?: number
  259. /** 是否全天事件,默认 false */
  260. allDay?: boolean
  261. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  262. complete?: AddPhoneRepeatCalendarCompleteCallback
  263. /** 事件说明 */
  264. description?: string
  265. /** 结束时间的 unix 时间戳,默认与开始时间相同 */
  266. endTime?: string
  267. /** 接口调用失败的回调函数 */
  268. fail?: AddPhoneRepeatCalendarFailCallback
  269. /** 事件位置 */
  270. location?: string
  271. /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
  272. repeatEndTime?: number
  273. /** 重复周期,默认 month 每月重复
  274. *
  275. * 可选值:
  276. * - 'day': 每天重复;
  277. * - 'week': 每周重复;
  278. * - 'month': 每月重复。该模式日期不能大于 28 日;
  279. * - 'year': 每年重复; */
  280. repeatInterval?: 'day' | 'week' | 'month' | 'year'
  281. /** 接口调用成功的回调函数 */
  282. success?: AddPhoneRepeatCalendarSuccessCallback
  283. }
  284. interface AddServiceOption {
  285. /** 描述service的Object */
  286. service: BLEPeripheralService
  287. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  288. complete?: AddServiceCompleteCallback
  289. /** 接口调用失败的回调函数 */
  290. fail?: AddServiceFailCallback
  291. /** 接口调用成功的回调函数 */
  292. success?: AddServiceSuccessCallback
  293. }
  294. interface AddVideoToFavoritesOption {
  295. /** 要收藏的视频地址,必须为本地路径或临时路径 */
  296. videoPath: string
  297. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  298. complete?: AddVideoToFavoritesCompleteCallback
  299. /** 接口调用失败的回调函数 */
  300. fail?: AddVideoToFavoritesFailCallback
  301. /** 接口调用成功的回调函数 */
  302. success?: AddVideoToFavoritesSuccessCallback
  303. /** 缩略图路径,若留空则使用视频首帧 */
  304. thumbPath?: string
  305. }
  306. interface AddVisualLayerOption {
  307. /** 可视化图层id([创建图层指引](https://lbs.qq.com/dev/console/layers/layerEdit)) */
  308. layerId: string
  309. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  310. complete?: AddVisualLayerCompleteCallback
  311. /** 接口调用失败的回调函数 */
  312. fail?: AddVisualLayerFailCallback
  313. /** 刷新周期,单位秒 */
  314. interval?: number
  315. /** 图层透明度 */
  316. opacity?: number
  317. /** 接口调用成功的回调函数 */
  318. success?: AddVisualLayerSuccessCallback
  319. /** 图层绘制顺序 */
  320. zIndex?: number
  321. }
  322. /** 广播自定义参数 */
  323. interface AdvertiseReqObj {
  324. /** 需要基础库: `2.20.1`
  325. *
  326. * 以 beacon 设备形式广播的参数。 */
  327. beacon?: BeaconInfoObj
  328. /** 当前设备是否可连接 */
  329. connectable?: boolean
  330. /** 广播中 deviceName 字段,默认为空 */
  331. deviceName?: string
  332. /** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
  333. manufacturerData?: ManufacturerData[]
  334. /** 要广播的服务 UUID 列表。使用 16/32 位 UUID 时请参考注意事项。 */
  335. serviceUuids?: string[]
  336. }
  337. /** animationData */
  338. interface AnimationExportResult {
  339. actions: IAnyObject[]
  340. }
  341. /** 动画效果 */
  342. interface AnimationOption {
  343. /** 动画变化时间,单位 ms */
  344. duration?: number
  345. /** 动画变化方式
  346. *
  347. * 可选值:
  348. * - 'linear': 动画从头到尾的速度是相同的;
  349. * - 'easeIn': 动画以低速开始;
  350. * - 'easeOut': 动画以低速结束;
  351. * - 'easeInOut': 动画以低速开始和结束; */
  352. timingFunc?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut'
  353. }
  354. interface AppAuthorizeSetting {
  355. /** 允许微信使用相册的开关(仅 iOS 有效) */
  356. albumAuthorized: 'authorized' | 'denied' | 'not determined'
  357. /** 允许微信使用蓝牙的开关(仅 iOS 有效) */
  358. bluetoothAuthorized: 'authorized' | 'denied' | 'not determined'
  359. /** 允许微信使用摄像头的开关 */
  360. cameraAuthorized: 'authorized' | 'denied' | 'not determined'
  361. /** 允许微信使用定位的开关 */
  362. locationAuthorized: 'authorized' | 'denied' | 'not determined'
  363. /** 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效) */
  364. locationReducedAccuracy: boolean
  365. /** 允许微信使用麦克风的开关 */
  366. microphoneAuthorized: 'authorized' | 'denied' | 'not determined'
  367. /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
  368. notificationAlertAuthorized: 'authorized' | 'denied' | 'not determined'
  369. /** 允许微信通知的开关 */
  370. notificationAuthorized: 'authorized' | 'denied' | 'not determined'
  371. /** 允许微信通知带有标记的开关(仅 iOS 有效) */
  372. notificationBadgeAuthorized: 'authorized' | 'denied' | 'not determined'
  373. /** 允许微信通知带有声音的开关(仅 iOS 有效) */
  374. notificationSoundAuthorized: 'authorized' | 'denied' | 'not determined'
  375. /** 允许微信读写日历的开关 */
  376. phoneCalendarAuthorized: 'authorized' | 'denied' | 'not determined'
  377. }
  378. interface AppBaseInfo {
  379. /** 客户端基础库版本 */
  380. SDKVersion: string
  381. /** 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 */
  382. enableDebug: boolean
  383. /** 当前小程序运行的宿主环境 */
  384. host: AppBaseInfoHost
  385. /** 微信设置的语言 */
  386. language: string
  387. /** 微信版本号 */
  388. version: string
  389. /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
  390. *
  391. * 可选值:
  392. * - 'dark': 深色主题;
  393. * - 'light': 浅色主题; */
  394. theme?: 'dark' | 'light'
  395. }
  396. /** 当前小程序运行的宿主环境 */
  397. interface AppBaseInfoHost {
  398. /** 宿主 app(第三方App) 对应的 appId (当小程序运行在第三方App环境时才返回) */
  399. appId: string
  400. }
  401. interface AppendFileFailCallbackResult {
  402. /** 错误信息
  403. *
  404. * 可选值:
  405. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 文件不存在;
  406. * - 'fail illegal operation on a directory, open "${filePath}"': 指定的 filePath 是一个已经存在的目录;
  407. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
  408. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  409. errMsg: string
  410. }
  411. interface AppendFileOption {
  412. /** 要追加的文本或二进制数据 */
  413. data: string | ArrayBuffer
  414. /** 要追加内容的文件路径 (本地路径) */
  415. filePath: string
  416. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  417. complete?: AppendFileCompleteCallback
  418. /** 指定写入文件的字符编码
  419. *
  420. * 可选值:
  421. * - 'ascii': ;
  422. * - 'base64': ;
  423. * - 'binary': ;
  424. * - 'hex': ;
  425. * - 'ucs2': 以小端序读取;
  426. * - 'ucs-2': 以小端序读取;
  427. * - 'utf16le': 以小端序读取;
  428. * - 'utf-16le': 以小端序读取;
  429. * - 'utf-8': ;
  430. * - 'utf8': ;
  431. * - 'latin1': ; */
  432. encoding?:
  433. | 'ascii'
  434. | 'base64'
  435. | 'binary'
  436. | 'hex'
  437. | 'ucs2'
  438. | 'ucs-2'
  439. | 'utf16le'
  440. | 'utf-16le'
  441. | 'utf-8'
  442. | 'utf8'
  443. | 'latin1'
  444. /** 接口调用失败的回调函数 */
  445. fail?: AppendFileFailCallback
  446. /** 接口调用成功的回调函数 */
  447. success?: AppendFileSuccessCallback
  448. }
  449. interface ApplyBlusherStickMakeupOption {
  450. /** 上色程度 0-1 */
  451. alpha: number
  452. blendMode: string
  453. /** 左腮红资源路径 */
  454. path: string
  455. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  456. complete?: ApplyBlusherStickMakeupCompleteCallback
  457. /** 接口调用失败的回调函数 */
  458. fail?: ApplyBlusherStickMakeupFailCallback
  459. /** 接口调用成功的回调函数 */
  460. success?: ApplyBlusherStickMakeupSuccessCallback
  461. }
  462. interface ApplyEyeBrowMakeupOption {
  463. /** 上色程度 0-1 */
  464. alpha: number
  465. blendMode: string
  466. path: string
  467. shrinkRate: number
  468. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  469. complete?: ApplyEyeBrowMakeupCompleteCallback
  470. /** 接口调用失败的回调函数 */
  471. fail?: ApplyEyeBrowMakeupFailCallback
  472. /** 接口调用成功的回调函数 */
  473. success?: ApplyEyeBrowMakeupSuccessCallback
  474. }
  475. interface ApplyEyeShadowMakeupOption {
  476. /** 上色程度 0-1 */
  477. alpha: number
  478. blendMode: string
  479. /** 眼影资源路径 */
  480. path: string
  481. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  482. complete?: ApplyEyeShadowMakeupCompleteCallback
  483. /** 接口调用失败的回调函数 */
  484. fail?: ApplyEyeShadowMakeupFailCallback
  485. /** 细致效果图片资源路径 */
  486. shimmerPosition?: string
  487. /** 细致效果图片资源 md5 */
  488. shimmerPositionMD5?: string
  489. /** 接口调用成功的回调函数 */
  490. success?: ApplyEyeShadowMakeupSuccessCallback
  491. }
  492. interface ApplyFaceContourMakeupOption {
  493. alpha: number
  494. /** 高光资源路径 */
  495. path: string
  496. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  497. complete?: ApplyFaceContourMakeupCompleteCallback
  498. /** 接口调用失败的回调函数 */
  499. fail?: ApplyFaceContourMakeupFailCallback
  500. /** 接口调用成功的回调函数 */
  501. success?: ApplyFaceContourMakeupSuccessCallback
  502. }
  503. interface ApplyFilterOption {
  504. /** 滤镜效果透明度,范围是 0-1 */
  505. alpha: number
  506. /** 滤镜资源路径 */
  507. path: string
  508. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  509. complete?: ApplyFilterCompleteCallback
  510. /** 接口调用失败的回调函数 */
  511. fail?: ApplyFilterFailCallback
  512. /** 滤镜资源 md5 */
  513. md5?: string
  514. /** 接口调用成功的回调函数 */
  515. success?: ApplyFilterSuccessCallback
  516. }
  517. interface ApplyLipStickMakeupOption {
  518. /** 上色程度 0-1 */
  519. alpha: number
  520. blendMode: string
  521. faceModel: string
  522. path: string
  523. shimmerPath: string
  524. shimmerType: string
  525. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  526. complete?: ApplyLipStickMakeupCompleteCallback
  527. /** 接口调用失败的回调函数 */
  528. fail?: ApplyLipStickMakeupFailCallback
  529. /** 接口调用成功的回调函数 */
  530. success?: ApplyLipStickMakeupSuccessCallback
  531. }
  532. interface ApplyStickerOption {
  533. /** 贴纸类型 */
  534. stickers: Sticker[]
  535. /** 贴纸类型 */
  536. type: string
  537. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  538. complete?: ApplyStickerCompleteCallback
  539. /** 接口调用失败的回调函数 */
  540. fail?: ApplyStickerFailCallback
  541. /** 接口调用成功的回调函数 */
  542. success?: ApplyStickerSuccessCallback
  543. templateTransSet?: IAnyObject
  544. }
  545. interface Asset {
  546. src: string
  547. /** 可选值:
  548. * - 'font': 字体;
  549. * - 'image': 图片; */
  550. type: 'font' | 'image'
  551. }
  552. /** 需要基础库: `2.19.0`
  553. *
  554. * AudioBuffer接口表示存在内存里的一段短小的音频资源,利用[WebAudioContext.decodeAudioData](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html)方法从一个音频文件构建,或者利用 [AudioContext.createBuffer](#)从原始数据构建。把音频放入AudioBuffer后,可以传入到一个 AudioBufferSourceNode进行播放。 */
  555. interface AudioBuffer {
  556. /** 返回存储在缓存区的PCM数据的时长(单位为秒) */
  557. duration: number
  558. /** 返回存储在缓存区的PCM数据的采样帧率 */
  559. length: number
  560. /** 储存在缓存区的PCM数据的通道数 */
  561. numberOfChannels: number
  562. /** 存储在缓存区的PCM数据的采样率(单位为sample/s) */
  563. sampleRate: number
  564. }
  565. interface AuthPrivateMessageOption {
  566. /** shareTicket。可以从 wx.onShow 中获取。详情 [shareTicket](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  567. shareTicket: string
  568. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  569. complete?: AuthPrivateMessageCompleteCallback
  570. /** 接口调用失败的回调函数 */
  571. fail?: AuthPrivateMessageFailCallback
  572. /** 接口调用成功的回调函数 */
  573. success?: AuthPrivateMessageSuccessCallback
  574. }
  575. interface AuthPrivateMessageSuccessCallbackResult {
  576. /** 经过加密的activityId,解密后可得到原始的activityId。若解密后得到的activityId可以与开发者后台的活动id对应上则验证通过,否则表明valid字段不可靠(被篡改) 详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  577. encryptedData: string
  578. /** 错误信息 */
  579. errMsg: string
  580. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  581. iv: string
  582. /** 验证是否通过 */
  583. valid: boolean
  584. }
  585. /** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) */
  586. interface AuthSetting {
  587. /** 是否授权系统日历,对应接口 [wx.addPhoneRepeatCalendar](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html)、[wx.addPhoneCalendar](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html) */
  588. 'scope.addPhoneCalendar'?: boolean
  589. /** 是否添加通讯录联系人,对应接口 [wx.addPhoneContact](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html) */
  590. 'scope.addPhoneContact'?: boolean
  591. /** 是否授权通讯地址,已取消此项授权,会默认返回true */
  592. 'scope.address'?: boolean
  593. /** 是否授权蓝牙,对应接口 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html)、[wx.createBLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html) */
  594. 'scope.bluetooth'?: boolean
  595. /** 是否授权摄像头,对应[[camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html)](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件 */
  596. 'scope.camera'?: boolean
  597. /** 是否授权获取发票,已取消此项授权,会默认返回true */
  598. 'scope.invoice'?: boolean
  599. /** 是否授权发票抬头,已取消此项授权,会默认返回true */
  600. 'scope.invoiceTitle'?: boolean
  601. /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */
  602. 'scope.record'?: boolean
  603. /** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */
  604. 'scope.userInfo'?: boolean
  605. /** 是否授权地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */
  606. 'scope.userLocation'?: boolean
  607. /** 是否授权微信运动步数,对应接口 [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) */
  608. 'scope.werun'?: boolean
  609. /** 是否授权保存到相册 [wx.saveImageToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html), [wx.saveVideoToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) */
  610. 'scope.writePhotosAlbum'?: boolean
  611. }
  612. interface AuthorizeForMiniProgramOption {
  613. /** 需要获取权限的 scope,详见 [scope 列表](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#scope-列表)
  614. *
  615. * 可选值:
  616. * - 'scope.record': ;
  617. * - 'scope.writePhotosAlbum': ;
  618. * - 'scope.camera': ; */
  619. scope: 'scope.record' | 'scope.writePhotosAlbum' | 'scope.camera'
  620. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  621. complete?: AuthorizeForMiniProgramCompleteCallback
  622. /** 接口调用失败的回调函数 */
  623. fail?: AuthorizeForMiniProgramFailCallback
  624. /** 接口调用成功的回调函数 */
  625. success?: AuthorizeForMiniProgramSuccessCallback
  626. }
  627. interface AuthorizeOption {
  628. /** 需要获取权限的 scope,详见 [scope 列表](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#scope-列表) */
  629. scope: string
  630. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  631. complete?: AuthorizeCompleteCallback
  632. /** 接口调用失败的回调函数 */
  633. fail?: AuthorizeFailCallback
  634. /** 接口调用成功的回调函数 */
  635. success?: AuthorizeSuccessCallback
  636. }
  637. /** 设备特征列表 */
  638. interface BLECharacteristic {
  639. /** 该特征支持的操作类型 */
  640. properties: BLECharacteristicProperties
  641. /** 蓝牙设备特征的 UUID */
  642. uuid: string
  643. }
  644. /** 该特征支持的操作类型 */
  645. interface BLECharacteristicProperties {
  646. /** 该特征是否支持 indicate 操作 */
  647. indicate: boolean
  648. /** 该特征是否支持 notify 操作 */
  649. notify: boolean
  650. /** 该特征是否支持 read 操作 */
  651. read: boolean
  652. /** 该特征是否支持 write 操作 */
  653. write: boolean
  654. /** 该特征是否支持有回复写操作 */
  655. writeDefault: boolean
  656. /** 该特征是否支持无回复写操作 */
  657. writeNoResponse: boolean
  658. }
  659. interface BLEPeripheralServerCloseOption {
  660. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  661. complete?: FileSystemManagerCloseCompleteCallback
  662. /** 接口调用失败的回调函数 */
  663. fail?: SocketTaskCloseFailCallback
  664. /** 接口调用成功的回调函数 */
  665. success?: FileSystemManagerCloseSuccessCallback
  666. }
  667. /** 描述service的Object */
  668. interface BLEPeripheralService {
  669. /** characteristics列表 */
  670. characteristics: Characteristic[]
  671. /** 蓝牙服务的 UUID */
  672. uuid: string
  673. }
  674. /** 设备服务列表 */
  675. interface BLEService {
  676. /** 该服务是否为主服务 */
  677. isPrimary: boolean
  678. /** 蓝牙设备服务的 UUID */
  679. uuid: string
  680. }
  681. /** BackgroundAudioManager 实例,可通过 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 获取。
  682. *
  683. * **示例代码**
  684. *
  685. * ```js
  686. const backgroundAudioManager = wx.getBackgroundAudioManager()
  687. backgroundAudioManager.title = '此时此刻'
  688. backgroundAudioManager.epname = '此时此刻'
  689. backgroundAudioManager.singer = '许巍'
  690. backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
  691. // 设置了 src 之后会自动播放
  692. backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  693. ``` */
  694. interface BackgroundAudioManager {
  695. /** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。(只读) */
  696. buffered: number
  697. /** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */
  698. coverImgUrl: string
  699. /** 当前音频的播放位置(单位:s),只有在有合法 src 时返回。(只读) */
  700. currentTime: number
  701. /** 当前音频的长度(单位:s),只有在有合法 src 时返回。(只读) */
  702. duration: number
  703. /** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  704. epname: string
  705. /** 当前是否暂停或停止。(只读) */
  706. paused: boolean
  707. /** 需要基础库: `2.11.0`
  708. *
  709. * 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
  710. playbackRate: number
  711. /** 需要基础库: `1.9.94`
  712. *
  713. * 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 */
  714. protocol: string
  715. /** 需要基础库: `2.13.0`
  716. *
  717. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  718. referrerPolicy: string
  719. /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  720. singer: string
  721. /** 音频的数据源([2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */
  722. src: string
  723. /** 音频开始播放的位置(单位:s)。 */
  724. startTime: number
  725. /** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */
  726. title: string
  727. /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  728. webUrl: string
  729. }
  730. interface BatchGetStorageOption {
  731. /** 本地缓存中指定的 keyList */
  732. keyList: string[]
  733. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  734. complete?: BatchGetStorageCompleteCallback
  735. /** 接口调用失败的回调函数 */
  736. fail?: BatchGetStorageFailCallback
  737. /** 接口调用成功的回调函数 */
  738. success?: BatchGetStorageSuccessCallback
  739. }
  740. interface BatchSetStorageOption {
  741. /** [{ key, value }] */
  742. kvList: any[]
  743. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  744. complete?: BatchSetStorageCompleteCallback
  745. /** 接口调用失败的回调函数 */
  746. fail?: BatchSetStorageFailCallback
  747. /** 接口调用成功的回调函数 */
  748. success?: BatchSetStorageSuccessCallback
  749. }
  750. /** Beacon 设备 */
  751. interface BeaconInfo {
  752. /** Beacon 设备的距离,单位 m。iOS 上,proximity 为 0 时,accuracy 为 -1。 */
  753. accuracy: number
  754. /** Beacon 设备的主 ID */
  755. major: number
  756. /** Beacon 设备的次 ID */
  757. minor: number
  758. /** 表示设备距离的枚举值(仅iOS)
  759. *
  760. * 可选值:
  761. * - 0: 信号太弱不足以计算距离,或非 iOS 设备;
  762. * - 1: 十分近;
  763. * - 2: 比较近;
  764. * - 3: 远; */
  765. proximity: 0 | 1 | 2 | 3
  766. /** 表示设备的信号强度,单位 dBm */
  767. rssi: number
  768. /** Beacon 设备广播的 UUID */
  769. uuid: string
  770. }
  771. /** 需要基础库: `2.20.1`
  772. *
  773. * 以 beacon 设备形式广播的参数。 */
  774. interface BeaconInfoObj {
  775. /** Beacon 设备的主 ID */
  776. major: number
  777. /** Beacon 设备的次 ID */
  778. minor: number
  779. /** Beacon 设备广播的 UUID */
  780. uuid: string
  781. /** 用于判断距离设备 1 米时 RSSI 大小的参考值 */
  782. measuredPower?: number
  783. }
  784. interface BindWifiOption {
  785. /** 当前 wifi 网络的 BSSID ,可通过 wx.getConnectedWifi 获取 */
  786. BSSID: string
  787. }
  788. interface BlueToothDevice {
  789. /** 当前蓝牙设备的信号强度,单位 dBm */
  790. RSSI: number
  791. /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */
  792. advertisData: ArrayBuffer
  793. /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */
  794. advertisServiceUUIDs: string[]
  795. /** 当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ) */
  796. connectable: boolean
  797. /** 蓝牙设备 id */
  798. deviceId: string
  799. /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */
  800. localName: string
  801. /** 蓝牙设备名称,某些设备可能没有 */
  802. name: string
  803. /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */
  804. serviceData: IAnyObject
  805. }
  806. /** 搜索到的设备列表 */
  807. interface BluetoothDeviceInfo {
  808. /** 用于区分设备的 id */
  809. deviceId: string
  810. /** 蓝牙设备名称,某些设备可能没有 */
  811. name: string
  812. }
  813. interface BlurOption {
  814. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  815. complete?: BlurCompleteCallback
  816. /** 接口调用失败的回调函数 */
  817. fail?: BlurFailCallback
  818. /** 接口调用成功的回调函数 */
  819. success?: BlurSuccessCallback
  820. }
  821. /** 需要基础库: `2.28.0`
  822. *
  823. * 人体检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
  824. interface BodyTrack {
  825. /** 需要基础库: `2.28.0`
  826. *
  827. * 人体检测模式
  828. *
  829. * 可选值:
  830. * - 1: 通过摄像头实时检测;
  831. * - 2: 静态图片检测; */
  832. mode: 1 | 2
  833. }
  834. interface BoundingClientRectCallbackResult {
  835. /** 节点的下边界坐标 */
  836. bottom: number
  837. /** 节点的 dataset */
  838. dataset: IAnyObject
  839. /** 节点的高度 */
  840. height: number
  841. /** 节点的 ID */
  842. id: string
  843. /** 节点的左边界坐标 */
  844. left: number
  845. /** 节点的右边界坐标 */
  846. right: number
  847. /** 节点的上边界坐标 */
  848. top: number
  849. /** 节点的宽度 */
  850. width: number
  851. }
  852. /** 目标边界 */
  853. interface BoundingClientRectResult {
  854. /** 下边界 */
  855. bottom: number
  856. /** 高度 */
  857. height: number
  858. /** 左边界 */
  859. left: number
  860. /** 右边界 */
  861. right: number
  862. /** 上边界 */
  863. top: number
  864. /** 宽度 */
  865. width: number
  866. }
  867. /** 需要基础库: `2.24.0`
  868. *
  869. * 缓存管理器。全局只有唯一实例,一旦被创建出来即表示接入缓存管理器。其有以下几个能力:
  870. *
  871. * 1. 在网络通畅时,符合一定规则的用户网络请求(目前只包括普通 wx.request 请求)会被缓存。
  872. * 2. 在网络通畅时,某些 wx api 调用会被缓存。
  873. * 3. 进入弱网/离线状态时,会提供事件给用户,用户可以决定是否使用缓存返回。
  874. * 4. 提供进入和退出弱网/离线状态的事件。
  875. *
  876. * > 1. 缓存管理器中涉及的网络请求如无特指,均指普通的 wx.request 异步请求,参数和返回值中均不考虑涉及 ArrayBuffer 或 TypedArray 的情形。
  877. * > 2. 缓存管理器中的缓存不会占用 storage 空间,但是有大小限制,请勿在非必要的请求上使用缓存。 */
  878. interface CacheManager {
  879. /** 全局缓存有效时间 */
  880. maxAge: string
  881. /** 当前缓存模式
  882. *
  883. * 可选值:
  884. * - 'weakNetwork': 默认值,弱网/离线使用缓存返回;
  885. * - 'always': 总是使用缓存返回;
  886. * - 'none': 不开启,后续可手动开启/停止使用缓存返回; */
  887. mode: 'weakNetwork' | 'always' | 'none'
  888. /** 全局 origin */
  889. origin: string
  890. /** 当前缓存管理器状态
  891. *
  892. * 可选值:
  893. * - 0: 不使用缓存返回;
  894. * - 1: 使用缓存返回;
  895. * - 2: 未知; */
  896. state: 0 | 1 | 2
  897. }
  898. interface CameraContextStartRecordOption {
  899. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  900. complete?: StartRecordCompleteCallback
  901. /** 接口调用失败的回调函数 */
  902. fail?: StartRecordFailCallback
  903. /** 需要基础库: `2.22.0`
  904. *
  905. * 是否开启镜像 */
  906. selfieMirror?: boolean
  907. /** 接口调用成功的回调函数 */
  908. success?: CameraContextStartRecordSuccessCallback
  909. /** 需要基础库: `2.22.0`
  910. *
  911. * 录制时长上限,单位为秒,最长不能超过 5 分钟 */
  912. timeout?: number
  913. /** 超过录制时长上限时会结束录像并触发此回调,录像异常退出时也会触发此回调 */
  914. timeoutCallback?: StartRecordTimeoutCallback
  915. }
  916. interface CameraContextStopRecordOption {
  917. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  918. complete?: StopRecordCompleteCallback
  919. /** 启动视频压缩,压缩效果同`chooseVideo` */
  920. compressed?: boolean
  921. /** 接口调用失败的回调函数 */
  922. fail?: StopRecordFailCallback
  923. /** 接口调用成功的回调函数 */
  924. success?: CameraContextStopRecordSuccessCallback
  925. }
  926. interface CameraFrameListenerStartOption {
  927. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  928. complete?: StartCompleteCallback
  929. /** 接口调用失败的回调函数 */
  930. fail?: StartFailCallback
  931. /** 接口调用成功的回调函数 */
  932. success?: StartSuccessCallback
  933. /** [Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html)
  934. *
  935. * 需要基础库: `2.25.1`
  936. *
  937. * 可选参数。如果需要在 iOS ExperimentalWorker 内监听摄像头帧数据,则需要传入对应 Worker 对象。详情 [Worker.getCameraFrameData](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.getCameraFrameData.html) */
  938. worker?: Worker
  939. }
  940. /** 需要基础库: `2.7.0`
  941. *
  942. * Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
  943. *
  944. * **示例代码**
  945. *
  946. * 2D Canvas 示例
  947. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/SHfgCmmq7UcM)
  948. *
  949. * WebGL 示例
  950. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/qEGUOqmf7T8z) */
  951. interface Canvas {
  952. /** 画布高度 */
  953. height: number
  954. /** 画布宽度 */
  955. width: number
  956. }
  957. /** @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  958. *
  959. * canvas 组件的绘图上下文。CanvasContext 是旧版的接口, 新版 Canvas 2D 接口与 Web 一致。 */
  960. interface CanvasContext {
  961. /** 需要基础库: `1.9.90`
  962. *
  963. * 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。 */
  964. fillStyle: string | CanvasGradient
  965. /** 需要基础库: `1.9.90`
  966. *
  967. * 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 */
  968. font: string
  969. /** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
  970. globalAlpha: number
  971. /** 需要基础库: `1.9.90`
  972. *
  973. * 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
  974. *
  975. * 目前支持的操作有
  976. * - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light
  977. * - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity */
  978. globalCompositeOperation: string
  979. /** 需要基础库: `1.9.90`
  980. *
  981. * 线条的端点样式。用法同 [CanvasContext.setLineCap()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)。 */
  982. lineCap: string
  983. /** 需要基础库: `1.9.90`
  984. *
  985. * 虚线偏移量,初始值为0 */
  986. lineDashOffset: number
  987. /** 需要基础库: `1.9.90`
  988. *
  989. * 线条的交点样式。用法同 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)。
  990. *
  991. * 可选值:
  992. * - 'bevel': 斜角;
  993. * - 'round': 圆角;
  994. * - 'miter': 尖角; */
  995. lineJoin: 'bevel' | 'round' | 'miter'
  996. /** 需要基础库: `1.9.90`
  997. *
  998. * 线条的宽度。用法同 [CanvasContext.setLineWidth()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)。 */
  999. lineWidth: number
  1000. /** 需要基础库: `1.9.90`
  1001. *
  1002. * 最大斜接长度。用法同 [CanvasContext.setMiterLimit()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)。 */
  1003. miterLimit: number
  1004. /** 需要基础库: `1.9.90`
  1005. *
  1006. * 阴影的模糊级别 */
  1007. shadowBlur: number
  1008. /** 需要基础库: `1.9.90`
  1009. *
  1010. * 阴影的颜色 */
  1011. shadowColor: number
  1012. /** 需要基础库: `1.9.90`
  1013. *
  1014. * 阴影相对于形状在水平方向的偏移 */
  1015. shadowOffsetX: number
  1016. /** 需要基础库: `1.9.90`
  1017. *
  1018. * 阴影相对于形状在竖直方向的偏移 */
  1019. shadowOffsetY: number
  1020. /** 需要基础库: `1.9.90`
  1021. *
  1022. * 边框颜色。用法同 [CanvasContext.setStrokeStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)。 */
  1023. strokeStyle: string | CanvasGradient
  1024. }
  1025. interface CanvasGetImageDataOption {
  1026. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 `canvas-id` 属性。 */
  1027. canvasId: string
  1028. /** 将要被提取的图像数据矩形区域的高度 */
  1029. height: number
  1030. /** 将要被提取的图像数据矩形区域的宽度 */
  1031. width: number
  1032. /** 将要被提取的图像数据矩形区域的左上角横坐标 */
  1033. x: number
  1034. /** 将要被提取的图像数据矩形区域的左上角纵坐标 */
  1035. y: number
  1036. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1037. complete?: CanvasGetImageDataCompleteCallback
  1038. /** 接口调用失败的回调函数 */
  1039. fail?: CanvasGetImageDataFailCallback
  1040. /** 接口调用成功的回调函数 */
  1041. success?: CanvasGetImageDataSuccessCallback
  1042. }
  1043. interface CanvasGetImageDataSuccessCallbackResult {
  1044. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  1045. data: Uint8ClampedArray
  1046. /** 图像数据矩形的高度 */
  1047. height: number
  1048. /** 图像数据矩形的宽度 */
  1049. width: number
  1050. errMsg: string
  1051. }
  1052. interface CanvasPutImageDataOption {
  1053. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id 属性。 */
  1054. canvasId: string
  1055. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  1056. data: Uint8ClampedArray
  1057. /** 源图像数据矩形区域的高度 */
  1058. height: number
  1059. /** 源图像数据矩形区域的宽度 */
  1060. width: number
  1061. /** 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) */
  1062. x: number
  1063. /** 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) */
  1064. y: number
  1065. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1066. complete?: CanvasPutImageDataCompleteCallback
  1067. /** 接口调用失败的回调函数 */
  1068. fail?: CanvasPutImageDataFailCallback
  1069. /** 接口调用成功的回调函数 */
  1070. success?: CanvasPutImageDataSuccessCallback
  1071. }
  1072. interface CanvasToTempFilePathOption {
  1073. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件实例 (canvas type="2d" 时使用该属性)。 */
  1074. canvas?: IAnyObject
  1075. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id */
  1076. canvasId?: string
  1077. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1078. complete?: CanvasToTempFilePathCompleteCallback
  1079. /** 需要基础库: `1.2.0`
  1080. *
  1081. * 输出的图片的高度 */
  1082. destHeight?: number
  1083. /** 需要基础库: `1.2.0`
  1084. *
  1085. * 输出的图片的宽度 */
  1086. destWidth?: number
  1087. /** 接口调用失败的回调函数 */
  1088. fail?: CanvasToTempFilePathFailCallback
  1089. /** 需要基础库: `1.7.0`
  1090. *
  1091. * 目标文件的类型
  1092. *
  1093. * 可选值:
  1094. * - 'jpg': jpg 图片;
  1095. * - 'png': png 图片; */
  1096. fileType?: 'jpg' | 'png'
  1097. /** 需要基础库: `1.2.0`
  1098. *
  1099. * 指定的画布区域的高度 */
  1100. height?: number
  1101. /** 需要基础库: `1.7.0`
  1102. *
  1103. * 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
  1104. quality?: number
  1105. /** 接口调用成功的回调函数 */
  1106. success?: CanvasToTempFilePathSuccessCallback
  1107. /** 需要基础库: `1.2.0`
  1108. *
  1109. * 指定的画布区域的宽度 */
  1110. width?: number
  1111. /** 需要基础库: `1.2.0`
  1112. *
  1113. * 指定的画布区域的左上角横坐标 */
  1114. x?: number
  1115. /** 需要基础库: `1.2.0`
  1116. *
  1117. * 指定的画布区域的左上角纵坐标 */
  1118. y?: number
  1119. }
  1120. interface CanvasToTempFilePathSuccessCallbackResult {
  1121. /** 生成文件的临时路径 (本地路径) */
  1122. tempFilePath: string
  1123. errMsg: string
  1124. }
  1125. /** characteristics列表 */
  1126. interface Characteristic {
  1127. /** characteristic 的 UUID */
  1128. uuid: string
  1129. /** 描述符数据 */
  1130. descriptors?: CharacteristicDescriptor[]
  1131. /** 特征权限 */
  1132. permission?: CharacteristicPermission
  1133. /** 特征支持的操作 */
  1134. properties?: CharacteristicProperties
  1135. /** 特征对应的二进制值 */
  1136. value?: ArrayBuffer
  1137. }
  1138. /** 描述符数据 */
  1139. interface CharacteristicDescriptor {
  1140. /** Descriptor 的 UUID */
  1141. uuid: string
  1142. /** 描述符的权限 */
  1143. permission?: DescriptorPermission
  1144. /** 描述符数据 */
  1145. value?: ArrayBuffer
  1146. }
  1147. /** 特征权限 */
  1148. interface CharacteristicPermission {
  1149. /** 加密读请求 */
  1150. readEncryptionRequired?: boolean
  1151. /** 可读 */
  1152. readable?: boolean
  1153. /** 加密写请求 */
  1154. writeEncryptionRequired?: boolean
  1155. /** 可写 */
  1156. writeable?: boolean
  1157. }
  1158. /** 特征支持的操作 */
  1159. interface CharacteristicProperties {
  1160. /** 回包 */
  1161. indicate?: boolean
  1162. /** 订阅 */
  1163. notify?: boolean
  1164. /** 读 */
  1165. read?: boolean
  1166. /** 写 */
  1167. write?: boolean
  1168. /** 无回复写 */
  1169. writeNoResponse?: boolean
  1170. }
  1171. interface CheckIsAddedToMyMiniProgramOption {
  1172. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1173. complete?: CheckIsAddedToMyMiniProgramCompleteCallback
  1174. /** 接口调用失败的回调函数 */
  1175. fail?: CheckIsAddedToMyMiniProgramFailCallback
  1176. /** 接口调用成功的回调函数 */
  1177. success?: CheckIsAddedToMyMiniProgramSuccessCallback
  1178. }
  1179. interface CheckIsAddedToMyMiniProgramSuccessCallbackResult {
  1180. /** 是否被添加至 「我的小程序」 */
  1181. added: boolean
  1182. errMsg: string
  1183. }
  1184. interface CheckIsOpenAccessibilityOption {
  1185. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1186. complete?: CheckIsOpenAccessibilityCompleteCallback
  1187. /** 接口调用失败的回调函数 */
  1188. fail?: CheckIsOpenAccessibilityFailCallback
  1189. /** 接口调用成功的回调函数 */
  1190. success?: CheckIsOpenAccessibilitySuccessCallback
  1191. }
  1192. interface CheckIsOpenAccessibilitySuccessCallbackOption {
  1193. /** iOS 上开启辅助功能旁白,安卓开启 talkback 时返回 true */
  1194. open: boolean
  1195. }
  1196. interface CheckIsSoterEnrolledInDeviceOption {
  1197. /** 认证方式
  1198. *
  1199. * 可选值:
  1200. * - 'fingerPrint': 指纹识别;
  1201. * - 'facial': 人脸识别;
  1202. * - 'speech': 声纹识别(暂未支持); */
  1203. checkAuthMode: 'fingerPrint' | 'facial' | 'speech'
  1204. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1205. complete?: CheckIsSoterEnrolledInDeviceCompleteCallback
  1206. /** 接口调用失败的回调函数 */
  1207. fail?: CheckIsSoterEnrolledInDeviceFailCallback
  1208. /** 接口调用成功的回调函数 */
  1209. success?: CheckIsSoterEnrolledInDeviceSuccessCallback
  1210. }
  1211. interface CheckIsSoterEnrolledInDeviceSuccessCallbackResult {
  1212. /** 错误信息 */
  1213. errMsg: string
  1214. /** 是否已录入信息 */
  1215. isEnrolled: boolean
  1216. }
  1217. interface CheckIsSupportSoterAuthenticationOption {
  1218. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1219. complete?: CheckIsSupportSoterAuthenticationCompleteCallback
  1220. /** 接口调用失败的回调函数 */
  1221. fail?: CheckIsSupportSoterAuthenticationFailCallback
  1222. /** 接口调用成功的回调函数 */
  1223. success?: CheckIsSupportSoterAuthenticationSuccessCallback
  1224. }
  1225. interface CheckIsSupportSoterAuthenticationSuccessCallbackResult {
  1226. /** 该设备支持的可被SOTER识别的生物识别方式
  1227. *
  1228. * 可选值:
  1229. * - 'fingerPrint': 指纹识别;
  1230. * - 'facial': 人脸识别;
  1231. * - 'speech': 声纹识别(暂未支持); */
  1232. supportMode: Array<'fingerPrint' | 'facial' | 'speech'>
  1233. errMsg: string
  1234. }
  1235. interface CheckSessionOption {
  1236. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1237. complete?: CheckSessionCompleteCallback
  1238. /** 接口调用失败的回调函数 */
  1239. fail?: CheckSessionFailCallback
  1240. /** 接口调用成功的回调函数 */
  1241. success?: CheckSessionSuccessCallback
  1242. }
  1243. interface ChooseAddressOption {
  1244. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1245. complete?: ChooseAddressCompleteCallback
  1246. /** 接口调用失败的回调函数 */
  1247. fail?: ChooseAddressFailCallback
  1248. /** 接口调用成功的回调函数 */
  1249. success?: ChooseAddressSuccessCallback
  1250. }
  1251. interface ChooseAddressSuccessCallbackResult {
  1252. /** 国标收货地址第二级地址 */
  1253. cityName: string
  1254. /** 国标收货地址第三级地址 */
  1255. countyName: string
  1256. /** 详细收货地址信息(包括街道地址) */
  1257. detailInfo: string
  1258. /** 新选择器详细收货地址信息 */
  1259. detailInfoNew: string
  1260. /** 错误信息 */
  1261. errMsg: string
  1262. /** 收货地址国家码 */
  1263. nationalCode: string
  1264. /** 邮编 */
  1265. postalCode: string
  1266. /** 国标收货地址第一级地址 */
  1267. provinceName: string
  1268. /** 国标收货地址第四级地址 */
  1269. streetName: string
  1270. /** 收货人手机号码 */
  1271. telNumber: string
  1272. /** 收货人姓名 */
  1273. userName: string
  1274. }
  1275. interface ChooseContactOption {
  1276. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1277. complete?: ChooseContactCompleteCallback
  1278. /** 接口调用失败的回调函数 */
  1279. fail?: ChooseContactFailCallback
  1280. /** 接口调用成功的回调函数 */
  1281. success?: ChooseContactSuccessCallback
  1282. }
  1283. interface ChooseContactSuccessCallbackOption {
  1284. /** 联系人姓名 */
  1285. displayName: string
  1286. /** 手机号 */
  1287. phoneNumber: string
  1288. /** 选定联系人的所有手机号(部分 Android 系统只能选联系人而不能选特定手机号) */
  1289. phoneNumberList: string
  1290. }
  1291. /** 返回选择的文件的本地临时文件对象数组 */
  1292. interface ChooseFile {
  1293. /** 选择的文件名称 */
  1294. name: string
  1295. /** 本地临时文件路径 (本地路径) */
  1296. path: string
  1297. /** 本地临时文件大小,单位 B */
  1298. size: number
  1299. /** 选择的文件的会话发送时间,Unix时间戳,工具暂不支持此属性 */
  1300. time: number
  1301. /** 选择的文件类型
  1302. *
  1303. * 可选值:
  1304. * - 'video': 选择了视频文件;
  1305. * - 'image': 选择了图片文件;
  1306. * - 'file': 选择了除图片和视频的文件; */
  1307. type: 'video' | 'image' | 'file'
  1308. }
  1309. interface ChooseImageOption {
  1310. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1311. complete?: ChooseImageCompleteCallback
  1312. /** 最多可以选择的图片张数 */
  1313. count?: number
  1314. /** 接口调用失败的回调函数 */
  1315. fail?: ChooseImageFailCallback
  1316. /** 所选的图片的尺寸
  1317. *
  1318. * 可选值:
  1319. * - 'original': 原图;
  1320. * - 'compressed': 压缩图; */
  1321. sizeType?: Array<'original' | 'compressed'>
  1322. /** 选择图片的来源
  1323. *
  1324. * 可选值:
  1325. * - 'album': 从相册选图;
  1326. * - 'camera': 使用相机; */
  1327. sourceType?: Array<'album' | 'camera'>
  1328. /** 接口调用成功的回调函数 */
  1329. success?: ChooseImageSuccessCallback
  1330. }
  1331. interface ChooseImageSuccessCallbackResult {
  1332. /** 图片的本地临时文件路径列表 (本地路径) */
  1333. tempFilePaths: string[]
  1334. /** 需要基础库: `1.2.0`
  1335. *
  1336. * 图片的本地临时文件列表 */
  1337. tempFiles: ImageFile[]
  1338. errMsg: string
  1339. }
  1340. interface ChooseInvoiceOption {
  1341. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1342. complete?: ChooseInvoiceCompleteCallback
  1343. /** 接口调用失败的回调函数 */
  1344. fail?: ChooseInvoiceFailCallback
  1345. /** 接口调用成功的回调函数 */
  1346. success?: ChooseInvoiceSuccessCallback
  1347. }
  1348. interface ChooseInvoiceSuccessCallbackResult {
  1349. /** 用户选中的发票信息,格式为一个 JSON 字符串,包含三个字段: card_id:所选发票卡券的 cardId,encrypt_code:所选发票卡券的加密 code,报销方可以通过 cardId 和 encryptCode 获得报销发票的信息,app_id: 发票方的 appId。 */
  1350. invoiceInfo: string
  1351. errMsg: string
  1352. }
  1353. interface ChooseInvoiceTitleOption {
  1354. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1355. complete?: ChooseInvoiceTitleCompleteCallback
  1356. /** 接口调用失败的回调函数 */
  1357. fail?: ChooseInvoiceTitleFailCallback
  1358. /** 接口调用成功的回调函数 */
  1359. success?: ChooseInvoiceTitleSuccessCallback
  1360. }
  1361. interface ChooseInvoiceTitleSuccessCallbackResult {
  1362. /** 银行账号 */
  1363. bankAccount: string
  1364. /** 银行名称 */
  1365. bankName: string
  1366. /** 单位地址 */
  1367. companyAddress: string
  1368. /** 错误信息 */
  1369. errMsg: string
  1370. /** 抬头税号 */
  1371. taxNumber: string
  1372. /** 手机号码 */
  1373. telephone: string
  1374. /** 抬头名称 */
  1375. title: string
  1376. /** 抬头类型
  1377. *
  1378. * 可选值:
  1379. * - 0: 单位;
  1380. * - 1: 个人; */
  1381. type: 0 | 1
  1382. }
  1383. interface ChooseLicensePlateOption {
  1384. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1385. complete?: ChooseLicensePlateCompleteCallback
  1386. /** 接口调用失败的回调函数 */
  1387. fail?: ChooseLicensePlateFailCallback
  1388. /** 接口调用成功的回调函数 */
  1389. success?: ChooseLicensePlateSuccessCallback
  1390. }
  1391. interface ChooseLicensePlateSuccessCallbackResult {
  1392. /** 用户选择的车牌号 */
  1393. plateNumber: string
  1394. errMsg: string
  1395. }
  1396. interface ChooseLocationOption {
  1397. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1398. complete?: ChooseLocationCompleteCallback
  1399. /** 接口调用失败的回调函数 */
  1400. fail?: ChooseLocationFailCallback
  1401. /** 需要基础库: `2.9.0`
  1402. *
  1403. * 目标地纬度 */
  1404. latitude?: number
  1405. /** 需要基础库: `2.9.0`
  1406. *
  1407. * 目标地经度 */
  1408. longitude?: number
  1409. /** 接口调用成功的回调函数 */
  1410. success?: ChooseLocationSuccessCallback
  1411. }
  1412. interface ChooseLocationSuccessCallbackResult {
  1413. /** 详细地址 */
  1414. address: string
  1415. /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  1416. latitude: number
  1417. /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  1418. longitude: number
  1419. /** 位置名称 */
  1420. name: string
  1421. errMsg: string
  1422. }
  1423. interface ChooseMediaOption {
  1424. /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
  1425. *
  1426. * 可选值:
  1427. * - 'back': 使用后置摄像头;
  1428. * - 'front': 使用前置摄像头; */
  1429. camera?: 'back' | 'front'
  1430. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1431. complete?: ChooseMediaCompleteCallback
  1432. /** 最多可以选择的文件个数,基础库2.25.0前,最多可支持9个文件,2.25.0及以后最多可支持20个文件 */
  1433. count?: number
  1434. /** 接口调用失败的回调函数 */
  1435. fail?: ChooseMediaFailCallback
  1436. /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间。不限制相册。 */
  1437. maxDuration?: number
  1438. /** 文件类型
  1439. *
  1440. * 可选值:
  1441. * - 'image': 只能拍摄图片或从相册选择图片;
  1442. * - 'video': 只能拍摄视频或从相册选择视频;
  1443. * - 'mix': 可同时选择图片和视频; */
  1444. mediaType?: Array<'image' | 'video' | 'mix'>
  1445. /** 是否压缩所选文件,基础库2.25.0前仅对 mediaType 为 image 时有效,2.25.0及以后对全量 mediaType 有效 */
  1446. sizeType?: string[]
  1447. /** 图片和视频选择的来源
  1448. *
  1449. * 可选值:
  1450. * - 'album': 从相册选择;
  1451. * - 'camera': 使用相机拍摄; */
  1452. sourceType?: Array<'album' | 'camera'>
  1453. /** 接口调用成功的回调函数 */
  1454. success?: ChooseMediaSuccessCallback
  1455. }
  1456. interface ChooseMediaSuccessCallbackResult {
  1457. /** 本地临时文件列表 */
  1458. tempFiles: MediaFile[]
  1459. /** 文件类型,有效值有 image 、video、mix */
  1460. type: string
  1461. errMsg: string
  1462. }
  1463. interface ChooseMessageFileOption {
  1464. /** 最多可以选择的文件个数,可以 0~100 */
  1465. count: number
  1466. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1467. complete?: ChooseMessageFileCompleteCallback
  1468. /** 需要基础库: `2.6.0`
  1469. *
  1470. * 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。 */
  1471. extension?: string[]
  1472. /** 接口调用失败的回调函数 */
  1473. fail?: ChooseMessageFileFailCallback
  1474. /** 接口调用成功的回调函数 */
  1475. success?: ChooseMessageFileSuccessCallback
  1476. /** 所选的文件的类型
  1477. *
  1478. * 可选值:
  1479. * - 'all': 从所有文件选择;
  1480. * - 'video': 只能选择视频文件;
  1481. * - 'image': 只能选择图片文件;
  1482. * - 'file': 可以选择除了图片和视频之外的其它的文件; */
  1483. type?: 'all' | 'video' | 'image' | 'file'
  1484. }
  1485. interface ChooseMessageFileSuccessCallbackResult {
  1486. /** 返回选择的文件的本地临时文件对象数组 */
  1487. tempFiles: ChooseFile[]
  1488. errMsg: string
  1489. }
  1490. interface ChoosePoiOption {
  1491. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1492. complete?: ChoosePoiCompleteCallback
  1493. /** 接口调用失败的回调函数 */
  1494. fail?: ChoosePoiFailCallback
  1495. /** 接口调用成功的回调函数 */
  1496. success?: ChoosePoiSuccessCallback
  1497. }
  1498. interface ChoosePoiSuccessCallbackResult {
  1499. /** 详细地址 */
  1500. address: string
  1501. /** 城市名称 */
  1502. city: number
  1503. /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系(即将废弃) */
  1504. latitude: number
  1505. /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系(即将废弃) */
  1506. longitude: number
  1507. /** 位置名称 */
  1508. name: string
  1509. /** 选择城市时,值为 1,选择精确位置时,值为 2 */
  1510. type: number
  1511. errMsg: string
  1512. }
  1513. interface ChooseVideoOption {
  1514. /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
  1515. *
  1516. * 可选值:
  1517. * - 'back': 默认拉起后置摄像头;
  1518. * - 'front': 默认拉起前置摄像头; */
  1519. camera?: 'back' | 'front'
  1520. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1521. complete?: ChooseVideoCompleteCallback
  1522. /** 需要基础库: `1.6.0`
  1523. *
  1524. * 是否压缩所选择的视频文件 */
  1525. compressed?: boolean
  1526. /** 接口调用失败的回调函数 */
  1527. fail?: ChooseVideoFailCallback
  1528. /** 拍摄视频最长拍摄时间,单位秒 */
  1529. maxDuration?: number
  1530. /** 视频选择的来源
  1531. *
  1532. * 可选值:
  1533. * - 'album': 从相册选择视频;
  1534. * - 'camera': 使用相机拍摄视频; */
  1535. sourceType?: Array<'album' | 'camera'>
  1536. /** 接口调用成功的回调函数 */
  1537. success?: ChooseVideoSuccessCallback
  1538. }
  1539. interface ChooseVideoSuccessCallbackResult {
  1540. /** 选定视频的时间长度 */
  1541. duration: number
  1542. /** 返回选定视频的高度 */
  1543. height: number
  1544. /** 选定视频的数据量大小 */
  1545. size: number
  1546. /** 选定视频的临时文件路径 (本地路径) */
  1547. tempFilePath: string
  1548. /** 返回选定视频的宽度 */
  1549. width: number
  1550. errMsg: string
  1551. }
  1552. interface ClearFiltersOption {
  1553. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1554. complete?: ClearFiltersCompleteCallback
  1555. /** 接口调用失败的回调函数 */
  1556. fail?: ClearFiltersFailCallback
  1557. /** 接口调用成功的回调函数 */
  1558. success?: ClearFiltersSuccessCallback
  1559. }
  1560. interface ClearMakeupsOption {
  1561. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1562. complete?: ClearMakeupsCompleteCallback
  1563. /** 接口调用失败的回调函数 */
  1564. fail?: ClearMakeupsFailCallback
  1565. /** 接口调用成功的回调函数 */
  1566. success?: ClearMakeupsSuccessCallback
  1567. }
  1568. interface ClearOption {
  1569. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1570. complete?: ClearCompleteCallback
  1571. /** 接口调用失败的回调函数 */
  1572. fail?: ClearFailCallback
  1573. /** 接口调用成功的回调函数 */
  1574. success?: ClearSuccessCallback
  1575. }
  1576. interface ClearStickersOption {
  1577. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1578. complete?: ClearStickersCompleteCallback
  1579. /** 接口调用失败的回调函数 */
  1580. fail?: ClearStickersFailCallback
  1581. /** 接口调用成功的回调函数 */
  1582. success?: ClearStickersSuccessCallback
  1583. }
  1584. interface ClearStorageOption {
  1585. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1586. complete?: ClearStorageCompleteCallback
  1587. /** 接口调用失败的回调函数 */
  1588. fail?: ClearStorageFailCallback
  1589. /** 接口调用成功的回调函数 */
  1590. success?: ClearStorageSuccessCallback
  1591. }
  1592. /** 菜单按钮的布局位置信息 */
  1593. interface ClientRect {
  1594. /** 下边界坐标,单位:px */
  1595. bottom: number
  1596. /** 高度,单位:px */
  1597. height: number
  1598. /** 左边界坐标,单位:px */
  1599. left: number
  1600. /** 右边界坐标,单位:px */
  1601. right: number
  1602. /** 上边界坐标,单位:px */
  1603. top: number
  1604. /** 宽度,单位:px */
  1605. width: number
  1606. }
  1607. interface CloseBLEConnectionOption {
  1608. /** 蓝牙设备 id */
  1609. deviceId: string
  1610. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1611. complete?: CloseBLEConnectionCompleteCallback
  1612. /** 接口调用失败的回调函数 */
  1613. fail?: CloseBLEConnectionFailCallback
  1614. /** 接口调用成功的回调函数 */
  1615. success?: CloseBLEConnectionSuccessCallback
  1616. }
  1617. interface CloseBluetoothAdapterOption {
  1618. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1619. complete?: CloseBluetoothAdapterCompleteCallback
  1620. /** 接口调用失败的回调函数 */
  1621. fail?: CloseBluetoothAdapterFailCallback
  1622. /** 接口调用成功的回调函数 */
  1623. success?: CloseBluetoothAdapterSuccessCallback
  1624. }
  1625. interface CloseFailCallbackResult {
  1626. /** 错误信息
  1627. *
  1628. * 可选值:
  1629. * - 'bad file descriptor': 无效的文件描述符; */
  1630. errMsg: string
  1631. }
  1632. interface CloseSocketOption {
  1633. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  1634. code?: number
  1635. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1636. complete?: CloseSocketCompleteCallback
  1637. /** 接口调用失败的回调函数 */
  1638. fail?: CloseSocketFailCallback
  1639. /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */
  1640. reason?: string
  1641. /** 接口调用成功的回调函数 */
  1642. success?: CloseSocketSuccessCallback
  1643. }
  1644. interface CloseSyncOption {
  1645. /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  1646. fd: string
  1647. }
  1648. /** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色:
  1649. *
  1650. * - RGB 颜色: 如 `'rgb(255, 0, 0)'`
  1651. * - RGBA 颜色:如 `'rgba(255, 0, 0, 0.3)'`
  1652. * - 16 进制颜色: 如 `'#FF0000'`
  1653. * - 预定义的颜色: 如 `'red'`
  1654. *
  1655. * 其中预定义颜色有以下148个:
  1656. * *注意**: Color Name 大小写不敏感
  1657. *
  1658. * | Color Name | HEX |
  1659. * | -------------------- | ------- |
  1660. * | AliceBlue | #F0F8FF |
  1661. * | AntiqueWhite | #FAEBD7 |
  1662. * | Aqua | #00FFFF |
  1663. * | Aquamarine | #7FFFD4 |
  1664. * | Azure | #F0FFFF |
  1665. * | Beige | #F5F5DC |
  1666. * | Bisque | #FFE4C4 |
  1667. * | Black | #000000 |
  1668. * | BlanchedAlmond | #FFEBCD |
  1669. * | Blue | #0000FF |
  1670. * | BlueViolet | #8A2BE2 |
  1671. * | Brown | #A52A2A |
  1672. * | BurlyWood | #DEB887 |
  1673. * | CadetBlue | #5F9EA0 |
  1674. * | Chartreuse | #7FFF00 |
  1675. * | Chocolate | #D2691E |
  1676. * | Coral | #FF7F50 |
  1677. * | CornflowerBlue | #6495ED |
  1678. * | Cornsilk | #FFF8DC |
  1679. * | Crimson | #DC143C |
  1680. * | Cyan | #00FFFF |
  1681. * | DarkBlue | #00008B |
  1682. * | DarkCyan | #008B8B |
  1683. * | DarkGoldenRod | #B8860B |
  1684. * | DarkGray | #A9A9A9 |
  1685. * | DarkGrey | #A9A9A9 |
  1686. * | DarkGreen | #006400 |
  1687. * | DarkKhaki | #BDB76B |
  1688. * | DarkMagenta | #8B008B |
  1689. * | DarkOliveGreen | #556B2F |
  1690. * | DarkOrange | #FF8C00 |
  1691. * | DarkOrchid | #9932CC |
  1692. * | DarkRed | #8B0000 |
  1693. * | DarkSalmon | #E9967A |
  1694. * | DarkSeaGreen | #8FBC8F |
  1695. * | DarkSlateBlue | #483D8B |
  1696. * | DarkSlateGray | #2F4F4F |
  1697. * | DarkSlateGrey | #2F4F4F |
  1698. * | DarkTurquoise | #00CED1 |
  1699. * | DarkViolet | #9400D3 |
  1700. * | DeepPink | #FF1493 |
  1701. * | DeepSkyBlue | #00BFFF |
  1702. * | DimGray | #696969 |
  1703. * | DimGrey | #696969 |
  1704. * | DodgerBlue | #1E90FF |
  1705. * | FireBrick | #B22222 |
  1706. * | FloralWhite | #FFFAF0 |
  1707. * | ForestGreen | #228B22 |
  1708. * | Fuchsia | #FF00FF |
  1709. * | Gainsboro | #DCDCDC |
  1710. * | GhostWhite | #F8F8FF |
  1711. * | Gold | #FFD700 |
  1712. * | GoldenRod | #DAA520 |
  1713. * | Gray | #808080 |
  1714. * | Grey | #808080 |
  1715. * | Green | #008000 |
  1716. * | GreenYellow | #ADFF2F |
  1717. * | HoneyDew | #F0FFF0 |
  1718. * | HotPink | #FF69B4 |
  1719. * | IndianRed | #CD5C5C |
  1720. * | Indigo | #4B0082 |
  1721. * | Ivory | #FFFFF0 |
  1722. * | Khaki | #F0E68C |
  1723. * | Lavender | #E6E6FA |
  1724. * | LavenderBlush | #FFF0F5 |
  1725. * | LawnGreen | #7CFC00 |
  1726. * | LemonChiffon | #FFFACD |
  1727. * | LightBlue | #ADD8E6 |
  1728. * | LightCoral | #F08080 |
  1729. * | LightCyan | #E0FFFF |
  1730. * | LightGoldenRodYellow | #FAFAD2 |
  1731. * | LightGray | #D3D3D3 |
  1732. * | LightGrey | #D3D3D3 |
  1733. * | LightGreen | #90EE90 |
  1734. * | LightPink | #FFB6C1 |
  1735. * | LightSalmon | #FFA07A |
  1736. * | LightSeaGreen | #20B2AA |
  1737. * | LightSkyBlue | #87CEFA |
  1738. * | LightSlateGray | #778899 |
  1739. * | LightSlateGrey | #778899 |
  1740. * | LightSteelBlue | #B0C4DE |
  1741. * | LightYellow | #FFFFE0 |
  1742. * | Lime | #00FF00 |
  1743. * | LimeGreen | #32CD32 |
  1744. * | Linen | #FAF0E6 |
  1745. * | Magenta | #FF00FF |
  1746. * | Maroon | #800000 |
  1747. * | MediumAquaMarine | #66CDAA |
  1748. * | MediumBlue | #0000CD |
  1749. * | MediumOrchid | #BA55D3 |
  1750. * | MediumPurple | #9370DB |
  1751. * | MediumSeaGreen | #3CB371 |
  1752. * | MediumSlateBlue | #7B68EE |
  1753. * | MediumSpringGreen | #00FA9A |
  1754. * | MediumTurquoise | #48D1CC |
  1755. * | MediumVioletRed | #C71585 |
  1756. * | MidnightBlue | #191970 |
  1757. * | MintCream | #F5FFFA |
  1758. * | MistyRose | #FFE4E1 |
  1759. * | Moccasin | #FFE4B5 |
  1760. * | NavajoWhite | #FFDEAD |
  1761. * | Navy | #000080 |
  1762. * | OldLace | #FDF5E6 |
  1763. * | Olive | #808000 |
  1764. * | OliveDrab | #6B8E23 |
  1765. * | Orange | #FFA500 |
  1766. * | OrangeRed | #FF4500 |
  1767. * | Orchid | #DA70D6 |
  1768. * | PaleGoldenRod | #EEE8AA |
  1769. * | PaleGreen | #98FB98 |
  1770. * | PaleTurquoise | #AFEEEE |
  1771. * | PaleVioletRed | #DB7093 |
  1772. * | PapayaWhip | #FFEFD5 |
  1773. * | PeachPuff | #FFDAB9 |
  1774. * | Peru | #CD853F |
  1775. * | Pink | #FFC0CB |
  1776. * | Plum | #DDA0DD |
  1777. * | PowderBlue | #B0E0E6 |
  1778. * | Purple | #800080 |
  1779. * | RebeccaPurple | #663399 |
  1780. * | Red | #FF0000 |
  1781. * | RosyBrown | #BC8F8F |
  1782. * | RoyalBlue | #4169E1 |
  1783. * | SaddleBrown | #8B4513 |
  1784. * | Salmon | #FA8072 |
  1785. * | SandyBrown | #F4A460 |
  1786. * | SeaGreen | #2E8B57 |
  1787. * | SeaShell | #FFF5EE |
  1788. * | Sienna | #A0522D |
  1789. * | Silver | #C0C0C0 |
  1790. * | SkyBlue | #87CEEB |
  1791. * | SlateBlue | #6A5ACD |
  1792. * | SlateGray | #708090 |
  1793. * | SlateGrey | #708090 |
  1794. * | Snow | #FFFAFA |
  1795. * | SpringGreen | #00FF7F |
  1796. * | SteelBlue | #4682B4 |
  1797. * | Tan | #D2B48C |
  1798. * | Teal | #008080 |
  1799. * | Thistle | #D8BFD8 |
  1800. * | Tomato | #FF6347 |
  1801. * | Turquoise | #40E0D0 |
  1802. * | Violet | #EE82EE |
  1803. * | Wheat | #F5DEB3 |
  1804. * | White | #FFFFFF |
  1805. * | WhiteSmoke | #F5F5F5 |
  1806. * | Yellow | #FFFF00 |
  1807. * | YellowGreen | #9ACD32 | */
  1808. interface Color {}
  1809. interface CompressImageOption {
  1810. /** 图片路径,图片的路径,支持本地路径、代码包路径 */
  1811. src: string
  1812. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1813. complete?: CompressImageCompleteCallback
  1814. /** 需要基础库: `2.26.0`
  1815. *
  1816. * 压缩后图片的高度,单位为px,若不填写则默认以compressedWidth为准等比缩放 */
  1817. compressHeight?: number
  1818. /** 需要基础库: `2.26.0`
  1819. *
  1820. * 压缩后图片的宽度,单位为px,若不填写则默认以compressedHeight为准等比缩放。 */
  1821. compressedWidth?: number
  1822. /** 接口调用失败的回调函数 */
  1823. fail?: CompressImageFailCallback
  1824. /** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */
  1825. quality?: number
  1826. /** 接口调用成功的回调函数 */
  1827. success?: CompressImageSuccessCallback
  1828. }
  1829. interface CompressImageSuccessCallbackResult {
  1830. /** 压缩后图片的临时文件路径 (本地路径) */
  1831. tempFilePath: string
  1832. errMsg: string
  1833. }
  1834. interface CompressVideoOption {
  1835. /** 码率,单位 kbps */
  1836. bitrate: number
  1837. /** 帧率 */
  1838. fps: number
  1839. /** 压缩质量
  1840. *
  1841. * 可选值:
  1842. * - 'low': 低;
  1843. * - 'medium': 中;
  1844. * - 'high': 高; */
  1845. quality: 'low' | 'medium' | 'high'
  1846. /** 相对于原视频的分辨率比例,取值范围(0, 1] */
  1847. resolution: number
  1848. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
  1849. src: string
  1850. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1851. complete?: CompressVideoCompleteCallback
  1852. /** 接口调用失败的回调函数 */
  1853. fail?: CompressVideoFailCallback
  1854. /** 接口调用成功的回调函数 */
  1855. success?: CompressVideoSuccessCallback
  1856. }
  1857. interface CompressVideoSuccessCallbackResult {
  1858. /** 压缩后的大小,单位 kB */
  1859. size: string
  1860. /** 压缩后的临时文件地址 */
  1861. tempFilePath: string
  1862. errMsg: string
  1863. }
  1864. interface ConnectSocketOption {
  1865. /** 开发者服务器 wss 接口地址 */
  1866. url: string
  1867. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1868. complete?: ConnectSocketCompleteCallback
  1869. /** 接口调用失败的回调函数 */
  1870. fail?: ConnectSocketFailCallback
  1871. /** 需要基础库: `2.29.0`
  1872. *
  1873. * wifi下使用移动网络发送请求 */
  1874. forceCellularNetwork?: boolean
  1875. /** HTTP Header,Header 中不能设置 Referer */
  1876. header?: IAnyObject
  1877. /** 需要基础库: `2.8.0`
  1878. *
  1879. * 是否开启压缩扩展 */
  1880. perMessageDeflate?: boolean
  1881. /** 需要基础库: `1.4.0`
  1882. *
  1883. * 子协议数组 */
  1884. protocols?: string[]
  1885. /** 接口调用成功的回调函数 */
  1886. success?: ConnectSocketSuccessCallback
  1887. /** 需要基础库: `2.4.0`
  1888. *
  1889. * 建立 TCP 连接的时候的 TCP_NODELAY 设置 */
  1890. tcpNoDelay?: boolean
  1891. /** 需要基础库: `2.10.0`
  1892. *
  1893. * 超时时间,单位为毫秒 */
  1894. timeout?: number
  1895. }
  1896. interface ConnectWifiOption {
  1897. /** Wi-Fi 设备 SSID */
  1898. SSID: string
  1899. /** Wi-Fi 设备密码 */
  1900. password: string
  1901. /** Wi-Fi 设备 BSSID */
  1902. BSSID?: string
  1903. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1904. complete?: ConnectWifiCompleteCallback
  1905. /** 接口调用失败的回调函数 */
  1906. fail?: ConnectWifiFailCallback
  1907. /** 需要基础库: `2.12.0`
  1908. *
  1909. * 跳转到系统设置页进行连接 */
  1910. maunal?: boolean
  1911. /** 需要基础库: `2.22.0`
  1912. *
  1913. * 是否需要返回部分 Wi-Fi 信息,仅安卓生效 */
  1914. partialInfo?: boolean
  1915. /** 接口调用成功的回调函数 */
  1916. success?: ConnectWifiSuccessCallback
  1917. }
  1918. /** 一个字典对象,它指定是否应该禁用规范化(默认启用规范化) */
  1919. interface Constraints {
  1920. /** 如果指定为true则禁用标准化,默认为false */
  1921. disableNormalization?: boolean
  1922. }
  1923. interface ContextCallbackResult {
  1924. /** 节点对应的 Context 对象 */
  1925. context: IAnyObject
  1926. }
  1927. interface CopyFileFailCallbackResult {
  1928. /** 错误信息
  1929. *
  1930. * 可选值:
  1931. * - 'fail permission denied, copyFile ${srcPath} -> ${destPath}': 指定目标文件路径没有写权限;
  1932. * - 'fail no such file or directory, copyFile ${srcPath} -> ${destPath}': 源文件不存在,或目标文件路径的上层目录不存在;
  1933. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  1934. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  1935. errMsg: string
  1936. }
  1937. interface CopyFileOption {
  1938. /** 目标文件路径,支持本地路径 */
  1939. destPath: string
  1940. /** 源文件路径,支持本地路径 */
  1941. srcPath: string
  1942. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1943. complete?: CopyFileCompleteCallback
  1944. /** 接口调用失败的回调函数 */
  1945. fail?: CopyFileFailCallback
  1946. /** 接口调用成功的回调函数 */
  1947. success?: CopyFileSuccessCallback
  1948. }
  1949. interface CreateBLEConnectionOption {
  1950. /** 蓝牙设备 id */
  1951. deviceId: string
  1952. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1953. complete?: CreateBLEConnectionCompleteCallback
  1954. /** 接口调用失败的回调函数 */
  1955. fail?: CreateBLEConnectionFailCallback
  1956. /** 接口调用成功的回调函数 */
  1957. success?: CreateBLEConnectionSuccessCallback
  1958. /** 超时时间,单位 ms,不填表示不会超时 */
  1959. timeout?: number
  1960. }
  1961. interface CreateBLEPeripheralServerOption {
  1962. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1963. complete?: CreateBLEPeripheralServerCompleteCallback
  1964. /** 接口调用失败的回调函数 */
  1965. fail?: CreateBLEPeripheralServerFailCallback
  1966. /** 接口调用成功的回调函数 */
  1967. success?: CreateBLEPeripheralServerSuccessCallback
  1968. }
  1969. interface CreateBLEPeripheralServerSuccessCallbackResult {
  1970. /** [BLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.html)
  1971. *
  1972. * 外围设备的服务端。 */
  1973. server: BLEPeripheralServer
  1974. errMsg: string
  1975. }
  1976. interface CreateCacheManagerOption {
  1977. /** 额外的缓存处理 */
  1978. extra?: ExtraOption
  1979. /** 全局缓存有效时间,单位为毫秒,默认为 7 天,最长不超过 30 天 */
  1980. maxAge?: number
  1981. /** 缓存模式
  1982. *
  1983. * 可选值:
  1984. * - 'weakNetwork': 弱网/离线使用缓存返回;
  1985. * - 'always': 总是使用缓存返回;
  1986. * - 'none': 不开启,后续可手动开启/停止使用缓存返回; */
  1987. mode?: 'weakNetwork' | 'always' | 'none'
  1988. /** 全局 origin */
  1989. origin?: string
  1990. }
  1991. interface CreateInnerAudioContextOption {
  1992. /** 需要基础库: `2.19.0`
  1993. *
  1994. * 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项。 */
  1995. useWebAudioImplement?: boolean
  1996. }
  1997. /** 选项 */
  1998. interface CreateIntersectionObserverOption {
  1999. /** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */
  2000. initialRatio?: number
  2001. /** 需要基础库: `2.0.0`
  2002. *
  2003. * 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能) */
  2004. observeAll?: boolean
  2005. /** 一个数值数组,包含所有阈值。 */
  2006. thresholds?: number[]
  2007. }
  2008. interface CreateInterstitialAdOption {
  2009. /** 广告单元 id */
  2010. adUnitId: string
  2011. }
  2012. interface CreateMediaRecorderOption {
  2013. /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5 */
  2014. duration?: number
  2015. /** 视频 fps */
  2016. fps?: number
  2017. /** 视频关键帧间隔 */
  2018. gop?: number
  2019. /** 视频比特率(kbps),最小值 600,最大值 3000 */
  2020. videoBitsPerSecond?: number
  2021. }
  2022. interface CreateOffscreenCanvasOption {
  2023. /** 在自定义组件下,当前组件实例的 this */
  2024. compInst?: Component.TrivialInstance | Page.TrivialInstance
  2025. /** 画布高度 */
  2026. height?: number
  2027. /** 创建的离屏 canvas 类型
  2028. *
  2029. * 可选值:
  2030. * - 'webgl': webgl类型上下文;
  2031. * - '2d': 2d类型上下文; */
  2032. type?: 'webgl' | '2d'
  2033. /** 画布宽度 */
  2034. width?: number
  2035. }
  2036. interface CreateRewardedVideoAdOption {
  2037. /** 广告单元 id */
  2038. adUnitId: string
  2039. /** 需要基础库: `2.8.0`
  2040. *
  2041. * 是否启用多例模式,默认为false */
  2042. multiton?: boolean
  2043. }
  2044. /** 可选参数 */
  2045. interface CreateWorkerOption {
  2046. /** 需要基础库: `2.13.0`
  2047. *
  2048. * 是否使用实验worker。在iOS下,实验worker的JS运行效率比非实验worker提升数倍,如需在worker内进行重度计算的建议开启此选项。同时,实验worker存在极小概率会在系统资源紧张时被系统回收,因此建议配合 worker.onProcessKilled 事件使用,在worker被回收后可重新创建一个。 */
  2049. useExperimentalWorker?: boolean
  2050. }
  2051. interface CropImageOption {
  2052. /** 裁剪比例
  2053. *
  2054. * 可选值:
  2055. * - '16:9': 宽高比为16比9;
  2056. * - '9:16': 宽高比为9比16;
  2057. * - '4:3': 宽高比为4比3;
  2058. * - '3:4': 宽高比为3比4;
  2059. * - '5:4': 宽高比为5比4;
  2060. * - '4:5': 宽高比为4比5;
  2061. * - '1:1': 宽高比为1比1; */
  2062. cropScale: '16:9' | '9:16' | '4:3' | '3:4' | '5:4' | '4:5' | '1:1'
  2063. /** 图片路径,图片的路径,支持本地路径、代码包路径 */
  2064. src: string
  2065. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2066. complete?: CropImageCompleteCallback
  2067. /** 接口调用失败的回调函数 */
  2068. fail?: CropImageFailCallback
  2069. /** 接口调用成功的回调函数 */
  2070. success?: CropImageSuccessCallback
  2071. }
  2072. interface CurrentState {
  2073. /** 当前缓存中的日志条数 */
  2074. logCount: number
  2075. /** 当前缓存中最大可存日志条数 */
  2076. maxLogCount: number
  2077. /** 当前缓存最大可用空间,以字节为单位 */
  2078. maxSize: number
  2079. /** 当前缓存中已使用空间,以字节为单位 */
  2080. size: number
  2081. }
  2082. /** 弹幕内容 */
  2083. interface Danmu {
  2084. /** 弹幕文字 */
  2085. text: string
  2086. /** 弹幕颜色 */
  2087. color?: string
  2088. }
  2089. /** 动画配置 */
  2090. interface DecayOption {
  2091. /** 动画边界 */
  2092. clamp?: any[]
  2093. /** 衰减速率 */
  2094. deceleration?: number
  2095. /** 初速度 */
  2096. velocity?: number
  2097. /** 修正系数 */
  2098. velocityFactor?: number
  2099. }
  2100. /** 可选的字体描述符 */
  2101. interface DescOption {
  2102. /** 字体样式,可选值为 normal / italic / oblique */
  2103. style?: string
  2104. /** 设置小型大写字母的字体显示文本,可选值为 normal / small-caps / inherit */
  2105. variant?: string
  2106. /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */
  2107. weight?: string
  2108. }
  2109. /** 描述符的权限 */
  2110. interface DescriptorPermission {
  2111. /** 读 */
  2112. read?: boolean
  2113. /** 写 */
  2114. write?: boolean
  2115. }
  2116. /** 指定 marker 移动到的目标点 */
  2117. interface DestinationOption {
  2118. /** 纬度 */
  2119. latitude: number
  2120. /** 经度 */
  2121. longitude: number
  2122. }
  2123. interface DetectBodyOption {
  2124. /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
  2125. frameBuffer: ArrayBuffer
  2126. /** 图像高度 */
  2127. height: number
  2128. /** 图像宽度 */
  2129. width: number
  2130. /** 评分阈值。正常情况传入 0.8 即可。 */
  2131. scoreThreshold?: number
  2132. /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果
  2133. *
  2134. * 可选值:
  2135. * - 1: 表示输入的图片是随机的图片;
  2136. * - 0: 表示输入的图片是来自一个连续视频的每一帧图像; */
  2137. sourceType?: 1 | 0
  2138. }
  2139. interface DetectFaceOption {
  2140. /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
  2141. frameBuffer: ArrayBuffer
  2142. /** 图像高度 */
  2143. height: number
  2144. /** 图像宽度 */
  2145. width: number
  2146. /** 算法模型类型。正常情况传入 1 即可。0、1、2 分别表示小、中、大模型,模型越大识别准确率越高,但资源占用也越高。建议根据用户设备性能进行选择。
  2147. *
  2148. * 可选值:
  2149. * - 0: 小模型;
  2150. * - 1: 中模型;
  2151. * - 2: 大模型; */
  2152. modelModel?: 0 | 1 | 2
  2153. /** 评分阈值。正常情况传入 0.8 即可。 */
  2154. scoreThreshold?: number
  2155. /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果
  2156. *
  2157. * 可选值:
  2158. * - 1: 表示输入的图片是随机的图片;
  2159. * - 0: 表示输入的图片是来自一个连续视频的每一帧图像; */
  2160. sourceType?: 1 | 0
  2161. }
  2162. interface DetectHandOption {
  2163. /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
  2164. frameBuffer: ArrayBuffer
  2165. /** 图像高度 */
  2166. height: number
  2167. /** 图像宽度 */
  2168. width: number
  2169. /** 算法检测模式
  2170. *
  2171. * 可选值:
  2172. * - 0: 检测模式,输出框和点;
  2173. * - 1: 手势模式,输出框和手势分类;
  2174. * - 2: 结合0和1模式,输出框、点、手势分类; */
  2175. algoMode?: 0 | 1 | 2
  2176. /** 评分阈值。正常情况传入 0.8 即可。 */
  2177. scoreThreshold?: number
  2178. }
  2179. interface DeviceInfo {
  2180. /** 需要基础库: `2.29.0`
  2181. *
  2182. * 设备 CPU 型号(仅 Android 支持) */
  2183. CPUType: string
  2184. /** 应用(微信APP)二进制接口类型(仅 Android 支持) */
  2185. abi: string
  2186. /** 设备性能等级(仅 Android 支持)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
  2187. benchmarkLevel: number
  2188. /** 设备品牌 */
  2189. brand: string
  2190. /** 需要基础库: `2.25.1`
  2191. *
  2192. * 设备二进制接口类型(仅 Android 支持) */
  2193. deviceAbi: string
  2194. /** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */
  2195. model: string
  2196. /** 客户端平台 */
  2197. platform: string
  2198. /** 操作系统及版本 */
  2199. system: string
  2200. }
  2201. interface DisableAlertBeforeUnloadOption {
  2202. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2203. complete?: DisableAlertBeforeUnloadCompleteCallback
  2204. /** 接口调用失败的回调函数 */
  2205. fail?: DisableAlertBeforeUnloadFailCallback
  2206. /** 接口调用成功的回调函数 */
  2207. success?: DisableAlertBeforeUnloadSuccessCallback
  2208. }
  2209. interface DownloadFileOption {
  2210. /** 下载资源的 url */
  2211. url: string
  2212. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2213. complete?: DownloadFileCompleteCallback
  2214. /** 接口调用失败的回调函数 */
  2215. fail?: DownloadFileFailCallback
  2216. /** 需要基础库: `1.8.0`
  2217. *
  2218. * 指定文件下载后存储的路径 (本地路径) */
  2219. filePath?: string
  2220. /** HTTP 请求的 Header,Header 中不能设置 Referer */
  2221. header?: IAnyObject
  2222. /** 接口调用成功的回调函数 */
  2223. success?: DownloadFileSuccessCallback
  2224. /** 需要基础库: `2.10.0`
  2225. *
  2226. * 超时时间,单位为毫秒 */
  2227. timeout?: number
  2228. }
  2229. interface DownloadFileSuccessCallbackResult {
  2230. /** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */
  2231. filePath: string
  2232. /** 需要基础库: `2.10.4`
  2233. *
  2234. * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html) */
  2235. profile: RequestProfile
  2236. /** 开发者服务器返回的 HTTP 状态码 */
  2237. statusCode: number
  2238. /** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
  2239. tempFilePath: string
  2240. errMsg: string
  2241. }
  2242. interface DownloadTaskOnProgressUpdateListenerResult {
  2243. /** 下载进度百分比 */
  2244. progress: number
  2245. /** 预期需要下载的数据总长度,单位 Bytes */
  2246. totalBytesExpectedToWrite: number
  2247. /** 已经下载的数据长度,单位 Bytes */
  2248. totalBytesWritten: number
  2249. }
  2250. interface EditImageOption {
  2251. /** 图片路径,图片的路径,支持本地路径、代码包路径 */
  2252. src: string
  2253. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2254. complete?: EditImageCompleteCallback
  2255. /** 接口调用失败的回调函数 */
  2256. fail?: EditImageFailCallback
  2257. /** 接口调用成功的回调函数 */
  2258. success?: EditImageSuccessCallback
  2259. }
  2260. interface EditImageSuccessCallbackResult {
  2261. /** 编辑后图片的临时文件路径 (本地路径) */
  2262. tempFilePath: string
  2263. errMsg: string
  2264. }
  2265. interface EnableAlertBeforeUnloadOption {
  2266. /** 询问对话框内容 */
  2267. message: string
  2268. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2269. complete?: EnableAlertBeforeUnloadCompleteCallback
  2270. /** 接口调用失败的回调函数 */
  2271. fail?: EnableAlertBeforeUnloadFailCallback
  2272. /** 接口调用成功的回调函数 */
  2273. success?: EnableAlertBeforeUnloadSuccessCallback
  2274. }
  2275. /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */
  2276. interface EntriesResult {
  2277. /** 文件路径 */
  2278. [path: string]: ZipFileItem
  2279. }
  2280. /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */
  2281. interface EntryItem {
  2282. /** 压缩包内文件路径 */
  2283. path: string
  2284. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  2285. *
  2286. * 可选值:
  2287. * - 'ascii': ;
  2288. * - 'base64': ;
  2289. * - 'binary': ;
  2290. * - 'hex': ;
  2291. * - 'ucs2': 以小端序读取;
  2292. * - 'ucs-2': 以小端序读取;
  2293. * - 'utf16le': 以小端序读取;
  2294. * - 'utf-16le': 以小端序读取;
  2295. * - 'utf-8': ;
  2296. * - 'utf8': ;
  2297. * - 'latin1': ; */
  2298. encoding?:
  2299. | 'ascii'
  2300. | 'base64'
  2301. | 'binary'
  2302. | 'hex'
  2303. | 'ucs2'
  2304. | 'ucs-2'
  2305. | 'utf16le'
  2306. | 'utf-16le'
  2307. | 'utf-8'
  2308. | 'utf8'
  2309. | 'latin1'
  2310. /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
  2311. length?: number
  2312. /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
  2313. position?: number
  2314. }
  2315. interface Err {
  2316. /** 错误信息 */
  2317. errMsg: string
  2318. /** 需要基础库: `2.24.0`
  2319. *
  2320. * errno 错误码,错误码的详细说明参考 [Errno错误码](https://developers.weixin.qq.com/miniprogram/dev/framework/usability/PublicErrno.html) */
  2321. errno: number
  2322. }
  2323. interface ExecuteVisualLayerCommandOption {
  2324. /** 图层指令 */
  2325. command: string
  2326. /** 可视化图层id */
  2327. layerId: string
  2328. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2329. complete?: ExecuteVisualLayerCommandCompleteCallback
  2330. /** 接口调用失败的回调函数 */
  2331. fail?: ExecuteVisualLayerCommandFailCallback
  2332. /** 接口调用成功的回调函数 */
  2333. success?: ExecuteVisualLayerCommandSuccessCallback
  2334. }
  2335. interface ExecuteVisualLayerCommandSuccessCallbackResult {
  2336. /** SDK 返回的 JSON 数据 */
  2337. data: string
  2338. /** 调用结果 */
  2339. errMsg: string
  2340. }
  2341. interface ExitFullScreenOption {
  2342. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2343. complete?: ExitFullScreenCompleteCallback
  2344. /** 接口调用失败的回调函数 */
  2345. fail?: ExitFullScreenFailCallback
  2346. /** 接口调用成功的回调函数 */
  2347. success?: ExitFullScreenSuccessCallback
  2348. }
  2349. interface ExitMiniProgramOption {
  2350. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2351. complete?: ExitMiniProgramCompleteCallback
  2352. /** 接口调用失败的回调函数 */
  2353. fail?: ExitMiniProgramFailCallback
  2354. /** 接口调用成功的回调函数 */
  2355. success?: ExitMiniProgramSuccessCallback
  2356. }
  2357. interface ExitPictureInPictureOption {
  2358. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2359. complete?: ExitPictureInPictureCompleteCallback
  2360. /** 接口调用失败的回调函数 */
  2361. fail?: ExitPictureInPictureFailCallback
  2362. /** 接口调用成功的回调函数 */
  2363. success?: ExitPictureInPictureSuccessCallback
  2364. }
  2365. interface ExitVoIPChatOption {
  2366. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2367. complete?: ExitVoIPChatCompleteCallback
  2368. /** 接口调用失败的回调函数 */
  2369. fail?: ExitVoIPChatFailCallback
  2370. /** 接口调用成功的回调函数 */
  2371. success?: ExitVoIPChatSuccessCallback
  2372. }
  2373. /** 客服信息 */
  2374. interface ExtInfoOption {
  2375. /** 客服链接 */
  2376. url: string
  2377. }
  2378. /** 额外的缓存处理 */
  2379. interface ExtraOption {
  2380. /** 需要缓存的 wx api 接口,不传则表示支持缓存的接口全都做缓存处理。返回的如果是缓存数据,开发者可通过 fromCache 标记区分
  2381. *
  2382. * 可选值:
  2383. * - 'wx.login': ;
  2384. * - 'wx.checkSession': ;
  2385. * - 'wx.getSetting': ; */
  2386. apiList?: Array<'wx.login' | 'wx.checkSession' | 'wx.getSetting'>
  2387. }
  2388. interface ExtractDataSourceOption {
  2389. /** 视频源地址,只支持本地文件 */
  2390. source: string
  2391. }
  2392. /** 人脸角度信息,取值范围 [-1, 1],数值越接近 0 表示越正对摄像头 */
  2393. interface FaceAngel {
  2394. /** 仰俯角(点头) */
  2395. pitch: number
  2396. /** 翻滚角(左右倾) */
  2397. roll: number
  2398. /** 偏航角(摇头) */
  2399. yaw: number
  2400. }
  2401. /** 人脸置信度,取值范围 [0, 1],数值越大置信度越高(遮挡越少) */
  2402. interface FaceConf {
  2403. /** 整体可信度 */
  2404. global: number
  2405. /** 左眼可信度 */
  2406. leftEye: number
  2407. /** 嘴巴可信度 */
  2408. mouth: number
  2409. /** 鼻子可信度 */
  2410. nose: number
  2411. /** 右眼可信度 */
  2412. rightEye: number
  2413. }
  2414. interface FaceDetectOption {
  2415. /** 图像像素点数据,每四项表示一个像素点的 RGBA */
  2416. frameBuffer: ArrayBuffer
  2417. /** 图像高度 */
  2418. height: number
  2419. /** 图像宽度 */
  2420. width: number
  2421. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2422. complete?: FaceDetectCompleteCallback
  2423. /** 是否返回当前图像的人脸角度信息 */
  2424. enableAngle?: boolean
  2425. /** 是否返回当前图像的人脸的置信度(可表示器官遮挡情况) */
  2426. enableConf?: boolean
  2427. /** 是否返回多张人脸的信息 */
  2428. enableMultiFace?: boolean
  2429. /** 是否返回当前图像的人脸(106 个点) */
  2430. enablePoint?: boolean
  2431. /** 接口调用失败的回调函数 */
  2432. fail?: FaceDetectFailCallback
  2433. /** 接口调用成功的回调函数 */
  2434. success?: FaceDetectSuccessCallback
  2435. }
  2436. interface FaceDetectSuccessCallbackResult {
  2437. /** 人脸角度信息,取值范围 [-1, 1],数值越接近 0 表示越正对摄像头 */
  2438. angleArray: FaceAngel
  2439. /** 人脸置信度,取值范围 [0, 1],数值越大置信度越高(遮挡越少) */
  2440. confArray: FaceConf
  2441. /** 脸部方框数值,对象包含 height, weight, originX, originY 四个属性 (origin 为方框左上角坐标) */
  2442. detectRect: IAnyObject
  2443. /** 多人模式(enableMultiFace)下的人脸信息,每个对象包含上述其它属性 */
  2444. faceInfo: IAnyObject[]
  2445. /** 标记人脸轮廓的 106 个点位置数组,数组每个对象包含 x 和 y */
  2446. pointArray: IAnyObject[]
  2447. /** 脸部中心点横坐标,检测不到人脸则为 -1 */
  2448. x: number
  2449. /** 脸部中心点纵坐标,检测不到人脸则为 -1 */
  2450. y: number
  2451. errMsg: string
  2452. }
  2453. /** 需要基础库: `2.25.0`
  2454. *
  2455. * 人脸检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。 */
  2456. interface FaceTrack {
  2457. /** 需要基础库: `2.25.0`
  2458. *
  2459. * 人脸检测模式
  2460. *
  2461. * 可选值:
  2462. * - 1: 通过摄像头实时检测;
  2463. * - 2: 静态图片检测; */
  2464. mode: 1 | 2
  2465. }
  2466. interface Fields {
  2467. /** 需要基础库: `2.1.0`
  2468. *
  2469. * 指定样式名列表,返回节点对应样式名的当前值 */
  2470. computedStyle?: string[]
  2471. /** 需要基础库: `2.4.2`
  2472. *
  2473. * 是否返回节点对应的 Context 对象 */
  2474. context?: boolean
  2475. /** 是否返回节点 dataset */
  2476. dataset?: boolean
  2477. /** 是否返回节点 id */
  2478. id?: boolean
  2479. /** 是否返回节点 mark */
  2480. mark?: boolean
  2481. /** 需要基础库: `2.7.0`
  2482. *
  2483. * 是否返回节点对应的 Node 实例 */
  2484. node?: boolean
  2485. /** 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) */
  2486. properties?: string[]
  2487. /** 是否返回节点布局位置(`left` `right` `top` `bottom`) */
  2488. rect?: boolean
  2489. /** 否 是否返回节点的 `scrollLeft` `scrollTop`,节点必须是 `scroll-view` 或者 `viewport` */
  2490. scrollOffset?: boolean
  2491. /** 是否返回节点尺寸(`width` `height`) */
  2492. size?: boolean
  2493. }
  2494. /** 文件数组 */
  2495. interface FileItem {
  2496. /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */
  2497. createTime: number
  2498. /** 文件路径 (本地路径) */
  2499. filePath: string
  2500. /** 本地文件大小,以字节为单位 */
  2501. size: number
  2502. }
  2503. interface FileSystemManagerCloseOption {
  2504. /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  2505. fd: string
  2506. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2507. complete?: FileSystemManagerCloseCompleteCallback
  2508. /** 接口调用失败的回调函数 */
  2509. fail?: FileSystemManagerCloseFailCallback
  2510. /** 接口调用成功的回调函数 */
  2511. success?: FileSystemManagerCloseSuccessCallback
  2512. }
  2513. /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
  2514. interface ForwardMaterials {
  2515. /** 文件名 */
  2516. name: string
  2517. /** 文件路径(如果是webview则是url) */
  2518. path: string
  2519. /** 文件大小 */
  2520. size: number
  2521. /** 文件的mimetype类型 */
  2522. type: string
  2523. }
  2524. /** 视频帧数据,若取不到则返回 null。当缓冲区为空的时候可能暂停取不到数据。 */
  2525. interface FrameDataOptions {
  2526. /** 帧数据 */
  2527. data: ArrayBuffer
  2528. /** 帧数据高度 */
  2529. height: number
  2530. /** 帧原始 dts */
  2531. pkDts: number
  2532. /** 帧原始 pts */
  2533. pkPts: number
  2534. /** 帧数据宽度 */
  2535. width: number
  2536. }
  2537. interface FromScreenLocationOption {
  2538. /** x 坐标值 */
  2539. x: number
  2540. /** y 坐标值 */
  2541. y: number
  2542. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2543. complete?: FromScreenLocationCompleteCallback
  2544. /** 接口调用失败的回调函数 */
  2545. fail?: FromScreenLocationFailCallback
  2546. /** 接口调用成功的回调函数 */
  2547. success?: FromScreenLocationSuccessCallback
  2548. }
  2549. interface FstatFailCallbackResult {
  2550. /** 错误信息
  2551. *
  2552. * 可选值:
  2553. * - 'bad file descriptor': 无效的文件描述符;
  2554. * - 'fail permission denied': 指定的 fd 路径没有读权限; */
  2555. errMsg: string
  2556. }
  2557. interface FstatOption {
  2558. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  2559. fd: string
  2560. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2561. complete?: FstatCompleteCallback
  2562. /** 接口调用失败的回调函数 */
  2563. fail?: FstatFailCallback
  2564. /** 接口调用成功的回调函数 */
  2565. success?: FstatSuccessCallback
  2566. }
  2567. interface FstatSuccessCallbackResult {
  2568. /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)
  2569. *
  2570. * Stats 对象,包含了文件的状态信息 */
  2571. stats: Stats
  2572. errMsg: string
  2573. }
  2574. interface FstatSyncOption {
  2575. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  2576. fd: string
  2577. }
  2578. interface FtruncateFailCallbackResult {
  2579. /** 错误信息
  2580. *
  2581. * 可选值:
  2582. * - 'bad file descriptor': 无效的文件描述符;
  2583. * - 'fail permission denied': 指定的 fd 没有写权限;
  2584. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  2585. * - 'fail sdcard not mounted': android sdcard 挂载失败; */
  2586. errMsg: string
  2587. }
  2588. interface FtruncateOption {
  2589. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  2590. fd: string
  2591. /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  2592. length: number
  2593. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2594. complete?: FtruncateCompleteCallback
  2595. /** 接口调用失败的回调函数 */
  2596. fail?: FtruncateFailCallback
  2597. /** 接口调用成功的回调函数 */
  2598. success?: FtruncateSuccessCallback
  2599. }
  2600. interface FtruncateSyncOption {
  2601. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  2602. fd: string
  2603. /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  2604. length: number
  2605. }
  2606. interface GeneralCallbackResult {
  2607. /** 错误信息 */
  2608. errMsg: string
  2609. }
  2610. interface GetAtqaOption {
  2611. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2612. complete?: GetAtqaCompleteCallback
  2613. /** 接口调用失败的回调函数 */
  2614. fail?: GetAtqaFailCallback
  2615. /** 接口调用成功的回调函数 */
  2616. success?: GetAtqaSuccessCallback
  2617. }
  2618. interface GetAtqaSuccessCallbackResult {
  2619. /** 返回 ATQA/SENS_RES 数据 */
  2620. atqa: ArrayBuffer
  2621. errMsg: string
  2622. }
  2623. interface GetAvailableAudioSourcesOption {
  2624. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2625. complete?: GetAvailableAudioSourcesCompleteCallback
  2626. /** 接口调用失败的回调函数 */
  2627. fail?: GetAvailableAudioSourcesFailCallback
  2628. /** 接口调用成功的回调函数 */
  2629. success?: GetAvailableAudioSourcesSuccessCallback
  2630. }
  2631. interface GetAvailableAudioSourcesSuccessCallbackResult {
  2632. /** 支持的音频输入源列表,可在 [RecorderManager.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html) 接口中使用。返回值定义参考 https://developer.android.com/reference/kotlin/android/media/MediaRecorder.AudioSource
  2633. *
  2634. * 可选值:
  2635. * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用;
  2636. * - 'buildInMic': 手机麦克风,仅限 iOS;
  2637. * - 'headsetMic': 耳机麦克风,仅限 iOS;
  2638. * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android;
  2639. * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android;
  2640. * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android;
  2641. * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */
  2642. audioSources: Array<
  2643. | 'auto'
  2644. | 'buildInMic'
  2645. | 'headsetMic'
  2646. | 'mic'
  2647. | 'camcorder'
  2648. | 'voice_communication'
  2649. | 'voice_recognition'
  2650. >
  2651. errMsg: string
  2652. }
  2653. interface GetBLEDeviceCharacteristicsOption {
  2654. /** 蓝牙设备 id。需要已经通过 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 建立连接 */
  2655. deviceId: string
  2656. /** 蓝牙服务 UUID。需要先调用 [wx.getBLEDeviceServices](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html) 获取 */
  2657. serviceId: string
  2658. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2659. complete?: GetBLEDeviceCharacteristicsCompleteCallback
  2660. /** 接口调用失败的回调函数 */
  2661. fail?: GetBLEDeviceCharacteristicsFailCallback
  2662. /** 接口调用成功的回调函数 */
  2663. success?: GetBLEDeviceCharacteristicsSuccessCallback
  2664. }
  2665. interface GetBLEDeviceCharacteristicsSuccessCallbackResult {
  2666. /** 设备特征列表 */
  2667. characteristics: BLECharacteristic[]
  2668. errMsg: string
  2669. }
  2670. interface GetBLEDeviceRSSIOption {
  2671. /** 蓝牙设备 id */
  2672. deviceId: string
  2673. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2674. complete?: GetBLEDeviceRSSICompleteCallback
  2675. /** 接口调用失败的回调函数 */
  2676. fail?: GetBLEDeviceRSSIFailCallback
  2677. /** 接口调用成功的回调函数 */
  2678. success?: GetBLEDeviceRSSISuccessCallback
  2679. }
  2680. interface GetBLEDeviceRSSISuccessCallbackResult {
  2681. /** 信号强度,单位 dBm */
  2682. RSSI: number
  2683. errMsg: string
  2684. }
  2685. interface GetBLEDeviceServicesOption {
  2686. /** 蓝牙设备 id。需要已经通过 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 建立连接 */
  2687. deviceId: string
  2688. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2689. complete?: GetBLEDeviceServicesCompleteCallback
  2690. /** 接口调用失败的回调函数 */
  2691. fail?: GetBLEDeviceServicesFailCallback
  2692. /** 接口调用成功的回调函数 */
  2693. success?: GetBLEDeviceServicesSuccessCallback
  2694. }
  2695. interface GetBLEDeviceServicesSuccessCallbackResult {
  2696. /** 设备服务列表 */
  2697. services: BLEService[]
  2698. errMsg: string
  2699. }
  2700. interface GetBLEMTUOption {
  2701. /** 蓝牙设备 id */
  2702. deviceId: string
  2703. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2704. complete?: GetBLEMTUCompleteCallback
  2705. /** 接口调用失败的回调函数 */
  2706. fail?: GetBLEMTUFailCallback
  2707. /** 接口调用成功的回调函数 */
  2708. success?: GetBLEMTUSuccessCallback
  2709. /** 写模式 (iOS 特有参数)
  2710. *
  2711. * 可选值:
  2712. * - 'write': 有回复写;
  2713. * - 'writeNoResponse': 无回复写; */
  2714. writeType?: 'write' | 'writeNoResponse'
  2715. }
  2716. interface GetBLEMTUSuccessCallbackResult {
  2717. /** 最大传输单元 */
  2718. mtu: number
  2719. errMsg: string
  2720. }
  2721. interface GetBackgroundAudioPlayerStateOption {
  2722. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2723. complete?: GetBackgroundAudioPlayerStateCompleteCallback
  2724. /** 接口调用失败的回调函数 */
  2725. fail?: GetBackgroundAudioPlayerStateFailCallback
  2726. /** 接口调用成功的回调函数 */
  2727. success?: GetBackgroundAudioPlayerStateSuccessCallback
  2728. }
  2729. interface GetBackgroundAudioPlayerStateSuccessCallbackResult {
  2730. /** 选定音频的播放位置(单位:s),只有在音乐播放中时返回 */
  2731. currentPosition: number
  2732. /** 歌曲数据链接,只有在音乐播放中时返回 */
  2733. dataUrl: string
  2734. /** 音频的下载进度百分比,只有在音乐播放中时返回 */
  2735. downloadPercent: number
  2736. /** 选定音频的长度(单位:s),只有在音乐播放中时返回 */
  2737. duration: number
  2738. /** 播放状态
  2739. *
  2740. * 可选值:
  2741. * - 0: 暂停中;
  2742. * - 1: 播放中;
  2743. * - 2: 没有音乐播放; */
  2744. status: 0 | 1 | 2
  2745. errMsg: string
  2746. }
  2747. interface GetBackgroundFetchDataOption {
  2748. /** 缓存数据类别,取值为 periodic 或 pre */
  2749. fetchType: string
  2750. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2751. complete?: GetBackgroundFetchDataCompleteCallback
  2752. /** 接口调用失败的回调函数 */
  2753. fail?: GetBackgroundFetchDataFailCallback
  2754. /** 接口调用成功的回调函数 */
  2755. success?: GetBackgroundFetchDataSuccessCallback
  2756. }
  2757. interface GetBackgroundFetchDataSuccessCallbackResult {
  2758. /** 缓存数据 */
  2759. fetchedData: string
  2760. /** 小程序页面路径 */
  2761. path: string
  2762. /** 传给页面的 query 参数 */
  2763. query: string
  2764. /** 进入小程序的场景值 */
  2765. scene: number
  2766. /** 客户端拿到缓存数据的时间戳 ms。(iOS 时间戳存在异常,8.0.27 修复) */
  2767. timeStamp: number
  2768. errMsg: string
  2769. }
  2770. interface GetBackgroundFetchTokenOption {
  2771. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2772. complete?: GetBackgroundFetchTokenCompleteCallback
  2773. /** 接口调用失败的回调函数 */
  2774. fail?: GetBackgroundFetchTokenFailCallback
  2775. /** 接口调用成功的回调函数 */
  2776. success?: GetBackgroundFetchTokenSuccessCallback
  2777. }
  2778. interface GetBackgroundFetchTokenSuccessCallbackResult {
  2779. /** 接口调用结果 */
  2780. errMsg: string
  2781. /** 自定义的登录态 */
  2782. token: number
  2783. }
  2784. interface GetBatteryInfoOption {
  2785. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2786. complete?: GetBatteryInfoCompleteCallback
  2787. /** 接口调用失败的回调函数 */
  2788. fail?: GetBatteryInfoFailCallback
  2789. /** 接口调用成功的回调函数 */
  2790. success?: GetBatteryInfoSuccessCallback
  2791. }
  2792. interface GetBatteryInfoSuccessCallbackResult {
  2793. /** 是否正在充电中 */
  2794. isCharging: boolean
  2795. /** 设备电量,范围 1 - 100 */
  2796. level: number
  2797. errMsg: string
  2798. }
  2799. interface GetBatteryInfoSyncResult {
  2800. /** 是否正在充电中 */
  2801. isCharging: boolean
  2802. /** 设备电量,范围 1 - 100 */
  2803. level: number
  2804. }
  2805. interface GetBeaconsOption {
  2806. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2807. complete?: GetBeaconsCompleteCallback
  2808. /** 接口调用失败的回调函数 */
  2809. fail?: GetBeaconsFailCallback
  2810. /** 接口调用成功的回调函数 */
  2811. success?: GetBeaconsSuccessCallback
  2812. }
  2813. interface GetBeaconsSuccessCallbackResult {
  2814. /** Beacon 设备列表 */
  2815. beacons: BeaconInfo[]
  2816. errMsg: string
  2817. }
  2818. interface GetBluetoothAdapterStateOption {
  2819. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2820. complete?: GetBluetoothAdapterStateCompleteCallback
  2821. /** 接口调用失败的回调函数 */
  2822. fail?: GetBluetoothAdapterStateFailCallback
  2823. /** 接口调用成功的回调函数 */
  2824. success?: GetBluetoothAdapterStateSuccessCallback
  2825. }
  2826. interface GetBluetoothAdapterStateSuccessCallbackResult {
  2827. /** 蓝牙适配器是否可用 */
  2828. available: boolean
  2829. /** 是否正在搜索设备 */
  2830. discovering: boolean
  2831. errMsg: string
  2832. }
  2833. interface GetBluetoothDevicesOption {
  2834. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2835. complete?: GetBluetoothDevicesCompleteCallback
  2836. /** 接口调用失败的回调函数 */
  2837. fail?: GetBluetoothDevicesFailCallback
  2838. /** 接口调用成功的回调函数 */
  2839. success?: GetBluetoothDevicesSuccessCallback
  2840. }
  2841. interface GetBluetoothDevicesSuccessCallbackResult {
  2842. /** UUID 对应的已连接设备列表 */
  2843. devices: BlueToothDevice[]
  2844. errMsg: string
  2845. }
  2846. interface GetCenterLocationOption {
  2847. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2848. complete?: GetCenterLocationCompleteCallback
  2849. /** 接口调用失败的回调函数 */
  2850. fail?: GetCenterLocationFailCallback
  2851. /** 图标路径,支持网络路径、本地路径、代码包路径 */
  2852. iconPath?: string
  2853. /** 接口调用成功的回调函数 */
  2854. success?: GetCenterLocationSuccessCallback
  2855. }
  2856. interface GetCenterLocationSuccessCallbackResult {
  2857. /** 纬度 */
  2858. latitude: number
  2859. /** 经度 */
  2860. longitude: number
  2861. errMsg: string
  2862. }
  2863. interface GetChannelsLiveInfoOption {
  2864. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  2865. finderUserName: string
  2866. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2867. complete?: GetChannelsLiveInfoCompleteCallback
  2868. /** 需要基础库: `2.29.0`
  2869. *
  2870. * 结束时间,筛选指定时段的直播 */
  2871. endTime?: number
  2872. /** 接口调用失败的回调函数 */
  2873. fail?: GetChannelsLiveInfoFailCallback
  2874. /** 需要基础库: `2.29.0`
  2875. *
  2876. * 起始时间,筛选指定时段的直播 */
  2877. startTime?: number
  2878. /** 接口调用成功的回调函数 */
  2879. success?: GetChannelsLiveInfoSuccessCallback
  2880. }
  2881. interface GetChannelsLiveInfoSuccessCallbackResult {
  2882. /** 直播主题 */
  2883. description: string
  2884. /** 直播 feedId */
  2885. feedId: string
  2886. /** 视频号头像 */
  2887. headUrl: string
  2888. /** 视频号昵称 */
  2889. nickname: string
  2890. /** 直播 nonceId */
  2891. nonceId: string
  2892. /** 需要基础库: `2.29.0`
  2893. *
  2894. * 除最近的一条直播外,其他的直播列表(注意:每次最多返回按时间戳增序排列的15个直播信息,其中时间最近的那个直播会在接口其他的返回参数中展示,其余的直播会在该字段中展示)。 */
  2895. otherInfos: any[]
  2896. /** 需要基础库: `2.29.0`
  2897. *
  2898. * 视频号回放状态:0未生成,1已生成,3生成中,6已过期 */
  2899. replayStatus: string
  2900. /** 直播状态,2直播中,3直播结束 */
  2901. status: number
  2902. errMsg: string
  2903. }
  2904. interface GetChannelsLiveNoticeInfoOption {
  2905. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  2906. finderUserName: string
  2907. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2908. complete?: GetChannelsLiveNoticeInfoCompleteCallback
  2909. /** 接口调用失败的回调函数 */
  2910. fail?: GetChannelsLiveNoticeInfoFailCallback
  2911. /** 接口调用成功的回调函数 */
  2912. success?: GetChannelsLiveNoticeInfoSuccessCallback
  2913. }
  2914. interface GetChannelsLiveNoticeInfoSuccessCallbackResult {
  2915. /** 直播封面 */
  2916. headUrl: string
  2917. /** 视频号昵称 */
  2918. nickname: string
  2919. /** 预告 id */
  2920. noticeId: string
  2921. /** 需要基础库: `2.24.6`
  2922. *
  2923. * 除最近的一条预告信息外,其他的预告信息列表(注意:每次最多返回按时间戳增序排列的15个预告信息,其中时间最近的那个预告信息会在接口其他的返回参数中展示,其余的预告信息会在该字段中展示)。 */
  2924. otherInfos: any[]
  2925. /** 是否可预约 */
  2926. reservable: boolean
  2927. /** 开始时间 */
  2928. startTime: string
  2929. /** 预告状态:0可用 1取消 2已用 */
  2930. status: number
  2931. errMsg: string
  2932. }
  2933. interface GetChannelsShareKeyOption {
  2934. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2935. complete?: GetChannelsShareKeyCompleteCallback
  2936. /** 接口调用失败的回调函数 */
  2937. fail?: GetChannelsShareKeyFailCallback
  2938. /** 接口调用成功的回调函数 */
  2939. success?: GetChannelsShareKeySuccessCallback
  2940. }
  2941. interface GetChannelsShareKeySuccessCallbackResult {
  2942. /** 推广员 */
  2943. promoter: PromoterResult
  2944. /** 分享者 openid */
  2945. sharerOpenId: string
  2946. errMsg: string
  2947. }
  2948. interface GetClipboardDataOption {
  2949. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2950. complete?: GetClipboardDataCompleteCallback
  2951. /** 接口调用失败的回调函数 */
  2952. fail?: GetClipboardDataFailCallback
  2953. /** 接口调用成功的回调函数 */
  2954. success?: GetClipboardDataSuccessCallback
  2955. }
  2956. interface GetClipboardDataSuccessCallbackOption {
  2957. /** 剪贴板的内容 */
  2958. data: string
  2959. }
  2960. interface GetConnectedBluetoothDevicesOption {
  2961. /** 蓝牙设备主服务的 UUID 列表(支持 16/32/128 位 UUID) */
  2962. services: string[]
  2963. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2964. complete?: GetConnectedBluetoothDevicesCompleteCallback
  2965. /** 接口调用失败的回调函数 */
  2966. fail?: GetConnectedBluetoothDevicesFailCallback
  2967. /** 接口调用成功的回调函数 */
  2968. success?: GetConnectedBluetoothDevicesSuccessCallback
  2969. }
  2970. interface GetConnectedBluetoothDevicesSuccessCallbackResult {
  2971. /** 搜索到的设备列表 */
  2972. devices: BluetoothDeviceInfo[]
  2973. errMsg: string
  2974. }
  2975. interface GetConnectedWifiOption {
  2976. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2977. complete?: GetConnectedWifiCompleteCallback
  2978. /** 接口调用失败的回调函数 */
  2979. fail?: GetConnectedWifiFailCallback
  2980. /** 需要基础库: `2.22.0`
  2981. *
  2982. * 是否需要返回部分 Wi-Fi 信息 */
  2983. partialInfo?: boolean
  2984. /** 接口调用成功的回调函数 */
  2985. success?: GetConnectedWifiSuccessCallback
  2986. }
  2987. interface GetConnectedWifiSuccessCallbackResult {
  2988. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  2989. *
  2990. * Wi-Fi 信息 */
  2991. wifi: WifiInfo
  2992. errMsg: string
  2993. }
  2994. interface GetContentsOption {
  2995. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2996. complete?: GetContentsCompleteCallback
  2997. /** 接口调用失败的回调函数 */
  2998. fail?: GetContentsFailCallback
  2999. /** 接口调用成功的回调函数 */
  3000. success?: GetContentsSuccessCallback
  3001. }
  3002. interface GetContentsSuccessCallbackResult {
  3003. /** 表示内容的delta对象 */
  3004. delta: IAnyObject
  3005. /** 带标签的HTML内容 */
  3006. html: string
  3007. /** 纯文本内容 */
  3008. text: string
  3009. errMsg: string
  3010. }
  3011. interface GetExtConfigOption {
  3012. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3013. complete?: GetExtConfigCompleteCallback
  3014. /** 接口调用失败的回调函数 */
  3015. fail?: GetExtConfigFailCallback
  3016. /** 接口调用成功的回调函数 */
  3017. success?: GetExtConfigSuccessCallback
  3018. }
  3019. interface GetExtConfigSuccessCallbackResult {
  3020. /** 第三方平台自定义的数据 */
  3021. extConfig: IAnyObject
  3022. errMsg: string
  3023. }
  3024. interface GetFileInfoFailCallbackResult {
  3025. /** 错误信息
  3026. *
  3027. * 可选值:
  3028. * - 'fail file not exist': 指定的 filePath 找不到文件; */
  3029. errMsg: string
  3030. }
  3031. interface GetFileInfoOption {
  3032. /** 要读取的文件路径 (本地路径) */
  3033. filePath: string
  3034. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3035. complete?: GetFileInfoCompleteCallback
  3036. /** 接口调用失败的回调函数 */
  3037. fail?: GetFileInfoFailCallback
  3038. /** 接口调用成功的回调函数 */
  3039. success?: GetFileInfoSuccessCallback
  3040. }
  3041. interface GetFileInfoSuccessCallbackResult {
  3042. /** 文件大小,以字节为单位 */
  3043. size: number
  3044. errMsg: string
  3045. }
  3046. interface GetFuzzyLocationOption {
  3047. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3048. complete?: GetFuzzyLocationCompleteCallback
  3049. /** 接口调用失败的回调函数 */
  3050. fail?: GetFuzzyLocationFailCallback
  3051. /** 接口调用成功的回调函数 */
  3052. success?: GetFuzzyLocationSuccessCallback
  3053. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  3054. type?: string
  3055. }
  3056. interface GetFuzzyLocationSuccessCallbackResult {
  3057. /** 纬度,范围为 -90~90,负数表示南纬 */
  3058. latitude: number
  3059. /** 经度,范围为 -180~180,负数表示西经 */
  3060. longitude: number
  3061. errMsg: string
  3062. }
  3063. interface GetGroupEnterInfoOption {
  3064. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3065. complete?: GetGroupEnterInfoCompleteCallback
  3066. /** 接口调用失败的回调函数 */
  3067. fail?: GetGroupEnterInfoFailCallback
  3068. /** 接口调用成功的回调函数 */
  3069. success?: GetGroupEnterInfoSuccessCallback
  3070. }
  3071. interface GetGroupEnterInfoSuccessCallbackResult {
  3072. /** 需要基础库: `2.7.0`
  3073. *
  3074. * 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
  3075. cloudID: string
  3076. /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  3077. encryptedData: string
  3078. /** 错误信息 */
  3079. errMsg: string
  3080. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  3081. iv: string
  3082. }
  3083. interface GetHCEStateOption {
  3084. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3085. complete?: GetHCEStateCompleteCallback
  3086. /** 接口调用失败的回调函数 */
  3087. fail?: GetHCEStateFailCallback
  3088. /** 接口调用成功的回调函数 */
  3089. success?: GetHCEStateSuccessCallback
  3090. }
  3091. interface GetHistoricalBytesOption {
  3092. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3093. complete?: GetHistoricalBytesCompleteCallback
  3094. /** 接口调用失败的回调函数 */
  3095. fail?: GetHistoricalBytesFailCallback
  3096. /** 接口调用成功的回调函数 */
  3097. success?: GetHistoricalBytesSuccessCallback
  3098. }
  3099. interface GetHistoricalBytesSuccessCallbackResult {
  3100. /** 返回历史二进制数据 */
  3101. histBytes: ArrayBuffer
  3102. errMsg: string
  3103. }
  3104. interface GetImageInfoOption {
  3105. /** 图片的路径,支持网络路径、本地路径、代码包路径 */
  3106. src: string
  3107. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3108. complete?: GetImageInfoCompleteCallback
  3109. /** 接口调用失败的回调函数 */
  3110. fail?: GetImageInfoFailCallback
  3111. /** 接口调用成功的回调函数 */
  3112. success?: GetImageInfoSuccessCallback
  3113. }
  3114. interface GetImageInfoSuccessCallbackResult {
  3115. /** 图片原始高度,单位px。不考虑旋转。 */
  3116. height: number
  3117. /** 需要基础库: `1.9.90`
  3118. *
  3119. * [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
  3120. *
  3121. * 可选值:
  3122. * - 'up': 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。;
  3123. * - 'up-mirrored': 同 up,但镜像翻转,对应 Exif 中的 2;
  3124. * - 'down': 旋转180度,对应 Exif 中的 3;
  3125. * - 'down-mirrored': 同 down,但镜像翻转,对应 Exif 中的 4;
  3126. * - 'left-mirrored': 同 left,但镜像翻转,对应 Exif 中的 5;
  3127. * - 'right': 顺时针旋转90度,对应 Exif 中的 6;
  3128. * - 'right-mirrored': 同 right,但镜像翻转,对应 Exif 中的 7;
  3129. * - 'left': 逆时针旋转90度,对应 Exif 中的 8; */
  3130. orientation:
  3131. | 'up'
  3132. | 'up-mirrored'
  3133. | 'down'
  3134. | 'down-mirrored'
  3135. | 'left-mirrored'
  3136. | 'right'
  3137. | 'right-mirrored'
  3138. | 'left'
  3139. /** 图片的本地路径 */
  3140. path: string
  3141. /** 需要基础库: `1.9.90`
  3142. *
  3143. * 图片格式
  3144. *
  3145. * 可选值:
  3146. * - 'unknown': 未知格式;
  3147. * - 'jpeg': jpeg压缩格式;
  3148. * - 'png': png压缩格式;
  3149. * - 'gif': gif压缩格式;
  3150. * - 'tiff': tiff压缩格式; */
  3151. type: 'unknown' | 'jpeg' | 'png' | 'gif' | 'tiff'
  3152. /** 图片原始宽度,单位px。不考虑旋转。 */
  3153. width: number
  3154. errMsg: string
  3155. }
  3156. interface GetLatestUserKeyOption {
  3157. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3158. complete?: GetLatestUserKeyCompleteCallback
  3159. /** 接口调用失败的回调函数 */
  3160. fail?: GetLatestUserKeyFailCallback
  3161. /** 接口调用成功的回调函数 */
  3162. success?: GetLatestUserKeySuccessCallback
  3163. }
  3164. interface GetLatestUserKeySuccessCallbackResult {
  3165. /** 用户加密密钥 */
  3166. encryptKey: string
  3167. /** 密钥过期时间 */
  3168. expireTime: number
  3169. /** 密钥初始向量 */
  3170. iv: string
  3171. /** 密钥版本 */
  3172. version: number
  3173. errMsg: string
  3174. }
  3175. interface GetLocalIPAddressOption {
  3176. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3177. complete?: GetLocalIPAddressCompleteCallback
  3178. /** 接口调用失败的回调函数 */
  3179. fail?: GetLocalIPAddressFailCallback
  3180. /** 接口调用成功的回调函数 */
  3181. success?: GetLocalIPAddressSuccessCallback
  3182. }
  3183. interface GetLocalIPAddressSuccessCallbackResult {
  3184. /** 错误信息 */
  3185. errMsg: string
  3186. /** 本机局域网IP地址 */
  3187. localip: string
  3188. /** 本机局域网子网掩码,基础库 2.24.0 开始支持 */
  3189. netmask: string
  3190. }
  3191. interface GetLocationOption {
  3192. /** 需要基础库: `1.6.0`
  3193. *
  3194. * 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 */
  3195. altitude?: boolean
  3196. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3197. complete?: GetLocationCompleteCallback
  3198. /** 接口调用失败的回调函数 */
  3199. fail?: GetLocationFailCallback
  3200. /** 需要基础库: `2.9.0`
  3201. *
  3202. * 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
  3203. highAccuracyExpireTime?: number
  3204. /** 需要基础库: `2.9.0`
  3205. *
  3206. * 开启高精度定位 */
  3207. isHighAccuracy?: boolean
  3208. /** 接口调用成功的回调函数 */
  3209. success?: GetLocationSuccessCallback
  3210. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  3211. type?: string
  3212. }
  3213. interface GetLocationSuccessCallbackResult {
  3214. /** 位置的精确度,反应与真实位置之间的接近程度,可以理解成10即与真实位置相差10m,越小越精确 */
  3215. accuracy: number
  3216. /** 需要基础库: `1.2.0`
  3217. *
  3218. * 高度,单位 m */
  3219. altitude: number
  3220. /** 需要基础库: `1.2.0`
  3221. *
  3222. * 水平精度,单位 m */
  3223. horizontalAccuracy: number
  3224. /** 纬度,范围为 -90~90,负数表示南纬 */
  3225. latitude: number
  3226. /** 经度,范围为 -180~180,负数表示西经 */
  3227. longitude: number
  3228. /** 速度,单位 m/s */
  3229. speed: number
  3230. /** 需要基础库: `1.2.0`
  3231. *
  3232. * 垂直精度,单位 m(Android 无法获取,返回 0) */
  3233. verticalAccuracy: number
  3234. errMsg: string
  3235. }
  3236. interface GetLogManagerOption {
  3237. /** 需要基础库: `2.3.2`
  3238. *
  3239. * 取值为0/1,取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0 */
  3240. level?: number
  3241. }
  3242. interface GetMaxTransceiveLengthOption {
  3243. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3244. complete?: GetMaxTransceiveLengthCompleteCallback
  3245. /** 接口调用失败的回调函数 */
  3246. fail?: GetMaxTransceiveLengthFailCallback
  3247. /** 接口调用成功的回调函数 */
  3248. success?: GetMaxTransceiveLengthSuccessCallback
  3249. }
  3250. interface GetMaxTransceiveLengthSuccessCallbackResult {
  3251. /** 最大传输长度 */
  3252. length: number
  3253. errMsg: string
  3254. }
  3255. interface GetNetworkTypeOption {
  3256. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3257. complete?: GetNetworkTypeCompleteCallback
  3258. /** 接口调用失败的回调函数 */
  3259. fail?: GetNetworkTypeFailCallback
  3260. /** 接口调用成功的回调函数 */
  3261. success?: GetNetworkTypeSuccessCallback
  3262. }
  3263. interface GetNetworkTypeSuccessCallbackResult {
  3264. /** 需要基础库: `2.22.1`
  3265. *
  3266. * 设备是否使用了网络代理 */
  3267. hasSystemProxy: boolean
  3268. /** 网络类型
  3269. *
  3270. * 可选值:
  3271. * - 'wifi': wifi 网络;
  3272. * - '2g': 2g 网络;
  3273. * - '3g': 3g 网络;
  3274. * - '4g': 4g 网络;
  3275. * - '5g': 5g 网络;
  3276. * - 'unknown': Android 下不常见的网络类型;
  3277. * - 'none': 无网络; */
  3278. networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
  3279. /** 信号强弱,单位 dbm */
  3280. signalStrength: number
  3281. errMsg: string
  3282. }
  3283. interface GetRandomValuesOption {
  3284. /** 整数,生成随机数的字节数,最大 1048576 */
  3285. length: number
  3286. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3287. complete?: GetRandomValuesCompleteCallback
  3288. /** 接口调用失败的回调函数 */
  3289. fail?: GetRandomValuesFailCallback
  3290. /** 接口调用成功的回调函数 */
  3291. success?: GetRandomValuesSuccessCallback
  3292. }
  3293. interface GetRandomValuesSuccessCallbackResult {
  3294. /** 随机数内容,长度为传入的字节数 */
  3295. randomValues: ArrayBuffer
  3296. errMsg: string
  3297. }
  3298. interface GetRegionOption {
  3299. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3300. complete?: GetRegionCompleteCallback
  3301. /** 接口调用失败的回调函数 */
  3302. fail?: GetRegionFailCallback
  3303. /** 接口调用成功的回调函数 */
  3304. success?: GetRegionSuccessCallback
  3305. }
  3306. interface GetRegionSuccessCallbackResult {
  3307. /** 东北角经纬度 */
  3308. northeast: MapPostion
  3309. /** 西南角经纬度 */
  3310. southwest: MapPostion
  3311. errMsg: string
  3312. }
  3313. interface GetRotateOption {
  3314. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3315. complete?: GetRotateCompleteCallback
  3316. /** 接口调用失败的回调函数 */
  3317. fail?: GetRotateFailCallback
  3318. /** 接口调用成功的回调函数 */
  3319. success?: GetRotateSuccessCallback
  3320. }
  3321. interface GetRotateSuccessCallbackResult {
  3322. /** 旋转角 */
  3323. rotate: number
  3324. errMsg: string
  3325. }
  3326. interface GetSakOption {
  3327. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3328. complete?: GetSakCompleteCallback
  3329. /** 接口调用失败的回调函数 */
  3330. fail?: GetSakFailCallback
  3331. /** 接口调用成功的回调函数 */
  3332. success?: GetSakSuccessCallback
  3333. }
  3334. interface GetSakSuccessCallbackResult {
  3335. /** 返回 SAK/SEL_RES 数据 */
  3336. sak: number
  3337. errMsg: string
  3338. }
  3339. interface GetSavedFileListOption {
  3340. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3341. complete?: GetSavedFileListCompleteCallback
  3342. /** 接口调用失败的回调函数 */
  3343. fail?: GetSavedFileListFailCallback
  3344. /** 接口调用成功的回调函数 */
  3345. success?: GetSavedFileListSuccessCallback
  3346. }
  3347. interface GetSavedFileListSuccessCallbackResult {
  3348. /** 文件数组 */
  3349. fileList: FileItem[]
  3350. errMsg: string
  3351. }
  3352. interface GetScaleOption {
  3353. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3354. complete?: GetScaleCompleteCallback
  3355. /** 接口调用失败的回调函数 */
  3356. fail?: GetScaleFailCallback
  3357. /** 接口调用成功的回调函数 */
  3358. success?: GetScaleSuccessCallback
  3359. }
  3360. interface GetScaleSuccessCallbackResult {
  3361. /** 缩放值 */
  3362. scale: number
  3363. errMsg: string
  3364. }
  3365. interface GetScreenBrightnessOption {
  3366. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3367. complete?: GetScreenBrightnessCompleteCallback
  3368. /** 接口调用失败的回调函数 */
  3369. fail?: GetScreenBrightnessFailCallback
  3370. /** 接口调用成功的回调函数 */
  3371. success?: GetScreenBrightnessSuccessCallback
  3372. }
  3373. interface GetScreenBrightnessSuccessCallbackOption {
  3374. /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮 */
  3375. value: number
  3376. }
  3377. interface GetScreenRecordingStateOption {
  3378. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3379. complete?: GetScreenRecordingStateCompleteCallback
  3380. /** 接口调用失败的回调函数 */
  3381. fail?: GetScreenRecordingStateFailCallback
  3382. /** 接口调用成功的回调函数 */
  3383. success?: GetScreenRecordingStateSuccessCallback
  3384. }
  3385. interface GetScreenRecordingStateSuccessCallbackResult {
  3386. /** 录屏状态
  3387. *
  3388. * 可选值:
  3389. * - 'on': 开启;
  3390. * - 'off': 关闭; */
  3391. state: 'on' | 'off'
  3392. errMsg: string
  3393. }
  3394. interface GetSelectedTextRangeOption {
  3395. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3396. complete?: GetSelectedTextRangeCompleteCallback
  3397. /** 接口调用失败的回调函数 */
  3398. fail?: GetSelectedTextRangeFailCallback
  3399. /** 接口调用成功的回调函数 */
  3400. success?: GetSelectedTextRangeSuccessCallback
  3401. }
  3402. interface GetSelectedTextRangeSuccessCallbackResult {
  3403. /** 输入框光标结束位置 */
  3404. end: number
  3405. /** 输入框光标起始位置 */
  3406. start: number
  3407. errMsg: string
  3408. }
  3409. interface GetSelectionTextOption {
  3410. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3411. complete?: GetSelectionTextCompleteCallback
  3412. /** 接口调用失败的回调函数 */
  3413. fail?: GetSelectionTextFailCallback
  3414. /** 接口调用成功的回调函数 */
  3415. success?: GetSelectionTextSuccessCallback
  3416. }
  3417. interface GetSelectionTextSuccessCallbackResult {
  3418. /** 纯文本内容 */
  3419. text: string
  3420. errMsg: string
  3421. }
  3422. interface GetSettingOption {
  3423. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3424. complete?: GetSettingCompleteCallback
  3425. /** 接口调用失败的回调函数 */
  3426. fail?: GetSettingFailCallback
  3427. /** 接口调用成功的回调函数 */
  3428. success?: GetSettingSuccessCallback
  3429. /** 需要基础库: `2.10.1`
  3430. *
  3431. * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
  3432. withSubscriptions?: boolean
  3433. }
  3434. interface GetSettingSuccessCallbackResult {
  3435. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  3436. *
  3437. * 用户授权结果 */
  3438. authSetting: AuthSetting
  3439. /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
  3440. *
  3441. * 需要基础库: `2.10.1`
  3442. *
  3443. * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 */
  3444. subscriptionsSetting: SubscriptionsSetting
  3445. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  3446. *
  3447. * 在插件中调用时,当前宿主小程序的用户授权结果 */
  3448. miniprogramAuthSetting?: AuthSetting
  3449. errMsg: string
  3450. }
  3451. interface GetShareInfoOption {
  3452. /** shareTicket */
  3453. shareTicket: string
  3454. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3455. complete?: GetShareInfoCompleteCallback
  3456. /** 接口调用失败的回调函数 */
  3457. fail?: GetShareInfoFailCallback
  3458. /** 接口调用成功的回调函数 */
  3459. success?: GetShareInfoSuccessCallback
  3460. /** 需要基础库: `1.9.90`
  3461. *
  3462. * 超时时间,单位 ms */
  3463. timeout?: number
  3464. }
  3465. interface GetSkewOption {
  3466. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3467. complete?: GetSkewCompleteCallback
  3468. /** 接口调用失败的回调函数 */
  3469. fail?: GetSkewFailCallback
  3470. /** 接口调用成功的回调函数 */
  3471. success?: GetSkewSuccessCallback
  3472. }
  3473. interface GetSkewSuccessCallbackResult {
  3474. /** 倾斜角 */
  3475. skew: number
  3476. errMsg: string
  3477. }
  3478. interface GetSkylineInfoOption {
  3479. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3480. complete?: GetSkylineInfoCompleteCallback
  3481. /** 接口调用失败的回调函数 */
  3482. fail?: GetSkylineInfoFailCallback
  3483. /** 接口调用成功的回调函数 */
  3484. success?: GetSkylineInfoSuccessCallback
  3485. }
  3486. interface GetStorageInfoOption {
  3487. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3488. complete?: GetStorageInfoCompleteCallback
  3489. /** 接口调用失败的回调函数 */
  3490. fail?: GetStorageInfoFailCallback
  3491. /** 接口调用成功的回调函数 */
  3492. success?: GetStorageInfoSuccessCallback
  3493. }
  3494. interface GetStorageInfoSuccessCallbackOption {
  3495. /** 当前占用的空间大小, 单位 KB */
  3496. currentSize: number
  3497. /** 当前 storage 中所有的 key */
  3498. keys: string[]
  3499. /** 限制的空间大小,单位 KB */
  3500. limitSize: number
  3501. }
  3502. interface GetStorageInfoSyncOption {
  3503. /** 当前占用的空间大小, 单位 KB */
  3504. currentSize: number
  3505. /** 当前 storage 中所有的 key */
  3506. keys: string[]
  3507. /** 限制的空间大小,单位 KB */
  3508. limitSize: number
  3509. }
  3510. interface GetStorageOption<T = any> {
  3511. /** 本地缓存中指定的 key */
  3512. key: string
  3513. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3514. complete?: GetStorageCompleteCallback
  3515. /** 需要基础库: `2.21.3`
  3516. *
  3517. * 是否开启加密存储。只有异步的 getStorage 接口支持开启加密存储。开启后,将会对 data 使用 AES128 解密,接口回调耗时将会增加。若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true */
  3518. encrypt?: boolean
  3519. /** 接口调用失败的回调函数 */
  3520. fail?: GetStorageFailCallback
  3521. /** 接口调用成功的回调函数 */
  3522. success?: GetStorageSuccessCallback<T>
  3523. }
  3524. interface GetStorageSuccessCallbackResult<T = any> {
  3525. /** key对应的内容 */
  3526. data: T
  3527. errMsg: string
  3528. }
  3529. interface GetSystemInfoAsyncOption {
  3530. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3531. complete?: GetSystemInfoAsyncCompleteCallback
  3532. /** 接口调用失败的回调函数 */
  3533. fail?: GetSystemInfoAsyncFailCallback
  3534. /** 接口调用成功的回调函数 */
  3535. success?: GetSystemInfoAsyncSuccessCallback
  3536. }
  3537. interface GetSystemInfoOption {
  3538. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3539. complete?: GetSystemInfoCompleteCallback
  3540. /** 接口调用失败的回调函数 */
  3541. fail?: GetSystemInfoFailCallback
  3542. /** 接口调用成功的回调函数 */
  3543. success?: GetSystemInfoSuccessCallback
  3544. }
  3545. interface GetUserInfoOption {
  3546. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3547. complete?: GetUserInfoCompleteCallback
  3548. /** 接口调用失败的回调函数 */
  3549. fail?: GetUserInfoFailCallback
  3550. /** 显示用户信息的语言
  3551. *
  3552. * 可选值:
  3553. * - 'en': 英文;
  3554. * - 'zh_CN': 简体中文;
  3555. * - 'zh_TW': 繁体中文; */
  3556. lang?: 'en' | 'zh_CN' | 'zh_TW'
  3557. /** 接口调用成功的回调函数 */
  3558. success?: GetUserInfoSuccessCallback
  3559. /** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 wx.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */
  3560. withCredentials?: boolean
  3561. }
  3562. interface GetUserInfoSuccessCallbackResult {
  3563. /** 需要基础库: `2.7.0`
  3564. *
  3565. * 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
  3566. cloudID: string
  3567. /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  3568. encryptedData: string
  3569. /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  3570. iv: string
  3571. /** 不包括敏感信息的原始数据字符串,用于计算签名 */
  3572. rawData: string
  3573. /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  3574. signature: string
  3575. /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html)
  3576. *
  3577. * 用户信息对象,不包含 openid 等敏感信息 */
  3578. userInfo: UserInfo
  3579. errMsg: string
  3580. }
  3581. interface GetUserProfileOption {
  3582. /** 声明获取用户个人信息后的用途,不超过30个字符 */
  3583. desc: string
  3584. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3585. complete?: GetUserProfileCompleteCallback
  3586. /** 接口调用失败的回调函数 */
  3587. fail?: GetUserProfileFailCallback
  3588. /** 显示用户信息的语言
  3589. *
  3590. * 可选值:
  3591. * - 'en': 英文;
  3592. * - 'zh_CN': 简体中文;
  3593. * - 'zh_TW': 繁体中文; */
  3594. lang?: 'en' | 'zh_CN' | 'zh_TW'
  3595. /** 接口调用成功的回调函数 */
  3596. success?: GetUserProfileSuccessCallback
  3597. }
  3598. interface GetUserProfileSuccessCallbackResult {
  3599. /** 需要基础库: `2.10.4`
  3600. *
  3601. * 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
  3602. cloudID: string
  3603. /** 需要基础库: `2.10.4`
  3604. *
  3605. * 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  3606. encryptedData: string
  3607. /** 需要基础库: `2.10.4`
  3608. *
  3609. * 加密算法的初始向量,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  3610. iv: string
  3611. /** 需要基础库: `2.10.4`
  3612. *
  3613. * 不包括敏感信息的原始数据字符串,用于计算签名 */
  3614. rawData: string
  3615. /** 需要基础库: `2.10.4`
  3616. *
  3617. * 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  3618. signature: string
  3619. /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html)
  3620. *
  3621. * 需要基础库: `2.10.4`
  3622. *
  3623. * 用户信息对象 */
  3624. userInfo: UserInfo
  3625. errMsg: string
  3626. }
  3627. interface GetVideoInfoOption {
  3628. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
  3629. src: string
  3630. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3631. complete?: GetVideoInfoCompleteCallback
  3632. /** 接口调用失败的回调函数 */
  3633. fail?: GetVideoInfoFailCallback
  3634. /** 接口调用成功的回调函数 */
  3635. success?: GetVideoInfoSuccessCallback
  3636. }
  3637. interface GetVideoInfoSuccessCallbackResult {
  3638. /** 视频码率,单位 kbps */
  3639. bitrate: number
  3640. /** 视频长度 */
  3641. duration: number
  3642. /** 视频帧率 */
  3643. fps: number
  3644. /** 视频的长,单位 px */
  3645. height: number
  3646. /** 画面方向
  3647. *
  3648. * 可选值:
  3649. * - 'up': 默认;
  3650. * - 'down': 180度旋转;
  3651. * - 'left': 逆时针旋转90度;
  3652. * - 'right': 顺时针旋转90度;
  3653. * - 'up-mirrored': 同up,但水平翻转;
  3654. * - 'down-mirrored': 同down,但水平翻转;
  3655. * - 'left-mirrored': 同left,但垂直翻转;
  3656. * - 'right-mirrored': 同right,但垂直翻转; */
  3657. orientation:
  3658. | 'up'
  3659. | 'down'
  3660. | 'left'
  3661. | 'right'
  3662. | 'up-mirrored'
  3663. | 'down-mirrored'
  3664. | 'left-mirrored'
  3665. | 'right-mirrored'
  3666. /** 视频大小,单位 kB */
  3667. size: number
  3668. /** 视频格式 */
  3669. type: string
  3670. /** 视频的宽,单位 px */
  3671. width: number
  3672. errMsg: string
  3673. }
  3674. interface GetWeRunDataOption {
  3675. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3676. complete?: GetWeRunDataCompleteCallback
  3677. /** 接口调用失败的回调函数 */
  3678. fail?: GetWeRunDataFailCallback
  3679. /** 接口调用成功的回调函数 */
  3680. success?: GetWeRunDataSuccessCallback
  3681. }
  3682. interface GetWeRunDataSuccessCallbackResult {
  3683. /** 需要基础库: `2.7.0`
  3684. *
  3685. * 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
  3686. cloudID: string
  3687. /** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)。解密后得到的数据结构见后文 */
  3688. encryptedData: string
  3689. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  3690. iv: string
  3691. errMsg: string
  3692. }
  3693. interface GetWifiListOption {
  3694. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3695. complete?: GetWifiListCompleteCallback
  3696. /** 接口调用失败的回调函数 */
  3697. fail?: GetWifiListFailCallback
  3698. /** 接口调用成功的回调函数 */
  3699. success?: GetWifiListSuccessCallback
  3700. }
  3701. /** 需要基础库: `2.28.0`
  3702. *
  3703. * 手势检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
  3704. interface HandTrack {
  3705. /** 需要基础库: `2.28.0`
  3706. *
  3707. * 手势检测模式
  3708. *
  3709. * 可选值:
  3710. * - 1: 通过摄像头实时检测;
  3711. * - 2: 静态图片检测; */
  3712. mode: 1 | 2
  3713. }
  3714. interface HideHomeButtonOption {
  3715. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3716. complete?: HideHomeButtonCompleteCallback
  3717. /** 接口调用失败的回调函数 */
  3718. fail?: HideHomeButtonFailCallback
  3719. /** 接口调用成功的回调函数 */
  3720. success?: HideHomeButtonSuccessCallback
  3721. }
  3722. interface HideKeyboardOption {
  3723. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3724. complete?: HideKeyboardCompleteCallback
  3725. /** 接口调用失败的回调函数 */
  3726. fail?: HideKeyboardFailCallback
  3727. /** 接口调用成功的回调函数 */
  3728. success?: HideKeyboardSuccessCallback
  3729. }
  3730. interface HideLoadingOption {
  3731. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3732. complete?: HideLoadingCompleteCallback
  3733. /** 接口调用失败的回调函数 */
  3734. fail?: HideLoadingFailCallback
  3735. /** 需要基础库: `2.22.1`
  3736. *
  3737. * 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性 */
  3738. noConflict?: boolean
  3739. /** 接口调用成功的回调函数 */
  3740. success?: HideLoadingSuccessCallback
  3741. }
  3742. interface HideNavigationBarLoadingOption {
  3743. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3744. complete?: HideNavigationBarLoadingCompleteCallback
  3745. /** 接口调用失败的回调函数 */
  3746. fail?: HideNavigationBarLoadingFailCallback
  3747. /** 接口调用成功的回调函数 */
  3748. success?: HideNavigationBarLoadingSuccessCallback
  3749. }
  3750. interface HideShareMenuOption {
  3751. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3752. complete?: HideShareMenuCompleteCallback
  3753. /** 接口调用失败的回调函数 */
  3754. fail?: HideShareMenuFailCallback
  3755. /** 需要基础库: `2.11.3`
  3756. *
  3757. * 本接口为 Beta 版本,暂只在 Android 平台支持。需要隐藏的转发按钮名称列表,默认['shareAppMessage', 'shareTimeline']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 */
  3758. menus?: string[]
  3759. /** 接口调用成功的回调函数 */
  3760. success?: HideShareMenuSuccessCallback
  3761. }
  3762. interface HideTabBarOption {
  3763. /** 是否需要动画效果 */
  3764. animation?: boolean
  3765. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3766. complete?: HideTabBarCompleteCallback
  3767. /** 接口调用失败的回调函数 */
  3768. fail?: HideTabBarFailCallback
  3769. /** 接口调用成功的回调函数 */
  3770. success?: HideTabBarSuccessCallback
  3771. }
  3772. interface HideTabBarRedDotOption {
  3773. /** tabBar 的哪一项,从左边算起 */
  3774. index: number
  3775. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3776. complete?: HideTabBarRedDotCompleteCallback
  3777. /** 接口调用失败的回调函数 */
  3778. fail?: HideTabBarRedDotFailCallback
  3779. /** 接口调用成功的回调函数 */
  3780. success?: HideTabBarRedDotSuccessCallback
  3781. }
  3782. interface HideToastOption {
  3783. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3784. complete?: HideToastCompleteCallback
  3785. /** 接口调用失败的回调函数 */
  3786. fail?: HideToastFailCallback
  3787. /** 需要基础库: `2.22.1`
  3788. *
  3789. * 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性 */
  3790. noConflict?: number
  3791. /** 接口调用成功的回调函数 */
  3792. success?: HideToastSuccessCallback
  3793. }
  3794. /** 检测结果 */
  3795. interface HitTestRes {
  3796. /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
  3797. transform: Float32Array
  3798. }
  3799. /** 需要基础库: `2.7.0`
  3800. *
  3801. * 图片对象 */
  3802. interface Image {
  3803. /** 图片的真实高度 */
  3804. height: number
  3805. /** 图片加载发生错误后触发的回调函数 */
  3806. onerror: (...args: any[]) => any
  3807. /** 图片加载完成后触发的回调函数 */
  3808. onload: (...args: any[]) => any
  3809. /** 需要基础库: `2.13.0`
  3810. *
  3811. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  3812. referrerPolicy: string
  3813. /** 图片的 URL。v2.11.0 起支持传递 base64 Data URI */
  3814. src: string
  3815. /** 图片的真实宽度 */
  3816. width: number
  3817. }
  3818. /** 需要基础库: `2.9.0`
  3819. *
  3820. * ImageData 对象 */
  3821. interface ImageData {
  3822. /** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */
  3823. data: Uint8ClampedArray
  3824. /** 使用像素描述 ImageData 的实际高度 */
  3825. height: number
  3826. /** 使用像素描述 ImageData 的实际宽度 */
  3827. width: number
  3828. }
  3829. /** 需要基础库: `1.2.0`
  3830. *
  3831. * 图片的本地临时文件列表 */
  3832. interface ImageFile {
  3833. /** 本地临时文件路径 (本地路径) */
  3834. path: string
  3835. /** 本地临时文件大小,单位 B */
  3836. size: number
  3837. }
  3838. interface IncludePointsOption {
  3839. /** 要显示在可视区域内的坐标点列表 */
  3840. points: MapPostion[]
  3841. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3842. complete?: IncludePointsCompleteCallback
  3843. /** 接口调用失败的回调函数 */
  3844. fail?: IncludePointsFailCallback
  3845. /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */
  3846. padding?: number[]
  3847. /** 接口调用成功的回调函数 */
  3848. success?: IncludePointsSuccessCallback
  3849. }
  3850. interface InitFaceDetectOption {
  3851. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3852. complete?: InitFaceDetectCompleteCallback
  3853. /** 接口调用失败的回调函数 */
  3854. fail?: InitFaceDetectFailCallback
  3855. /** 接口调用成功的回调函数 */
  3856. success?: InitFaceDetectSuccessCallback
  3857. }
  3858. interface InitMarkerClusterOption {
  3859. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3860. complete?: InitMarkerClusterCompleteCallback
  3861. /** 启用默认的聚合样式 */
  3862. enableDefaultStyle?: boolean
  3863. /** 接口调用失败的回调函数 */
  3864. fail?: InitMarkerClusterFailCallback
  3865. /** 聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位 */
  3866. gridSize?: number
  3867. /** 接口调用成功的回调函数 */
  3868. success?: InitMarkerClusterSuccessCallback
  3869. /** 点击已经聚合的标记点时是否实现聚合分离 */
  3870. zoomOnClick?: boolean
  3871. }
  3872. /** InnerAudioContext 实例,可通过 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 接口获取实例。注意,音频播放过程中,可能被系统中断,可通过 [wx.onAudioInterruptionBegin](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)、[wx.onAudioInterruptionEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)事件来处理这种情况。
  3873. *
  3874. * **支持格式**
  3875. *
  3876. * | 格式 | iOS | Android |
  3877. * | ---- | ---- | ------- |
  3878. * | flac | x | √ |
  3879. * | m4a | √ | √ |
  3880. * | ogg | x | √ |
  3881. * | ape | x | √ |
  3882. * | amr | x | √ |
  3883. * | wma | x | √ |
  3884. * | wav | √ | √ |
  3885. * | mp3 | √ | √ |
  3886. * | mp4 | x | √ |
  3887. * | aac | √ | √ |
  3888. * | aiff | √ | x |
  3889. * | caf | √ | x |
  3890. *
  3891. * **示例代码**
  3892. *
  3893. * ```js
  3894. const innerAudioContext = wx.createInnerAudioContext()
  3895. innerAudioContext.autoplay = true
  3896. innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  3897. innerAudioContext.onPlay(() => {
  3898. console.log('开始播放')
  3899. })
  3900. innerAudioContext.onError((res) => {
  3901. console.log(res.errMsg)
  3902. console.log(res.errCode)
  3903. })
  3904. ``` */
  3905. interface InnerAudioContext {
  3906. /** 是否自动开始播放,默认为 `false` */
  3907. autoplay: boolean
  3908. /** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲(只读) */
  3909. buffered: number
  3910. /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(currentTime 属性在基础库 2.26.2 之前只读,基础库 2.26.2 开始可读可写,改变 currentTime 值等同于调用 seek) */
  3911. currentTime: number
  3912. /** 当前音频的长度(单位 s)。只有在当前有合法的 src 时返回(只读) */
  3913. duration: number
  3914. /** 是否循环播放,默认为 `false` */
  3915. loop: boolean
  3916. /** 是否遵循系统静音开关,默认为 `true`。当此参数为 `false` 时,即使用户打开了静音开关,也能继续发出声音。从 2.3.0 版本开始此参数不生效,使用 [wx.setInnerAudioOption](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html) 接口统一设置。 */
  3917. obeyMuteSwitch: boolean
  3918. /** 当前是是否暂停或停止状态(只读) */
  3919. paused: boolean
  3920. /** 需要基础库: `2.11.0`
  3921. *
  3922. * 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
  3923. playbackRate: number
  3924. /** 需要基础库: `2.13.0`
  3925. *
  3926. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  3927. referrerPolicy: string
  3928. /** 音频资源的地址,用于直接播放。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID */
  3929. src: string
  3930. /** 开始播放的位置(单位:s),默认为 0 */
  3931. startTime: number
  3932. /** 需要基础库: `1.9.90`
  3933. *
  3934. * 音量。范围 0~1。默认为 1 */
  3935. volume: number
  3936. }
  3937. interface InnerAudioContextOnErrorListenerResult {
  3938. /** 可选值:
  3939. * - 10001: 系统错误;
  3940. * - 10002: 网络错误;
  3941. * - 10003: 文件错误;
  3942. * - 10004: 格式错误;
  3943. * - -1: 未知错误; */
  3944. errCode: 10001 | 10002 | 10003 | 10004 | -1
  3945. errMsg: string
  3946. }
  3947. interface InsertDividerOption {
  3948. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3949. complete?: InsertDividerCompleteCallback
  3950. /** 接口调用失败的回调函数 */
  3951. fail?: InsertDividerFailCallback
  3952. /** 接口调用成功的回调函数 */
  3953. success?: InsertDividerSuccessCallback
  3954. }
  3955. interface InsertImageOption {
  3956. /** 图片地址,仅支持 http(s)、base64、云图片(2.8.0)、临时文件(2.8.3)。 */
  3957. src: string
  3958. /** 图像无法显示时的替代文本 */
  3959. alt?: string
  3960. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3961. complete?: InsertImageCompleteCallback
  3962. /** data 被序列化为 name=value;name1=value2 的格式挂在属性 data-custom 上 */
  3963. data?: IAnyObject
  3964. /** 添加到图片 img 标签上的类名 */
  3965. extClass?: string
  3966. /** 接口调用失败的回调函数 */
  3967. fail?: InsertImageFailCallback
  3968. /** 图片高度 (pixels/百分比) */
  3969. height?: string
  3970. /** 插入图片后是否自动换行,默认换行 */
  3971. nowrap?: boolean
  3972. /** 接口调用成功的回调函数 */
  3973. success?: InsertImageSuccessCallback
  3974. /** 图片宽度(pixels/百分比) */
  3975. width?: string
  3976. }
  3977. interface InsertTextOption {
  3978. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3979. complete?: InsertTextCompleteCallback
  3980. /** 接口调用失败的回调函数 */
  3981. fail?: InsertTextFailCallback
  3982. /** 接口调用成功的回调函数 */
  3983. success?: InsertTextSuccessCallback
  3984. /** 文本内容 */
  3985. text?: string
  3986. }
  3987. interface IntersectionObserverObserveCallbackResult {
  3988. /** 目标边界 */
  3989. boundingClientRect: BoundingClientRectResult
  3990. /** 节点自定义数据属性 */
  3991. dataset: Record<string, any>
  3992. /** 节点 ID */
  3993. id: string
  3994. /** 相交比例 */
  3995. intersectionRatio: number
  3996. /** 相交区域的边界 */
  3997. intersectionRect: IntersectionRectResult
  3998. /** 参照区域的边界 */
  3999. relativeRect: RelativeRectResult
  4000. /** 相交检测时的时间戳 */
  4001. time: number
  4002. }
  4003. /** 相交区域的边界 */
  4004. interface IntersectionRectResult {
  4005. /** 下边界 */
  4006. bottom: number
  4007. /** 高度 */
  4008. height: number
  4009. /** 左边界 */
  4010. left: number
  4011. /** 右边界 */
  4012. right: number
  4013. /** 上边界 */
  4014. top: number
  4015. /** 宽度 */
  4016. width: number
  4017. }
  4018. interface InterstitialAdOnErrorListenerResult {
  4019. /** 错误码
  4020. *
  4021. * 可选值:
  4022. * - 1000: 后端接口调用失败;
  4023. * - 1001: 参数错误;
  4024. * - 1002: 广告单元无效;
  4025. * - 1003: 内部错误;
  4026. * - 1004: 无合适的广告;
  4027. * - 1005: 广告组件审核中;
  4028. * - 1006: 广告组件被驳回;
  4029. * - 1007: 广告组件被封禁;
  4030. * - 1008: 广告单元已关闭; */
  4031. errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008
  4032. /** 错误信息 */
  4033. errMsg: string
  4034. }
  4035. interface IsBluetoothDevicePairedOption {
  4036. /** 蓝牙设备 id */
  4037. deviceId: string
  4038. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4039. complete?: IsBluetoothDevicePairedCompleteCallback
  4040. /** 接口调用失败的回调函数 */
  4041. fail?: IsBluetoothDevicePairedFailCallback
  4042. /** 接口调用成功的回调函数 */
  4043. success?: IsBluetoothDevicePairedSuccessCallback
  4044. }
  4045. interface IsConnectedOption {
  4046. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4047. complete?: IsConnectedCompleteCallback
  4048. /** 接口调用失败的回调函数 */
  4049. fail?: IsConnectedFailCallback
  4050. /** 接口调用成功的回调函数 */
  4051. success?: IsConnectedSuccessCallback
  4052. }
  4053. interface Join1v1ChatOption {
  4054. /** 呼叫方信息 */
  4055. caller: VoIP1v1ChatUser
  4056. /** 接听方信息 */
  4057. listener: VoIP1v1ChatUser
  4058. /** 窗口背景色(音频通话背景以及小窗模式背景)
  4059. *
  4060. * 可选值:
  4061. * - 0: #262930;
  4062. * - 1: #FA5151;
  4063. * - 2: #FA9D3B;
  4064. * - 3: #3D7257;
  4065. * - 4: #1485EE;
  4066. * - 5: #6467F0; */
  4067. backgroundType?: 0 | 1 | 2 | 3 | 4 | 5
  4068. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4069. complete?: Join1v1ChatCompleteCallback
  4070. /** 不允许切换到语音通话 */
  4071. disableSwitchVoice?: boolean
  4072. /** 接口调用失败的回调函数 */
  4073. fail?: Join1v1ChatFailCallback
  4074. /** 小窗样式 */
  4075. minWindowType?: number
  4076. /** 通话类型
  4077. *
  4078. * 可选值:
  4079. * - 'voice': 语音通话;
  4080. * - 'video': 视频通话; */
  4081. roomType?: 'voice' | 'video'
  4082. /** 接口调用成功的回调函数 */
  4083. success?: Join1v1ChatSuccessCallback
  4084. }
  4085. interface JoinVoIPChatOption {
  4086. /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */
  4087. groupId: string
  4088. /** 验证所需的随机字符串 */
  4089. nonceStr: string
  4090. /** 签名,用于验证小游戏的身份 */
  4091. signature: string
  4092. /** 验证所需的时间戳 */
  4093. timeStamp: number
  4094. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4095. complete?: JoinVoIPChatCompleteCallback
  4096. /** 接口调用失败的回调函数 */
  4097. fail?: JoinVoIPChatFailCallback
  4098. /** 需要基础库: `2.29.0`
  4099. *
  4100. * wifi下使用移动网络发送请求 */
  4101. forceCellularNetwork?: boolean
  4102. /** 静音设置 */
  4103. muteConfig?: MuteConfig
  4104. /** 房间类型
  4105. *
  4106. * 可选值:
  4107. * - 'voice': 音频房间,用于语音通话;
  4108. * - 'video': 视频房间,结合 [voip-room](https://developers.weixin.qq.com/miniprogram/dev/component/voip-room.html) 组件可显示成员画面; */
  4109. roomType?: 'voice' | 'video'
  4110. /** 接口调用成功的回调函数 */
  4111. success?: JoinVoIPChatSuccessCallback
  4112. }
  4113. interface JoinVoIPChatSuccessCallbackResult {
  4114. /** 错误码 */
  4115. errCode: number
  4116. /** 调用结果 */
  4117. errMsg: string
  4118. /** 在此通话中的成员 openId 名单 */
  4119. openIdList: string[]
  4120. }
  4121. interface KvList {
  4122. /** key 本地缓存中指定的 key */
  4123. key: string
  4124. /** data 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  4125. value: any
  4126. }
  4127. /** 启动参数 */
  4128. interface LaunchOptionsApp {
  4129. /** 需要基础库: `2.20.0`
  4130. *
  4131. * API 类别
  4132. *
  4133. * 可选值:
  4134. * - 'default': 默认类别;
  4135. * - 'nativeFunctionalized': 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序;
  4136. * - 'browseOnly': 仅浏览,朋友圈快照页等场景打开的小程序;
  4137. * - 'embedded': 内嵌,通过打开半屏小程序能力打开的小程序; */
  4138. apiCategory:
  4139. | 'default'
  4140. | 'nativeFunctionalized'
  4141. | 'browseOnly'
  4142. | 'embedded'
  4143. /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
  4144. forwardMaterials: ForwardMaterials[]
  4145. /** 启动小程序的路径 (代码包路径) */
  4146. path: string
  4147. /** 启动小程序的 query 参数 */
  4148. query: IAnyObject
  4149. /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
  4150. referrerInfo: ReferrerInfo
  4151. /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/component/xr-frame/core/scene.html) */
  4152. scene: number
  4153. /** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型
  4154. *
  4155. * 可选值:
  4156. * - 1: 微信联系人单聊;
  4157. * - 2: 企业微信联系人单聊;
  4158. * - 3: 普通微信群聊;
  4159. * - 4: 企业微信互通群聊; */
  4160. chatType?: 1 | 2 | 3 | 4
  4161. /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  4162. shareTicket?: string
  4163. }
  4164. interface LivePlayerContextRequestFullScreenOption {
  4165. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4166. complete?: RequestFullScreenCompleteCallback
  4167. /** 设置全屏时的方向
  4168. *
  4169. * 可选值:
  4170. * - 0: 正常竖向;
  4171. * - 90: 屏幕逆时针90度;
  4172. * - -90: 屏幕顺时针90度; */
  4173. direction?: 0 | 90 | -90
  4174. /** 接口调用失败的回调函数 */
  4175. fail?: RequestFullScreenFailCallback
  4176. /** 接口调用成功的回调函数 */
  4177. success?: RequestFullScreenSuccessCallback
  4178. }
  4179. interface LivePlayerContextSnapshotOption {
  4180. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4181. complete?: SnapshotCompleteCallback
  4182. /** 接口调用失败的回调函数 */
  4183. fail?: SnapshotFailCallback
  4184. /** 需要基础库: `2.10.0`
  4185. *
  4186. * 图片的质量
  4187. *
  4188. * 可选值:
  4189. * - 'raw': 原图;
  4190. * - 'compressed': 压缩图; */
  4191. quality?: 'raw' | 'compressed'
  4192. /** 需要基础库: `2.25.0`
  4193. *
  4194. * 截取的源类型
  4195. *
  4196. * 可选值:
  4197. * - 'stream': 截取视频源;
  4198. * - 'view': 截取渲染后的画面; */
  4199. sourceType?: 'stream' | 'view'
  4200. /** 接口调用成功的回调函数 */
  4201. success?: LivePlayerContextSnapshotSuccessCallback
  4202. }
  4203. interface LivePlayerContextSnapshotSuccessCallbackResult {
  4204. /** 图片的高度 */
  4205. height: string
  4206. /** 图片文件的临时路径 (本地路径) */
  4207. tempImagePath: string
  4208. /** 图片的宽度 */
  4209. width: string
  4210. errMsg: string
  4211. }
  4212. interface LivePusherContextSnapshotOption {
  4213. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4214. complete?: SnapshotCompleteCallback
  4215. /** 接口调用失败的回调函数 */
  4216. fail?: SnapshotFailCallback
  4217. /** 需要基础库: `2.10.0`
  4218. *
  4219. * 图片的质量
  4220. *
  4221. * 可选值:
  4222. * - 'raw': 原图;
  4223. * - 'compressed': 压缩图; */
  4224. quality?: 'raw' | 'compressed'
  4225. /** 需要基础库: `2.25.0`
  4226. *
  4227. * 截取的源类型
  4228. *
  4229. * 可选值:
  4230. * - 'stream': 截取视频源;
  4231. * - 'view': 截取渲染后的画面; */
  4232. sourceType?: 'stream' | 'view'
  4233. /** 接口调用成功的回调函数 */
  4234. success?: LivePusherContextSnapshotSuccessCallback
  4235. }
  4236. interface LivePusherContextSnapshotSuccessCallbackResult {
  4237. /** 图片的高度 */
  4238. height: string
  4239. /** 图片文件的临时路径 */
  4240. tempImagePath: string
  4241. /** 图片的宽度 */
  4242. width: string
  4243. errMsg: string
  4244. }
  4245. interface LivePusherContextStartOption {
  4246. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4247. complete?: StartCompleteCallback
  4248. /** 接口调用失败的回调函数 */
  4249. fail?: StartFailCallback
  4250. /** 接口调用成功的回调函数 */
  4251. success?: StartSuccessCallback
  4252. }
  4253. interface LoadFontFaceCompleteCallbackResult {
  4254. /** 加载字体结果 */
  4255. status: string
  4256. }
  4257. interface LoadFontFaceOption {
  4258. /** 定义的字体名称 */
  4259. family: string
  4260. /** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。 */
  4261. source: string
  4262. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4263. complete?: LoadFontFaceCompleteCallback
  4264. /** 可选的字体描述符 */
  4265. desc?: DescOption
  4266. /** 接口调用失败的回调函数 */
  4267. fail?: LoadFontFaceFailCallback
  4268. /** 需要基础库: `2.10.0`
  4269. *
  4270. * 是否全局生效 */
  4271. global?: boolean
  4272. /** 字体作用范围,可选值为 webview / native,默认 webview,设置 native 可在 Canvas 2D 下使用 */
  4273. scopes?: any[]
  4274. /** 接口调用成功的回调函数 */
  4275. success?: LoadFontFaceSuccessCallback
  4276. }
  4277. interface LocalInfo {
  4278. /** 接收消息的 socket 的地址 */
  4279. address: string
  4280. /** 使用的协议族,为 IPv4 或者 IPv6 */
  4281. family: string
  4282. /** 端口号 */
  4283. port: number
  4284. }
  4285. interface LoginOption {
  4286. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4287. complete?: LoginCompleteCallback
  4288. /** 接口调用失败的回调函数 */
  4289. fail?: LoginFailCallback
  4290. /** 接口调用成功的回调函数 */
  4291. success?: LoginSuccessCallback
  4292. /** 需要基础库: `1.9.90`
  4293. *
  4294. * 超时时间,单位ms */
  4295. timeout?: number
  4296. }
  4297. interface LoginSuccessCallbackResult {
  4298. /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [code2Session](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/code2Session.html),使用 code 换取 openid、unionid、session_key 等信息 */
  4299. code: string
  4300. errMsg: string
  4301. }
  4302. interface MakeBluetoothPairOption {
  4303. /** 蓝牙设备 id */
  4304. deviceId: string
  4305. /** pin 码,Base64 格式。 */
  4306. pin: string
  4307. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4308. complete?: MakeBluetoothPairCompleteCallback
  4309. /** 接口调用失败的回调函数 */
  4310. fail?: MakeBluetoothPairFailCallback
  4311. /** 接口调用成功的回调函数 */
  4312. success?: MakeBluetoothPairSuccessCallback
  4313. /** 超时时间,单位 ms */
  4314. timeout?: number
  4315. }
  4316. interface MakePhoneCallOption {
  4317. /** 需要拨打的电话号码 */
  4318. phoneNumber: string
  4319. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4320. complete?: MakePhoneCallCompleteCallback
  4321. /** 接口调用失败的回调函数 */
  4322. fail?: MakePhoneCallFailCallback
  4323. /** 接口调用成功的回调函数 */
  4324. success?: MakePhoneCallSuccessCallback
  4325. }
  4326. /** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
  4327. interface ManufacturerData {
  4328. /** 制造商ID,0x 开头的十六进制 */
  4329. manufacturerId: string
  4330. /** 制造商信息 */
  4331. manufacturerSpecificData?: ArrayBuffer
  4332. }
  4333. /** 图片覆盖的经纬度范围 */
  4334. interface MapBounds {
  4335. /** 东北角经纬度 */
  4336. northeast: MapPostion
  4337. /** 西南角经纬度 */
  4338. southwest: MapPostion
  4339. }
  4340. interface MapPostion {
  4341. /** 纬度 */
  4342. latitude: number
  4343. /** 经度 */
  4344. longitude: number
  4345. }
  4346. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  4347. interface Margins {
  4348. /** 节点布局区域的下边界 */
  4349. bottom?: number
  4350. /** 节点布局区域的左边界 */
  4351. left?: number
  4352. /** 节点布局区域的右边界 */
  4353. right?: number
  4354. /** 节点布局区域的上边界 */
  4355. top?: number
  4356. }
  4357. /** 匹配到的缓存 */
  4358. interface MatchCache {
  4359. /** 缓存 id */
  4360. cacheId: string
  4361. /** 缓存创建时间 */
  4362. createTime: number
  4363. /** 缓存内容,会带有 fromCache 标记,方便开发者区分内容是否来自缓存 */
  4364. data: any
  4365. /** 缓存有效时间 */
  4366. maxAge: number
  4367. /** 命中的规则 id */
  4368. ruleId: string
  4369. }
  4370. /** MediaAudioPlayer 实例,可通过 [wx.createMediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html) 接口获取实例。 */
  4371. interface MediaAudioPlayer {
  4372. /** 音量。范围 0~1。默认为 1 */
  4373. volume: number
  4374. }
  4375. /** 本地临时文件列表 */
  4376. interface MediaFile {
  4377. /** 视频的时间长度 */
  4378. duration: number
  4379. /** 文件类型
  4380. *
  4381. * 可选值:
  4382. * - 'image': 图片;
  4383. * - 'video': 视频; */
  4384. fileType: 'image' | 'video'
  4385. /** 视频的高度 */
  4386. height: number
  4387. /** 本地临时文件大小,单位 B */
  4388. size: number
  4389. /** 本地临时文件路径 (本地路径) */
  4390. tempFilePath: string
  4391. /** 视频缩略图临时文件路径 */
  4392. thumbTempFilePath: string
  4393. /** 视频的宽度 */
  4394. width: number
  4395. }
  4396. interface MediaQueryObserverObserveCallbackResult {
  4397. /** 页面的当前状态是否满足所指定的 media query */
  4398. matches: boolean
  4399. }
  4400. /** 需要预览的资源列表 */
  4401. interface MediaSource {
  4402. /** 图片或视频的地址 */
  4403. url: string
  4404. /** 视频的封面图片 */
  4405. poster?: string
  4406. /** 资源的类型,默认为图片
  4407. *
  4408. * 可选值:
  4409. * - 'image': 图片;
  4410. * - 'video': 视频; */
  4411. type?: 'image' | 'video'
  4412. }
  4413. /** 需要基础库: `2.9.0`
  4414. *
  4415. * 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。
  4416. *
  4417. * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作 */
  4418. interface MediaTrack {
  4419. /** 轨道长度,只读 */
  4420. duration: number
  4421. /** 轨道类型,只读
  4422. *
  4423. * 可选值:
  4424. * - 'audio': 音频轨道;
  4425. * - 'video': 视频轨道; */
  4426. kind: 'audio' | 'video'
  4427. /** 音量,音频轨道下有效,可写 */
  4428. volume: number
  4429. }
  4430. /** 小程序帐号信息 */
  4431. interface MiniProgram {
  4432. /** 小程序 appId */
  4433. appId: string
  4434. /** 需要基础库: `2.10.0`
  4435. *
  4436. * 小程序版本
  4437. *
  4438. * 可选值:
  4439. * - 'develop': 开发版;
  4440. * - 'trial': 体验版;
  4441. * - 'release': 正式版; */
  4442. envVersion: 'develop' | 'trial' | 'release'
  4443. /** 需要基础库: `2.10.2`
  4444. *
  4445. * 线上小程序版本号 */
  4446. version: string
  4447. }
  4448. interface MkdirFailCallbackResult {
  4449. /** 错误信息
  4450. *
  4451. * 可选值:
  4452. * - 'fail no such file or directory ${dirPath}': 上级目录不存在(该错误仅在 recursive = false 时生效);
  4453. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
  4454. * - 'fail file already exists ${dirPath}': 有同名文件或目录(该错误仅在 recursive = false 时生效);
  4455. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  4456. errMsg: string
  4457. }
  4458. interface MkdirOption {
  4459. /** 创建的目录路径 (本地路径) */
  4460. dirPath: string
  4461. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4462. complete?: MkdirCompleteCallback
  4463. /** 接口调用失败的回调函数 */
  4464. fail?: MkdirFailCallback
  4465. /** 需要基础库: `2.3.0`
  4466. *
  4467. * 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
  4468. recursive?: boolean
  4469. /** 接口调用成功的回调函数 */
  4470. success?: MkdirSuccessCallback
  4471. }
  4472. interface MoveAlongOption {
  4473. /** 平滑移动的时间 */
  4474. duration: number
  4475. /** 指定 marker */
  4476. markerId: number
  4477. /** 移动路径的坐标串,坐标点格式 `{longitude, latitude}` */
  4478. path: any[]
  4479. /** 根据路径方向自动改变 marker 的旋转角度 */
  4480. autoRotate?: boolean
  4481. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4482. complete?: MoveAlongCompleteCallback
  4483. /** 接口调用失败的回调函数 */
  4484. fail?: MoveAlongFailCallback
  4485. /** 接口调用成功的回调函数 */
  4486. success?: MoveAlongSuccessCallback
  4487. }
  4488. interface MoveToLocationOption {
  4489. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4490. complete?: MoveToLocationCompleteCallback
  4491. /** 接口调用失败的回调函数 */
  4492. fail?: MoveToLocationFailCallback
  4493. /** 需要基础库: `2.8.0`
  4494. *
  4495. * 纬度 */
  4496. latitude?: number
  4497. /** 需要基础库: `2.8.0`
  4498. *
  4499. * 经度 */
  4500. longitude?: number
  4501. /** 接口调用成功的回调函数 */
  4502. success?: MoveToLocationSuccessCallback
  4503. }
  4504. /** 静音设置 */
  4505. interface MuteConfig {
  4506. /** 是否静音耳机 */
  4507. muteEarphone?: boolean
  4508. /** 是否静音麦克风 */
  4509. muteMicrophone?: boolean
  4510. }
  4511. interface MuteOption {
  4512. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4513. complete?: MuteCompleteCallback
  4514. /** 接口调用失败的回调函数 */
  4515. fail?: MuteFailCallback
  4516. /** 接口调用成功的回调函数 */
  4517. success?: MuteSuccessCallback
  4518. }
  4519. /** 需要基础库: `2.11.2` */
  4520. interface NFCAdapter {
  4521. /** 标签类型枚举 */
  4522. tech: TechType
  4523. }
  4524. interface NavigateBackMiniProgramOption {
  4525. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4526. complete?: NavigateBackMiniProgramCompleteCallback
  4527. /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html)。 */
  4528. extraData?: IAnyObject
  4529. /** 接口调用失败的回调函数 */
  4530. fail?: NavigateBackMiniProgramFailCallback
  4531. /** 接口调用成功的回调函数 */
  4532. success?: NavigateBackMiniProgramSuccessCallback
  4533. }
  4534. interface NavigateBackOption {
  4535. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4536. complete?: NavigateBackCompleteCallback
  4537. /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */
  4538. delta?: number
  4539. /** 接口调用失败的回调函数 */
  4540. fail?: NavigateBackFailCallback
  4541. /** 接口调用成功的回调函数 */
  4542. success?: NavigateBackSuccessCallback
  4543. }
  4544. interface NavigateToMiniProgramOption {
  4545. /** 要打开的小程序 appId */
  4546. appId?: string
  4547. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4548. complete?: NavigateToMiniProgramCompleteCallback
  4549. /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。
  4550. *
  4551. * 可选值:
  4552. * - 'develop': 开发版;
  4553. * - 'trial': 体验版;
  4554. * - 'release': 正式版; */
  4555. envVersion?: 'develop' | 'trial' | 'release'
  4556. /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
  4557. extraData?: IAnyObject
  4558. /** 接口调用失败的回调函数 */
  4559. fail?: NavigateToMiniProgramFailCallback
  4560. /** 需要基础库: `2.24.0`
  4561. *
  4562. * 不reLaunch目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query、apiCategory与上次启动相同。 */
  4563. noRelaunchIfPathUnchanged?: boolean
  4564. /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
  4565. path?: string
  4566. /** 需要基础库: `2.18.1`
  4567. *
  4568. * 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。 */
  4569. shortLink?: string
  4570. /** 接口调用成功的回调函数 */
  4571. success?: NavigateToMiniProgramSuccessCallback
  4572. }
  4573. interface NavigateToOption {
  4574. /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
  4575. url: string
  4576. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4577. complete?: NavigateToCompleteCallback
  4578. /** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。基础库 2.7.3 开始支持。 */
  4579. events?: IAnyObject
  4580. /** 接口调用失败的回调函数 */
  4581. fail?: NavigateToFailCallback
  4582. /** 接口调用成功的回调函数 */
  4583. success?: NavigateToSuccessCallback
  4584. }
  4585. interface NavigateToSuccessCallbackResult {
  4586. /** [EventChannel](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.html)
  4587. *
  4588. * 和被打开页面进行通信 */
  4589. eventChannel: EventChannel
  4590. errMsg: string
  4591. }
  4592. interface NdefCloseOption {
  4593. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4594. complete?: NdefCloseCompleteCallback
  4595. /** 接口调用失败的回调函数 */
  4596. fail?: NdefCloseFailCallback
  4597. /** 接口调用成功的回调函数 */
  4598. success?: NdefCloseSuccessCallback
  4599. }
  4600. interface NdefConnectOption {
  4601. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4602. complete?: ConnectCompleteCallback
  4603. /** 接口调用失败的回调函数 */
  4604. fail?: ConnectFailCallback
  4605. /** 接口调用成功的回调函数 */
  4606. success?: ConnectSuccessCallback
  4607. }
  4608. interface NodeCallbackResult {
  4609. /** 节点对应的 Node 实例 */
  4610. node: IAnyObject
  4611. }
  4612. interface NotifyBLECharacteristicValueChangeOption {
  4613. /** 蓝牙特征的 UUID */
  4614. characteristicId: string
  4615. /** 蓝牙设备 id */
  4616. deviceId: string
  4617. /** 蓝牙特征对应服务的 UUID */
  4618. serviceId: string
  4619. /** 是否启用 notify */
  4620. state: boolean
  4621. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4622. complete?: NotifyBLECharacteristicValueChangeCompleteCallback
  4623. /** 接口调用失败的回调函数 */
  4624. fail?: NotifyBLECharacteristicValueChangeFailCallback
  4625. /** 接口调用成功的回调函数 */
  4626. success?: NotifyBLECharacteristicValueChangeSuccessCallback
  4627. /** 需要基础库: `2.4.0`
  4628. *
  4629. * 设置特征订阅类型,有效值有 `notification` 和 `indication` */
  4630. type?: string
  4631. }
  4632. /** 需要基础库: `2.27.0`
  4633. *
  4634. * OCR检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
  4635. interface OCRTrack {
  4636. /** 需要基础库: `2.27.0`
  4637. *
  4638. * OCR检测模式
  4639. *
  4640. * 可选值:
  4641. * - 1: 通过摄像头实时检测;
  4642. * - 2: 静态图片检测; */
  4643. mode: 1 | 2
  4644. }
  4645. /** media query 描述符 */
  4646. interface ObserveDescriptor {
  4647. /** 页面高度( px 为单位) */
  4648. height: number
  4649. /** 页面最大高度( px 为单位) */
  4650. maxHeight: number
  4651. /** 页面最大宽度( px 为单位) */
  4652. maxWidth: number
  4653. /** 页面最小高度( px 为单位) */
  4654. minHeight: number
  4655. /** 页面最小宽度( px 为单位) */
  4656. minWidth: number
  4657. /** 屏幕方向( `landscape` 或 `portrait` ) */
  4658. orientation: string
  4659. /** 页面宽度( px 为单位) */
  4660. width: number
  4661. }
  4662. /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
  4663. interface ObserveOption {
  4664. /** 指标类型列表。不能和 type 同时使用。 */
  4665. entryTypes?: string[]
  4666. /** 指标类型。不能和 entryTypes 同时使用
  4667. *
  4668. * 可选值:
  4669. * - 'navigation': 路由;
  4670. * - 'render': 渲染;
  4671. * - 'script': 脚本; */
  4672. type?: 'navigation' | 'render' | 'script'
  4673. }
  4674. /** 需要基础库: `2.7.0`
  4675. *
  4676. * 离屏 canvas 实例,可通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建。 */
  4677. interface OffscreenCanvas {
  4678. /** 画布高度 */
  4679. height: number
  4680. /** 画布宽度 */
  4681. width: number
  4682. }
  4683. interface OnAccelerometerChangeListenerResult {
  4684. /** X 轴 */
  4685. x: number
  4686. /** Y 轴 */
  4687. y: number
  4688. /** Z 轴 */
  4689. z: number
  4690. }
  4691. interface OnBLECharacteristicValueChangeListenerResult {
  4692. /** 蓝牙特征的 UUID */
  4693. characteristicId: string
  4694. /** 蓝牙设备 id */
  4695. deviceId: string
  4696. /** 蓝牙特征对应服务的 UUID */
  4697. serviceId: string
  4698. /** 特征最新的值 */
  4699. value: ArrayBuffer
  4700. }
  4701. interface OnBLEConnectionStateChangeListenerResult {
  4702. /** 是否处于已连接状态 */
  4703. connected: boolean
  4704. /** 蓝牙设备 id */
  4705. deviceId: string
  4706. }
  4707. interface OnBLEMTUChangeListenerResult {
  4708. /** 蓝牙设备 id */
  4709. deviceId: string
  4710. /** 最大传输单元 */
  4711. mtu: number
  4712. }
  4713. interface OnBLEPeripheralConnectionStateChangedListenerResult {
  4714. /** 连接目前状态 */
  4715. connected: boolean
  4716. /** 连接状态变化的设备 id */
  4717. deviceId: string
  4718. /** server 的 UUID */
  4719. serverId: string
  4720. }
  4721. interface OnBackgroundFetchDataListenerResult {
  4722. /** 缓存数据类别,取值为 periodic 或 pre */
  4723. fetchType: string
  4724. /** 缓存数据 */
  4725. fetchedData: string
  4726. /** 小程序页面路径 */
  4727. path: string
  4728. /** 传给页面的 query 参数 */
  4729. query: string
  4730. /** 进入小程序的场景值 */
  4731. scene: number
  4732. /** 客户端拿到缓存数据的时间戳 */
  4733. timeStamp: number
  4734. }
  4735. interface OnBeaconServiceChangeListenerResult {
  4736. /** 服务目前是否可用 */
  4737. available: boolean
  4738. /** 目前是否处于搜索状态 */
  4739. discovering: boolean
  4740. }
  4741. interface OnBeaconUpdateListenerResult {
  4742. /** 当前搜寻到的所有 Beacon 设备列表 */
  4743. beacons: BeaconInfo[]
  4744. }
  4745. interface OnBluetoothAdapterStateChangeListenerResult {
  4746. /** 蓝牙适配器是否可用 */
  4747. available: boolean
  4748. /** 蓝牙适配器是否处于搜索状态 */
  4749. discovering: boolean
  4750. }
  4751. interface OnBluetoothDeviceFoundListenerResult {
  4752. /** 新搜索到的设备列表 */
  4753. devices: BlueToothDevice[]
  4754. }
  4755. interface OnCameraFrameCallbackResult {
  4756. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  4757. data: ArrayBuffer
  4758. /** 图像数据矩形的高度 */
  4759. height: number
  4760. /** 图像数据矩形的宽度 */
  4761. width: number
  4762. }
  4763. interface OnCharacteristicReadRequestListenerResult {
  4764. /** 唯一标识码,调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 时使用 */
  4765. callbackId: number
  4766. /** 蓝牙特征的 UUID */
  4767. characteristicId: string
  4768. /** 蓝牙特征对应服务的 UUID */
  4769. serviceId: string
  4770. }
  4771. interface OnCharacteristicSubscribedListenerResult {
  4772. /** 蓝牙特征的 UUID */
  4773. characteristicId: string
  4774. /** 蓝牙特征对应服务的 UUID */
  4775. serviceId: string
  4776. }
  4777. interface OnCharacteristicWriteRequestListenerResult {
  4778. /** 唯一标识码,调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 时使用 */
  4779. callbackId: number
  4780. /** 蓝牙特征的 UUID */
  4781. characteristicId: string
  4782. /** 蓝牙特征对应服务的 UUID */
  4783. serviceId: string
  4784. /** 请求写入特征的二进制数据值 */
  4785. value: ArrayBuffer
  4786. }
  4787. interface OnCheckForUpdateListenerResult {
  4788. /** 是否有新版本 */
  4789. hasUpdate: boolean
  4790. }
  4791. interface OnChunkReceivedListenerResult {
  4792. /** 开发者服务器每次返回新chunk时的Response */
  4793. res: Result
  4794. }
  4795. interface OnCompassChangeListenerResult {
  4796. /** 需要基础库: `2.4.0`
  4797. *
  4798. * 精度 */
  4799. accuracy: number | string
  4800. /** 面对的方向度数 */
  4801. direction: number
  4802. }
  4803. interface OnCopyUrlListenerResult {
  4804. /** 用短链打开小程序时当前页面携带的查询字符串。小程序中使用时,应在进入页面时调用 `wx.onCopyUrl` 自定义 `query`,退出页面时调用 `wx.offCopyUrl`,防止影响其它页面。 */
  4805. query: string
  4806. }
  4807. interface OnCustomRendererEventCallbackResult {
  4808. /** 推流高度 */
  4809. height: number
  4810. /** 推流宽度 */
  4811. width: number
  4812. }
  4813. interface OnDeviceMotionChangeListenerResult {
  4814. /** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */
  4815. alpha: number
  4816. /** 当手机坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。范围值为 [-1*PI, PI) 。顶部朝着地球表面转动为正。也有可能朝着用户为正。 */
  4817. beta: number
  4818. /** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */
  4819. gamma: number
  4820. }
  4821. interface OnDiscoveredListenerResult {
  4822. /** NdefMessage 数组,消息格式为 {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer} */
  4823. messages: any[]
  4824. /** tech 数组,用于匹配NFC卡片具体可以使用什么标准(NfcA等实例)处理 */
  4825. techs: any[]
  4826. }
  4827. interface OnFrameRecordedListenerResult {
  4828. /** 录音分片数据 */
  4829. frameBuffer: ArrayBuffer
  4830. /** 当前帧是否正常录音结束前的最后一帧 */
  4831. isLastFrame: boolean
  4832. }
  4833. interface OnGetWifiListListenerResult {
  4834. /** Wi-Fi 列表数据 */
  4835. wifiList: WifiInfo[]
  4836. }
  4837. interface OnGyroscopeChangeListenerResult {
  4838. /** x 轴的角速度 */
  4839. x: number
  4840. /** y 轴的角速度 */
  4841. y: number
  4842. /** z 轴的角速度 */
  4843. z: number
  4844. }
  4845. interface OnHCEMessageListenerResult {
  4846. /** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */
  4847. data: ArrayBuffer
  4848. /** 消息类型
  4849. *
  4850. * 可选值:
  4851. * - 1: HCE APDU Command类型,小程序需对此指令进行处理,并调用 sendHCEMessage 接口返回处理指令;
  4852. * - 2: 设备离场事件类型; */
  4853. messageType: 1 | 2
  4854. /** `messageType=2` 时,原因 */
  4855. reason: number
  4856. }
  4857. interface OnHeadersReceivedListenerResult {
  4858. /** 开发者服务器返回的 HTTP Response Header */
  4859. header: IAnyObject
  4860. }
  4861. interface OnKeyboardHeightChangeListenerResult {
  4862. /** 键盘高度 */
  4863. height: number
  4864. }
  4865. interface OnLazyLoadErrorListenerResult {
  4866. /** 详细信息 */
  4867. errMsg: string
  4868. /** 异步组件所属的分包 */
  4869. subpackage: any[]
  4870. /** 'subpackage' 失败类型 */
  4871. type: string
  4872. }
  4873. interface OnLocalServiceFoundListenerResult {
  4874. /** 服务的 ip 地址 */
  4875. ip: string
  4876. /** 服务的端口 */
  4877. port: number
  4878. /** 服务的名称 */
  4879. serviceName: string
  4880. /** 服务的类型 */
  4881. serviceType: string
  4882. }
  4883. interface OnLocalServiceLostListenerResult {
  4884. /** 服务的名称 */
  4885. serviceName: string
  4886. /** 服务的类型 */
  4887. serviceType: string
  4888. }
  4889. interface OnLocationChangeErrorListenerResult {
  4890. /** 错误码 */
  4891. errCode: number
  4892. }
  4893. interface OnLocationChangeListenerResult {
  4894. /** 位置的精确度 */
  4895. accuracy: number
  4896. /** 需要基础库: `1.2.0`
  4897. *
  4898. * 高度,单位 m */
  4899. altitude: number
  4900. /** 需要基础库: `1.2.0`
  4901. *
  4902. * 水平精度,单位 m */
  4903. horizontalAccuracy: number
  4904. /** 纬度,范围为 -90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  4905. latitude: number
  4906. /** 经度,范围为 -180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  4907. longitude: number
  4908. /** 速度,单位 m/s */
  4909. speed: number
  4910. /** 需要基础库: `1.2.0`
  4911. *
  4912. * 垂直精度,单位 m(Android 无法获取,返回 0) */
  4913. verticalAccuracy: number
  4914. }
  4915. interface OnMemoryWarningListenerResult {
  4916. /** 内存告警等级,只有 Android 才有,对应系统宏定义
  4917. *
  4918. * 可选值:
  4919. * - 5: TRIM_MEMORY_RUNNING_MODERATE;
  4920. * - 10: TRIM_MEMORY_RUNNING_LOW;
  4921. * - 15: TRIM_MEMORY_RUNNING_CRITICAL; */
  4922. level: 5 | 10 | 15
  4923. }
  4924. interface OnNetworkStatusChangeListenerResult {
  4925. /** 当前是否有网络连接 */
  4926. isConnected: boolean
  4927. /** 网络类型
  4928. *
  4929. * 可选值:
  4930. * - 'wifi': wifi 网络;
  4931. * - '2g': 2g 网络;
  4932. * - '3g': 3g 网络;
  4933. * - '4g': 4g 网络;
  4934. * - '5g': 5g 网络;
  4935. * - 'unknown': Android 下不常见的网络类型;
  4936. * - 'none': 无网络; */
  4937. networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
  4938. }
  4939. interface OnNetworkWeakChangeListenerResult {
  4940. /** 当前网络类型 */
  4941. networkType: string
  4942. /** 当前是否处于弱网状态 */
  4943. weakNet: boolean
  4944. }
  4945. interface OnOpenListenerResult {
  4946. /** 需要基础库: `2.0.0`
  4947. *
  4948. * 连接成功的 HTTP 响应 Header */
  4949. header: IAnyObject
  4950. /** 需要基础库: `2.10.4`
  4951. *
  4952. * 网络请求过程中一些调试信息 */
  4953. profile: SocketProfile
  4954. }
  4955. interface OnPageNotFoundListenerResult {
  4956. /** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */
  4957. isEntryPage: boolean
  4958. /** 不存在页面的路径 (代码包路径) */
  4959. path: string
  4960. /** 打开不存在页面的 query 参数 */
  4961. query: IAnyObject
  4962. }
  4963. interface OnScreenRecordingStateChangedListenerResult {
  4964. /** 录屏状态
  4965. *
  4966. * 可选值:
  4967. * - 'start': 开始录屏;
  4968. * - 'stop': 结束录屏; */
  4969. state: 'start' | 'stop'
  4970. }
  4971. interface OnSocketOpenListenerResult {
  4972. /** 需要基础库: `2.0.0`
  4973. *
  4974. * 连接成功的 HTTP 响应 Header */
  4975. header: IAnyObject
  4976. }
  4977. interface OnStopListenerResult {
  4978. /** 录音总时长,单位:ms */
  4979. duration: number
  4980. /** 录音文件大小,单位:Byte */
  4981. fileSize: number
  4982. /** 录音文件的临时路径 (本地路径) */
  4983. tempFilePath: string
  4984. }
  4985. interface OnThemeChangeListenerResult {
  4986. /** 系统当前的主题,取值为`light`或`dark`
  4987. *
  4988. * 可选值:
  4989. * - 'dark': 深色主题;
  4990. * - 'light': 浅色主题; */
  4991. theme: 'dark' | 'light'
  4992. }
  4993. interface OnUnhandledRejectionListenerResult {
  4994. /** 被拒绝的 Promise 对象 */
  4995. promise: Promise<any>
  4996. /** 拒绝原因,一般是一个 Error 对象 */
  4997. reason: string
  4998. }
  4999. interface OnVoIPChatInterruptedListenerResult {
  5000. /** 错误码 */
  5001. errCode: number
  5002. /** 调用结果(错误原因) */
  5003. errMsg: string
  5004. }
  5005. interface OnVoIPChatMembersChangedListenerResult {
  5006. /** 错误码 */
  5007. errCode: number
  5008. /** 调用结果 */
  5009. errMsg: string
  5010. /** 还在实时语音通话中的成员 openId 名单 */
  5011. openIdList: string[]
  5012. }
  5013. interface OnVoIPChatSpeakersChangedListenerResult {
  5014. /** 错误码 */
  5015. errCode: number
  5016. /** 调用结果(错误原因) */
  5017. errMsg: string
  5018. /** 还在实时语音通话中的成员 openId 名单 */
  5019. openIdList: string[]
  5020. }
  5021. interface OnVoIPChatStateChangedListenerResult {
  5022. /** 事件码 */
  5023. code: number
  5024. /** 附加信息 */
  5025. data: IAnyObject
  5026. /** 错误码 */
  5027. errCode: number
  5028. /** 调用结果 */
  5029. errMsg: string
  5030. }
  5031. interface OnVoIPVideoMembersChangedListenerResult {
  5032. /** 错误码 */
  5033. errCode: number
  5034. /** 调用结果 */
  5035. errMsg: string
  5036. /** 开启视频的成员名单 */
  5037. openIdList: string[]
  5038. }
  5039. interface OnWifiConnectedListenerResult {
  5040. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  5041. *
  5042. * Wi-Fi 信息 */
  5043. wifi: WifiInfo
  5044. }
  5045. interface OnWifiConnectedWithPartialInfoListenerResult {
  5046. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  5047. *
  5048. * 只包含 SSID 属性的 WifiInfo 对象 */
  5049. wifi: WifiInfo
  5050. }
  5051. interface OnWindowResizeListenerResult {
  5052. size: Size
  5053. }
  5054. interface OpenAppAuthorizeSettingOption {
  5055. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5056. complete?: OpenAppAuthorizeSettingCompleteCallback
  5057. /** 接口调用失败的回调函数 */
  5058. fail?: OpenAppAuthorizeSettingFailCallback
  5059. /** 接口调用成功的回调函数 */
  5060. success?: OpenAppAuthorizeSettingSuccessCallback
  5061. }
  5062. interface OpenBluetoothAdapterOption {
  5063. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5064. complete?: OpenBluetoothAdapterCompleteCallback
  5065. /** 接口调用失败的回调函数 */
  5066. fail?: OpenBluetoothAdapterFailCallback
  5067. /** 需要基础库: `2.10.0`
  5068. *
  5069. * 蓝牙模式,可作为主/从设备,仅 iOS 需要。
  5070. *
  5071. * 可选值:
  5072. * - 'central': 主机模式;
  5073. * - 'peripheral': 从机(外围设备)模式; */
  5074. mode?: 'central' | 'peripheral'
  5075. /** 接口调用成功的回调函数 */
  5076. success?: OpenBluetoothAdapterSuccessCallback
  5077. }
  5078. interface OpenCardOption {
  5079. /** 需要打开的卡券列表 */
  5080. cardList: OpenCardRequestInfo[]
  5081. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5082. complete?: OpenCardCompleteCallback
  5083. /** 接口调用失败的回调函数 */
  5084. fail?: OpenCardFailCallback
  5085. /** 接口调用成功的回调函数 */
  5086. success?: OpenCardSuccessCallback
  5087. }
  5088. /** 需要打开的卡券列表 */
  5089. interface OpenCardRequestInfo {
  5090. /** 卡券 ID */
  5091. cardId: string
  5092. /** 由 [wx.addCard](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html) 的返回对象中的加密 code 通过解密后得到,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */
  5093. code: string
  5094. }
  5095. interface OpenChannelsActivityOption {
  5096. /** 视频 feedId */
  5097. feedId: string
  5098. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  5099. finderUserName: string
  5100. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5101. complete?: OpenChannelsActivityCompleteCallback
  5102. /** 接口调用失败的回调函数 */
  5103. fail?: OpenChannelsActivityFailCallback
  5104. /** 接口调用成功的回调函数 */
  5105. success?: OpenChannelsActivitySuccessCallback
  5106. }
  5107. interface OpenChannelsEventOption {
  5108. /** 活动 id */
  5109. eventId: string
  5110. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  5111. finderUserName: string
  5112. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5113. complete?: OpenChannelsEventCompleteCallback
  5114. /** 接口调用失败的回调函数 */
  5115. fail?: OpenChannelsEventFailCallback
  5116. /** 接口调用成功的回调函数 */
  5117. success?: OpenChannelsEventSuccessCallback
  5118. }
  5119. interface OpenChannelsLiveOption {
  5120. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  5121. finderUserName: string
  5122. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5123. complete?: OpenChannelsLiveCompleteCallback
  5124. /** 接口调用失败的回调函数 */
  5125. fail?: OpenChannelsLiveFailCallback
  5126. /** 直播 feedId,通过 getChannelsLiveInfo 接口获取(基础库 v2.19.2 之前的版本需要填写) */
  5127. feedId?: string
  5128. /** 直播 nonceId,通过 getChannelsLiveInfo 接口获取(基础库 v2.19.2 之前的版本需要填写) */
  5129. nonceId?: string
  5130. /** 接口调用成功的回调函数 */
  5131. success?: OpenChannelsLiveSuccessCallback
  5132. }
  5133. interface OpenChannelsUserProfileOption {
  5134. /** 视频号 id */
  5135. finderUserName: string
  5136. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5137. complete?: OpenChannelsUserProfileCompleteCallback
  5138. /** 接口调用失败的回调函数 */
  5139. fail?: OpenChannelsUserProfileFailCallback
  5140. /** 接口调用成功的回调函数 */
  5141. success?: OpenChannelsUserProfileSuccessCallback
  5142. }
  5143. interface OpenCustomerServiceChatOption {
  5144. /** 企业ID */
  5145. corpId: string
  5146. /** 客服信息 */
  5147. extInfo: ExtInfoOption
  5148. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5149. complete?: OpenCustomerServiceChatCompleteCallback
  5150. /** 接口调用失败的回调函数 */
  5151. fail?: OpenCustomerServiceChatFailCallback
  5152. /** 气泡消息图片 */
  5153. sendMessageImg?: string
  5154. /** 气泡消息小程序路径 */
  5155. sendMessagePath?: string
  5156. /** 气泡消息标题 */
  5157. sendMessageTitle?: string
  5158. /** 是否发送小程序气泡消息 */
  5159. showMessageCard?: boolean
  5160. /** 接口调用成功的回调函数 */
  5161. success?: OpenCustomerServiceChatSuccessCallback
  5162. }
  5163. interface OpenDocumentOption {
  5164. /** 文件路径 (本地路径) ,可通过 downloadFile 获得 */
  5165. filePath: string
  5166. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5167. complete?: OpenDocumentCompleteCallback
  5168. /** 接口调用失败的回调函数 */
  5169. fail?: OpenDocumentFailCallback
  5170. /** 需要基础库: `1.4.0`
  5171. *
  5172. * 文件类型,指定文件类型打开文件
  5173. *
  5174. * 可选值:
  5175. * - 'doc': doc 格式;
  5176. * - 'docx': docx 格式;
  5177. * - 'xls': xls 格式;
  5178. * - 'xlsx': xlsx 格式;
  5179. * - 'ppt': ppt 格式;
  5180. * - 'pptx': pptx 格式;
  5181. * - 'pdf': pdf 格式; */
  5182. fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf'
  5183. /** 需要基础库: `2.11.0`
  5184. *
  5185. * 是否显示右上角菜单 */
  5186. showMenu?: boolean
  5187. /** 接口调用成功的回调函数 */
  5188. success?: OpenDocumentSuccessCallback
  5189. }
  5190. interface OpenEmbeddedMiniProgramOption {
  5191. /** 要打开的小程序 appId */
  5192. appId: string
  5193. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5194. complete?: OpenEmbeddedMiniProgramCompleteCallback
  5195. /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。
  5196. *
  5197. * 可选值:
  5198. * - 'develop': 开发版;
  5199. * - 'trial': 体验版;
  5200. * - 'release': 正式版; */
  5201. envVersion?: 'develop' | 'trial' | 'release'
  5202. /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
  5203. extraData?: IAnyObject
  5204. /** 接口调用失败的回调函数 */
  5205. fail?: OpenEmbeddedMiniProgramFailCallback
  5206. /** 需要基础库: `2.24.0`
  5207. *
  5208. * 不reLaunch目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query、apiCategory与上次启动相同。 */
  5209. noRelaunchIfPathUnchanged?: boolean
  5210. /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
  5211. path?: string
  5212. /** 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。仅 verify=binding 支持。 */
  5213. shortLink?: string
  5214. /** 接口调用成功的回调函数 */
  5215. success?: OpenEmbeddedMiniProgramSuccessCallback
  5216. /** 需要基础库: `2.24.3`
  5217. *
  5218. * 校验方式。
  5219. *
  5220. * 可选值:
  5221. * - 'binding': 校验小程序管理后台的绑定关系。;
  5222. * - 'unionProduct': 校验目标打开链接是否为[小程序联盟](https://developers.weixin.qq.com/doc/ministore/union/brief-introduction.html)商品。; */
  5223. verify?: 'binding' | 'unionProduct'
  5224. }
  5225. interface OpenFailCallbackResult {
  5226. /** 错误信息
  5227. *
  5228. * 可选值:
  5229. * - 'fail no such file or directory "${filePath}"': 上级目录不存在; */
  5230. errMsg: string
  5231. }
  5232. interface OpenLocationOption {
  5233. /** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  5234. latitude: number
  5235. /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  5236. longitude: number
  5237. /** 地址的详细说明 */
  5238. address?: string
  5239. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5240. complete?: OpenLocationCompleteCallback
  5241. /** 接口调用失败的回调函数 */
  5242. fail?: OpenLocationFailCallback
  5243. /** 位置名 */
  5244. name?: string
  5245. /** 缩放比例,范围5~18 */
  5246. scale?: number
  5247. /** 接口调用成功的回调函数 */
  5248. success?: OpenLocationSuccessCallback
  5249. }
  5250. interface OpenMapAppOption {
  5251. /** 目的地名称 */
  5252. destination: string
  5253. /** 目的地纬度 */
  5254. latitude: number
  5255. /** 目的地经度 */
  5256. longitude: number
  5257. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5258. complete?: OpenMapAppCompleteCallback
  5259. /** 接口调用失败的回调函数 */
  5260. fail?: OpenMapAppFailCallback
  5261. /** 接口调用成功的回调函数 */
  5262. success?: OpenMapAppSuccessCallback
  5263. }
  5264. interface OpenOption {
  5265. /** 文件路径 (本地路径) */
  5266. filePath: string
  5267. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5268. complete?: OpenCompleteCallback
  5269. /** 接口调用失败的回调函数 */
  5270. fail?: OpenFailCallback
  5271. /** 文件系统标志,默认值: 'r'
  5272. *
  5273. * 可选值:
  5274. * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件;
  5275. * - 'ax': 类似于 'a',但如果路径存在,则失败;
  5276. * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件;
  5277. * - 'ax+': 类似于 'a+',但如果路径存在,则失败;
  5278. * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件;
  5279. * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件;
  5280. * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常;
  5281. * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常;
  5282. * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  5283. * - 'wx': 类似于 'w',但如果路径存在,则失败;
  5284. * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  5285. * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */
  5286. flag?:
  5287. | 'a'
  5288. | 'ax'
  5289. | 'a+'
  5290. | 'ax+'
  5291. | 'as'
  5292. | 'as+'
  5293. | 'r'
  5294. | 'r+'
  5295. | 'w'
  5296. | 'wx'
  5297. | 'w+'
  5298. | 'wx+'
  5299. /** 接口调用成功的回调函数 */
  5300. success?: OpenSuccessCallback
  5301. }
  5302. interface OpenSettingOption {
  5303. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5304. complete?: OpenSettingCompleteCallback
  5305. /** 接口调用失败的回调函数 */
  5306. fail?: OpenSettingFailCallback
  5307. /** 接口调用成功的回调函数 */
  5308. success?: OpenSettingSuccessCallback
  5309. /** 需要基础库: `2.10.3`
  5310. *
  5311. * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
  5312. withSubscriptions?: boolean
  5313. }
  5314. interface OpenSettingSuccessCallbackResult {
  5315. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  5316. *
  5317. * 用户授权结果 */
  5318. authSetting: AuthSetting
  5319. /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
  5320. *
  5321. * 需要基础库: `2.10.3`
  5322. *
  5323. * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 */
  5324. subscriptionsSetting: SubscriptionsSetting
  5325. errMsg: string
  5326. }
  5327. interface OpenSuccessCallbackResult {
  5328. /** 文件描述符 */
  5329. fd: string
  5330. errMsg: string
  5331. }
  5332. interface OpenSyncOption {
  5333. /** 文件路径 (本地路径) */
  5334. filePath: string
  5335. /** 文件系统标志,默认值: 'r'
  5336. *
  5337. * 可选值:
  5338. * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件;
  5339. * - 'ax': 类似于 'a',但如果路径存在,则失败;
  5340. * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件;
  5341. * - 'ax+': 类似于 'a+',但如果路径存在,则失败;
  5342. * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件;
  5343. * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件;
  5344. * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常;
  5345. * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常;
  5346. * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  5347. * - 'wx': 类似于 'w',但如果路径存在,则失败;
  5348. * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  5349. * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */
  5350. flag?:
  5351. | 'a'
  5352. | 'ax'
  5353. | 'a+'
  5354. | 'ax+'
  5355. | 'as'
  5356. | 'as+'
  5357. | 'r'
  5358. | 'r+'
  5359. | 'w'
  5360. | 'wx'
  5361. | 'w+'
  5362. | 'wx+'
  5363. }
  5364. interface OpenSystemBluetoothSettingOption {
  5365. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5366. complete?: OpenSystemBluetoothSettingCompleteCallback
  5367. /** 接口调用失败的回调函数 */
  5368. fail?: OpenSystemBluetoothSettingFailCallback
  5369. /** 接口调用成功的回调函数 */
  5370. success?: OpenSystemBluetoothSettingSuccessCallback
  5371. }
  5372. interface OpenVideoEditorOption {
  5373. /** 视频源的路径,只支持本地路径 */
  5374. filePath: string
  5375. /** 需要基础库: `2.16.1`
  5376. *
  5377. * 视频裁剪的最大长度 */
  5378. maxDuration: string
  5379. /** 需要基础库: `2.16.1`
  5380. *
  5381. * 视频裁剪的最小长度 */
  5382. minDuration: string
  5383. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5384. complete?: OpenVideoEditorCompleteCallback
  5385. /** 接口调用失败的回调函数 */
  5386. fail?: OpenVideoEditorFailCallback
  5387. /** 接口调用成功的回调函数 */
  5388. success?: OpenVideoEditorSuccessCallback
  5389. }
  5390. interface OpenVideoEditorSuccessCallbackResult {
  5391. /** 剪辑后生成的视频文件的时长,单位毫秒(ms) */
  5392. duration: number
  5393. /** 剪辑后生成的视频文件大小,单位字节数(byte) */
  5394. size: number
  5395. /** 编辑后生成的视频文件的临时路径 */
  5396. tempFilePath: string
  5397. /** 编辑后生成的缩略图文件的临时路径 */
  5398. tempThumbPath: string
  5399. errMsg: string
  5400. }
  5401. interface PageScrollToOption {
  5402. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5403. complete?: PageScrollToCompleteCallback
  5404. /** 滚动动画的时长,单位 ms */
  5405. duration?: number
  5406. /** 接口调用失败的回调函数 */
  5407. fail?: PageScrollToFailCallback
  5408. /** 需要基础库: `2.23.1`
  5409. *
  5410. * 偏移距离,需要和 selector 参数搭配使用,可以滚动到 selector 加偏移距离的位置,单位 px */
  5411. offsetTop?: number
  5412. /** 滚动到页面的目标位置,单位 px */
  5413. scrollTop?: number
  5414. /** 需要基础库: `2.7.3`
  5415. *
  5416. * 选择器 */
  5417. selector?: string
  5418. /** 接口调用成功的回调函数 */
  5419. success?: PageScrollToSuccessCallback
  5420. }
  5421. /** 需要基础库: `2.11.0`
  5422. *
  5423. * Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。 */
  5424. interface Path2D {}
  5425. interface PauseBGMOption {
  5426. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5427. complete?: PauseBGMCompleteCallback
  5428. /** 接口调用失败的回调函数 */
  5429. fail?: PauseBGMFailCallback
  5430. /** 接口调用成功的回调函数 */
  5431. success?: PauseBGMSuccessCallback
  5432. }
  5433. interface PauseBackgroundAudioOption {
  5434. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5435. complete?: PauseBackgroundAudioCompleteCallback
  5436. /** 接口调用失败的回调函数 */
  5437. fail?: PauseBackgroundAudioFailCallback
  5438. /** 接口调用成功的回调函数 */
  5439. success?: PauseBackgroundAudioSuccessCallback
  5440. }
  5441. interface PauseOption {
  5442. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5443. complete?: PauseCompleteCallback
  5444. /** 接口调用失败的回调函数 */
  5445. fail?: PauseFailCallback
  5446. /** 接口调用成功的回调函数 */
  5447. success?: PauseSuccessCallback
  5448. }
  5449. interface PauseVoiceOption {
  5450. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5451. complete?: PauseVoiceCompleteCallback
  5452. /** 接口调用失败的回调函数 */
  5453. fail?: PauseVoiceFailCallback
  5454. /** 接口调用成功的回调函数 */
  5455. success?: PauseVoiceSuccessCallback
  5456. }
  5457. /** 单条性能数据。具体数据口径请参考[性能数据文档]((performance/perf_data##_1-4-%E9%80%9A%E8%BF%87-wx-getPerformance-%E5%9C%A8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%86%85%E8%8E%B7%E5%8F%96)) */
  5458. interface PerformanceEntry {
  5459. /** 需要基础库: `2.24.0`
  5460. *
  5461. * 解析域名结束时间。仅 resourceTiming 指标有效。 */
  5462. domainLookupEnd: number
  5463. /** 需要基础库: `2.24.0`
  5464. *
  5465. * 解析域名开始时间。仅 resourceTiming 指标有效。 */
  5466. domainLookupStart: number
  5467. /** 耗时 ms。仅对于表示阶段的指标有效。 */
  5468. duration: number
  5469. /** 指标类型
  5470. *
  5471. * 可选值:
  5472. * - 'navigation': 路由;
  5473. * - 'render': 渲染;
  5474. * - 'script': 脚本; */
  5475. entryType: 'navigation' | 'render' | 'script'
  5476. /** 需要基础库: `2.21.2`
  5477. *
  5478. * 注入文件列表。仅 evaluateScript 指标有效。 */
  5479. fileList: string[]
  5480. /** 需要基础库: `2.21.2`
  5481. *
  5482. * 首次渲染参数在渲染层收到的时间。仅 firstRender 指标有效。 */
  5483. initDataRecvTime: number
  5484. /** 需要基础库: `2.21.2`
  5485. *
  5486. * 首次渲染参数从逻辑层发出的时间。仅 firstRender 指标有效。 */
  5487. initDataSendTime: number
  5488. /** 需要基础库: `2.24.0`
  5489. *
  5490. * 初始化性能条目的资源类型。仅 resourceTiming 指标有效。
  5491. *
  5492. * 可选值:
  5493. * - 'audio': 音频;
  5494. * - 'cover-image': cover-image 组件的图片;
  5495. * - 'image': 组件的图片;
  5496. * - 'open-data': 组件的图片; */
  5497. initiatorType: 'audio' | 'cover-image' | 'image' | 'open-data'
  5498. /** 分包名,主包表示为 __APP__ (2.21.2 开始)。仅 evaluateScript 指标有效。 */
  5499. moduleName: string
  5500. /** 指标名称
  5501. *
  5502. * 可选值:
  5503. * - 'appLaunch': 小程序启动耗时。(entryType: navigation);
  5504. * - 'route': 路由处理耗时。(entryType: navigation);
  5505. * - 'firstRender': 页面首次渲染耗时。(entryType: render);
  5506. * - 'firstPaint': 页面首次绘制(FP)时间点,无 duration。(iOS 不支持)(entryType: render);
  5507. * - 'firstContentfulPaint': 页面首次内容绘制(FCP)时间点,无 duration。(iOS 14.5 以下版本不支持)(entryType: render);
  5508. * - 'largestContentfulPaint': 页面最大内容绘制(LCP)时间点,无 duration。(iOS 不支持)(entryType: render);
  5509. * - 'evaluateScript': 逻辑层 JS 代码注入耗时。(entryType: script);
  5510. * - 'downloadPackage': 代码包下载耗时。(entryType: loadPackage);
  5511. * - 'resourceTiming': 视图层资源加载耗时。(entryType: resource); */
  5512. name:
  5513. | 'appLaunch'
  5514. | 'route'
  5515. | 'firstRender'
  5516. | 'firstPaint'
  5517. | 'firstContentfulPaint'
  5518. | 'largestContentfulPaint'
  5519. | 'evaluateScript'
  5520. | 'downloadPackage'
  5521. | 'resourceTiming'
  5522. /** 路由真正响应开始时间。仅 navigation 类型指标有效。 */
  5523. navigationStart: number
  5524. /** 路由详细类型,与小程序路由方法对应。仅 navigation 类型指标有效。 */
  5525. navigationType: string
  5526. /** 需要基础库: `2.24.0`
  5527. *
  5528. * 代码包名称。仅 downloadPackage 指标有效。 */
  5529. packageName: string
  5530. /** 需要基础库: `2.24.0`
  5531. *
  5532. * 代码包大小。仅 downloadPackage 指标有效。 */
  5533. packageSize: number
  5534. /** 需要基础库: `2.23.1`
  5535. *
  5536. * path 对应页面实例 Id(随机生成,不保证递增)。仅 render/navigation 指标有效。 */
  5537. pageId: number
  5538. /** 页面路径。仅 render 和 navigation 类型指标有效。 */
  5539. path: string
  5540. /** 需要基础库: `2.23.1`
  5541. *
  5542. * referrerPath对应页面实例 Id(随机生成,不保证递增)。仅 route 指标有效。 */
  5543. referrerPageId: number
  5544. /** 需要基础库: `2.23.1`
  5545. *
  5546. * 页面跳转来源页面路径。仅 route 指标有效。 */
  5547. referrerPath: number
  5548. /** 开始时间,不同指标的具体含义会有差异。 */
  5549. startTime: number
  5550. /** 需要基础库: `2.24.0`
  5551. *
  5552. * 表示获取资源的大小(以八位字节为单位)的数字。仅 resourceTiming 指标有效。(iOS 不支持) */
  5553. transferSize: number
  5554. /** 需要基础库: `2.24.0`
  5555. *
  5556. * 资源路径。仅 resourceTiming 指标有效。 */
  5557. uri: string
  5558. /** 需要基础库: `2.21.2`
  5559. *
  5560. * 渲染层代码注入完成时间。仅 firstRender 指标有效。 */
  5561. viewLayerReadyTime: number
  5562. /** 需要基础库: `2.21.2`
  5563. *
  5564. * 渲染层执行渲染结束时间。仅 firstRender 指标有效。 */
  5565. viewLayerRenderEndTime: number
  5566. /** 需要基础库: `2.21.2`
  5567. *
  5568. * 渲染层执行渲染开始时间。仅 firstRender 指标有效。 */
  5569. viewLayerRenderStartTime: number
  5570. }
  5571. /** 需要基础库: `2.11.0`
  5572. *
  5573. * PerformanceObserver 对象,用于监听性能相关事件 */
  5574. interface PerformanceObserver {
  5575. /** 获取当前支持的所有性能指标类型 */
  5576. supportedEntryTypes: any[]
  5577. }
  5578. /** 平面跟踪配置 */
  5579. interface PlaneTrack {
  5580. /** 平面跟踪配置模式
  5581. *
  5582. * 可选值:
  5583. * - 1: 检测横向平面;
  5584. * - 2: 检测纵向平面,只有 v2 版本支持;
  5585. * - 3: 检测横向和纵向平面,只有 v2 版本支持; */
  5586. mode: 1 | 2 | 3
  5587. }
  5588. interface PlayBGMOption {
  5589. /** 加入背景混音的资源地址 */
  5590. url: string
  5591. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5592. complete?: PlayBGMCompleteCallback
  5593. /** 接口调用失败的回调函数 */
  5594. fail?: PlayBGMFailCallback
  5595. /** 接口调用成功的回调函数 */
  5596. success?: PlayBGMSuccessCallback
  5597. }
  5598. interface PlayBackgroundAudioOption {
  5599. /** 音乐链接,目前支持的格式有 m4a, aac, mp3, wav */
  5600. dataUrl: string
  5601. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5602. complete?: PlayBackgroundAudioCompleteCallback
  5603. /** 封面URL */
  5604. coverImgUrl?: string
  5605. /** 接口调用失败的回调函数 */
  5606. fail?: PlayBackgroundAudioFailCallback
  5607. /** 接口调用成功的回调函数 */
  5608. success?: PlayBackgroundAudioSuccessCallback
  5609. /** 音乐标题 */
  5610. title?: string
  5611. }
  5612. interface PlayOption {
  5613. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5614. complete?: PlayCompleteCallback
  5615. /** 接口调用失败的回调函数 */
  5616. fail?: PlayFailCallback
  5617. /** 接口调用成功的回调函数 */
  5618. success?: PlaySuccessCallback
  5619. }
  5620. interface PlayVoiceOption {
  5621. /** 需要播放的语音文件的文件路径 (本地路径) */
  5622. filePath: string
  5623. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5624. complete?: PlayVoiceCompleteCallback
  5625. /** 需要基础库: `1.6.0`
  5626. *
  5627. * 指定播放时长,到达指定的播放时长后会自动停止播放,单位:秒 */
  5628. duration?: number
  5629. /** 接口调用失败的回调函数 */
  5630. fail?: PlayVoiceFailCallback
  5631. /** 接口调用成功的回调函数 */
  5632. success?: PlayVoiceSuccessCallback
  5633. }
  5634. /** 插件帐号信息(仅在插件中调用时包含这一项) */
  5635. interface Plugin {
  5636. /** 插件 appId */
  5637. appId: string
  5638. /** 插件版本号 */
  5639. version: string
  5640. }
  5641. interface PluginLoginOption {
  5642. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5643. complete?: PluginLoginCompleteCallback
  5644. /** 接口调用失败的回调函数 */
  5645. fail?: PluginLoginFailCallback
  5646. /** 接口调用成功的回调函数 */
  5647. success?: PluginLoginSuccessCallback
  5648. }
  5649. interface PluginLoginSuccessCallbackResult {
  5650. /** 用于换取 openpid 的凭证(有效期五分钟)。插件开发者可以用此 code 在开发者服务器后台调用 [auth.getPluginOpenPId](#) 换取 openpid。 */
  5651. code: string
  5652. errMsg: string
  5653. }
  5654. interface PreDownloadSubpackageOption {
  5655. /** 分包加载结束回调事件(加载成功、失败都会执行) */
  5656. complete: (...args: any[]) => any
  5657. /** 分包加载失败回调事件 */
  5658. fail: (...args: any[]) => any
  5659. /** 分包的类型。目前仅支持填 "workers",表示 workers 分包。 */
  5660. packageType: string
  5661. /** 分包加载成功回调事件 */
  5662. success: (...args: any[]) => any
  5663. }
  5664. interface PreDownloadSubpackageTaskOnProgressUpdateListenerResult {
  5665. /** 分包下载进度百分比 */
  5666. progress: number
  5667. /** 预期需要下载的数据总长度,单位 Bytes */
  5668. totalBytesExpectedToWrite: number
  5669. /** 已经下载的数据长度,单位 Bytes */
  5670. totalBytesWritten: number
  5671. }
  5672. interface PreloadAssetsOption {
  5673. data: Asset[]
  5674. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5675. complete?: PreloadAssetsCompleteCallback
  5676. /** 接口调用失败的回调函数 */
  5677. fail?: PreloadAssetsFailCallback
  5678. /** 接口调用成功的回调函数 */
  5679. success?: PreloadAssetsSuccessCallback
  5680. }
  5681. interface PreloadSkylineViewOption {
  5682. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5683. complete?: PreloadSkylineViewCompleteCallback
  5684. /** 接口调用失败的回调函数 */
  5685. fail?: PreloadSkylineViewFailCallback
  5686. /** 接口调用成功的回调函数 */
  5687. success?: PreloadSkylineViewSuccessCallback
  5688. }
  5689. interface PreloadWebviewOption {
  5690. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5691. complete?: PreloadWebviewCompleteCallback
  5692. /** 接口调用失败的回调函数 */
  5693. fail?: PreloadWebviewFailCallback
  5694. /** 接口调用成功的回调函数 */
  5695. success?: PreloadWebviewSuccessCallback
  5696. }
  5697. interface PreviewImageOption {
  5698. /** 需要预览的图片链接列表。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持云文件ID。 */
  5699. urls: string[]
  5700. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5701. complete?: PreviewImageCompleteCallback
  5702. /** 当前显示图片的链接 */
  5703. current?: string
  5704. /** 接口调用失败的回调函数 */
  5705. fail?: PreviewImageFailCallback
  5706. /** 需要基础库: `2.13.0`
  5707. *
  5708. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  5709. referrerPolicy?: string
  5710. /** 需要基础库: `2.13.0`
  5711. *
  5712. * 是否显示长按菜单。 */
  5713. showmenu?: boolean
  5714. /** 接口调用成功的回调函数 */
  5715. success?: PreviewImageSuccessCallback
  5716. }
  5717. interface PreviewMediaOption {
  5718. /** 需要预览的资源列表 */
  5719. sources: MediaSource[]
  5720. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5721. complete?: PreviewMediaCompleteCallback
  5722. /** 当前显示的资源序号 */
  5723. current?: number
  5724. /** 接口调用失败的回调函数 */
  5725. fail?: PreviewMediaFailCallback
  5726. /** 需要基础库: `2.13.0`
  5727. *
  5728. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  5729. referrerPolicy?: string
  5730. /** 需要基础库: `2.13.0`
  5731. *
  5732. * 是否显示长按菜单。 */
  5733. showmenu?: boolean
  5734. /** 接口调用成功的回调函数 */
  5735. success?: PreviewMediaSuccessCallback
  5736. }
  5737. /** 推广员 */
  5738. interface PromoterResult {
  5739. /** 推广员昵称 */
  5740. finderNickname: string
  5741. /** 推广员 id */
  5742. promoterId: string
  5743. /** 推广员 openid */
  5744. promoterOpenId: string
  5745. }
  5746. interface ReLaunchOption {
  5747. /** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */
  5748. url: string
  5749. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5750. complete?: ReLaunchCompleteCallback
  5751. /** 接口调用失败的回调函数 */
  5752. fail?: ReLaunchFailCallback
  5753. /** 接口调用成功的回调函数 */
  5754. success?: ReLaunchSuccessCallback
  5755. }
  5756. interface ReadBLECharacteristicValueOption {
  5757. /** 蓝牙特征的 UUID */
  5758. characteristicId: string
  5759. /** 蓝牙设备 id */
  5760. deviceId: string
  5761. /** 蓝牙特征对应服务的 UUID */
  5762. serviceId: string
  5763. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5764. complete?: ReadBLECharacteristicValueCompleteCallback
  5765. /** 接口调用失败的回调函数 */
  5766. fail?: ReadBLECharacteristicValueFailCallback
  5767. /** 接口调用成功的回调函数 */
  5768. success?: ReadBLECharacteristicValueSuccessCallback
  5769. }
  5770. interface ReadCompressedFileFailCallbackResult {
  5771. /** 错误信息
  5772. *
  5773. * 可选值:
  5774. * - 'fail decompress fail': 指定的 compressionAlgorithm 与文件实际压缩格式不符;
  5775. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
  5776. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; */
  5777. errMsg: string
  5778. }
  5779. interface ReadCompressedFileOption {
  5780. /** 文件压缩类型,目前仅支持 'br'。
  5781. *
  5782. * 可选值:
  5783. * - 'br': brotli压缩文件; */
  5784. compressionAlgorithm: 'br'
  5785. /** 要读取的文件的路径 (本地用户文件或代码包文件) */
  5786. filePath: string
  5787. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5788. complete?: ReadCompressedFileCompleteCallback
  5789. /** 接口调用失败的回调函数 */
  5790. fail?: ReadCompressedFileFailCallback
  5791. /** 接口调用成功的回调函数 */
  5792. success?: ReadCompressedFileSuccessCallback
  5793. }
  5794. interface ReadCompressedFileSuccessCallbackResult {
  5795. /** 文件内容 */
  5796. data: ArrayBuffer
  5797. errMsg: string
  5798. }
  5799. interface ReadCompressedFileSyncOption {
  5800. /** 文件压缩类型,目前仅支持 'br'。
  5801. *
  5802. * 可选值:
  5803. * - 'br': brotli压缩文件; */
  5804. compressionAlgorithm: 'br'
  5805. /** 要读取的文件的路径 (本地用户文件或代码包文件) */
  5806. filePath: string
  5807. }
  5808. interface ReadFailCallbackResult {
  5809. /** 错误信息
  5810. *
  5811. * 可选值:
  5812. * - 'bad file descriptor': 无效的文件描述符;
  5813. * - 'fail permission denied': 指定的 fd 路径没有读权限;
  5814. * - 'fail the value of "offset" is out of range': 传入的 offset 不合法;
  5815. * - 'fail the value of "length" is out of range': 传入的 length 不合法;
  5816. * - 'fail sdcard not mounted': android sdcard 挂载失败;
  5817. * - 'bad file descriptor': 无效的文件描述符; */
  5818. errMsg: string
  5819. }
  5820. interface ReadFileFailCallbackResult {
  5821. /** 错误信息
  5822. *
  5823. * 可选值:
  5824. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
  5825. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限;
  5826. * - 'fail sdcard not mounted': Android sdcard 挂载失败;
  5827. * - 'native buffer exceed size limit': 文件大小超出上限(100M); */
  5828. errMsg: string
  5829. }
  5830. interface ReadFileOption {
  5831. /** 要读取的文件的路径 (本地路径) */
  5832. filePath: string
  5833. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5834. complete?: ReadFileCompleteCallback
  5835. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  5836. *
  5837. * 可选值:
  5838. * - 'ascii': ;
  5839. * - 'base64': ;
  5840. * - 'binary': ;
  5841. * - 'hex': ;
  5842. * - 'ucs2': 以小端序读取;
  5843. * - 'ucs-2': 以小端序读取;
  5844. * - 'utf16le': 以小端序读取;
  5845. * - 'utf-16le': 以小端序读取;
  5846. * - 'utf-8': ;
  5847. * - 'utf8': ;
  5848. * - 'latin1': ; */
  5849. encoding?:
  5850. | 'ascii'
  5851. | 'base64'
  5852. | 'binary'
  5853. | 'hex'
  5854. | 'ucs2'
  5855. | 'ucs-2'
  5856. | 'utf16le'
  5857. | 'utf-16le'
  5858. | 'utf-8'
  5859. | 'utf8'
  5860. | 'latin1'
  5861. /** 接口调用失败的回调函数 */
  5862. fail?: ReadFileFailCallback
  5863. /** 需要基础库: `2.10.0`
  5864. *
  5865. * 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
  5866. length?: number
  5867. /** 需要基础库: `2.10.0`
  5868. *
  5869. * 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
  5870. position?: number
  5871. /** 接口调用成功的回调函数 */
  5872. success?: ReadFileSuccessCallback
  5873. }
  5874. interface ReadFileSuccessCallbackResult {
  5875. /** 文件内容 */
  5876. data: string | ArrayBuffer
  5877. errMsg: string
  5878. }
  5879. interface ReadOption {
  5880. /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */
  5881. arrayBuffer: ArrayBuffer
  5882. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  5883. fd: string
  5884. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5885. complete?: ReadCompleteCallback
  5886. /** 接口调用失败的回调函数 */
  5887. fail?: ReadFailCallback
  5888. /** 要从文件中读取的字节数,默认0 */
  5889. length?: number
  5890. /** 缓冲区中的写入偏移量,默认0 */
  5891. offset?: number
  5892. /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */
  5893. position?: number
  5894. /** 接口调用成功的回调函数 */
  5895. success?: ReadSuccessCallback
  5896. }
  5897. /** 文件读取结果。 通过 [FileSystemManager.readSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html) 接口返回 */
  5898. interface ReadResult {
  5899. /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */
  5900. arrayBuffer: ArrayBuffer
  5901. /** 实际读取的字节数 */
  5902. bytesRead: number
  5903. }
  5904. interface ReadSuccessCallbackResult {
  5905. /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */
  5906. arrayBuffer: ArrayBuffer
  5907. /** 实际读取的字节数 */
  5908. bytesRead: number
  5909. errMsg: string
  5910. }
  5911. interface ReadSyncOption {
  5912. /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */
  5913. arrayBuffer: ArrayBuffer
  5914. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  5915. fd: string
  5916. /** 要从文件中读取的字节数,默认0 */
  5917. length?: number
  5918. /** 缓冲区中的写入偏移量,默认0 */
  5919. offset?: number
  5920. /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */
  5921. position?: number
  5922. }
  5923. interface ReadZipEntryFailCallbackResult {
  5924. /** 错误信息
  5925. *
  5926. * 可选值:
  5927. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
  5928. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限;
  5929. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  5930. errMsg: string
  5931. }
  5932. interface ReadZipEntryOption {
  5933. /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */
  5934. entries: EntryItem[] | 'all'
  5935. /** 要读取的压缩包的路径 (本地路径) */
  5936. filePath: string
  5937. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5938. complete?: ReadZipEntryCompleteCallback
  5939. /** 统一指定读取文件的字符编码,只在 entries 值为"all"时有效。如果 entries 值为"all"且不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  5940. *
  5941. * 可选值:
  5942. * - 'ascii': ;
  5943. * - 'base64': ;
  5944. * - 'binary': ;
  5945. * - 'hex': ;
  5946. * - 'ucs2': 以小端序读取;
  5947. * - 'ucs-2': 以小端序读取;
  5948. * - 'utf16le': 以小端序读取;
  5949. * - 'utf-16le': 以小端序读取;
  5950. * - 'utf-8': ;
  5951. * - 'utf8': ;
  5952. * - 'latin1': ; */
  5953. encoding?:
  5954. | 'ascii'
  5955. | 'base64'
  5956. | 'binary'
  5957. | 'hex'
  5958. | 'ucs2'
  5959. | 'ucs-2'
  5960. | 'utf16le'
  5961. | 'utf-16le'
  5962. | 'utf-8'
  5963. | 'utf8'
  5964. | 'latin1'
  5965. /** 接口调用失败的回调函数 */
  5966. fail?: ReadZipEntryFailCallback
  5967. /** 接口调用成功的回调函数 */
  5968. success?: ReadZipEntrySuccessCallback
  5969. }
  5970. interface ReadZipEntrySuccessCallbackResult {
  5971. /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */
  5972. entries: EntriesResult
  5973. errMsg: string
  5974. }
  5975. interface ReaddirFailCallbackResult {
  5976. /** 错误信息
  5977. *
  5978. * 可选值:
  5979. * - 'fail no such file or directory ${dirPath}': 目录不存在;
  5980. * - 'fail not a directory ${dirPath}': dirPath 不是目录;
  5981. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限;
  5982. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  5983. errMsg: string
  5984. }
  5985. interface ReaddirOption {
  5986. /** 要读取的目录路径 (本地路径) */
  5987. dirPath: string
  5988. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5989. complete?: ReaddirCompleteCallback
  5990. /** 接口调用失败的回调函数 */
  5991. fail?: ReaddirFailCallback
  5992. /** 接口调用成功的回调函数 */
  5993. success?: ReaddirSuccessCallback
  5994. }
  5995. interface ReaddirSuccessCallbackResult {
  5996. /** 指定目录下的文件名数组。 */
  5997. files: string[]
  5998. errMsg: string
  5999. }
  6000. interface RecorderManagerStartOption {
  6001. /** 需要基础库: `2.1.0`
  6002. *
  6003. * 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源
  6004. *
  6005. * 可选值:
  6006. * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用;
  6007. * - 'buildInMic': 手机麦克风,仅限 iOS;
  6008. * - 'headsetMic': 有线耳机麦克风,仅限 iOS;
  6009. * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android;
  6010. * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android;
  6011. * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android;
  6012. * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */
  6013. audioSource?:
  6014. | 'auto'
  6015. | 'buildInMic'
  6016. | 'headsetMic'
  6017. | 'mic'
  6018. | 'camcorder'
  6019. | 'voice_communication'
  6020. | 'voice_recognition'
  6021. /** 录音的时长,单位 ms,最大值 600000(10 分钟) */
  6022. duration?: number
  6023. /** 编码码率,有效值见下表格 */
  6024. encodeBitRate?: number
  6025. /** 音频格式
  6026. *
  6027. * 可选值:
  6028. * - 'mp3': mp3 格式;
  6029. * - 'aac': aac 格式;
  6030. * - 'wav': wav 格式;
  6031. * - 'PCM': pcm 格式; */
  6032. format?: 'mp3' | 'aac' | 'wav' | 'PCM'
  6033. /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
  6034. frameSize?: number
  6035. /** 录音通道数
  6036. *
  6037. * 可选值:
  6038. * - 1: 1 个通道;
  6039. * - 2: 2 个通道; */
  6040. numberOfChannels?: 1 | 2
  6041. /** 采样率(pc不支持)
  6042. *
  6043. * 可选值:
  6044. * - 8000: 8000 采样率;
  6045. * - 11025: 11025 采样率;
  6046. * - 12000: 12000 采样率;
  6047. * - 16000: 16000 采样率;
  6048. * - 22050: 22050 采样率;
  6049. * - 24000: 24000 采样率;
  6050. * - 32000: 32000 采样率;
  6051. * - 44100: 44100 采样率;
  6052. * - 48000: 48000 采样率; */
  6053. sampleRate?:
  6054. | 8000
  6055. | 11025
  6056. | 12000
  6057. | 16000
  6058. | 22050
  6059. | 24000
  6060. | 32000
  6061. | 44100
  6062. | 48000
  6063. }
  6064. interface RedirectToOption {
  6065. /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
  6066. url: string
  6067. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6068. complete?: RedirectToCompleteCallback
  6069. /** 接口调用失败的回调函数 */
  6070. fail?: RedirectToFailCallback
  6071. /** 接口调用成功的回调函数 */
  6072. success?: RedirectToSuccessCallback
  6073. }
  6074. interface RedoOption {
  6075. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6076. complete?: RedoCompleteCallback
  6077. /** 接口调用失败的回调函数 */
  6078. fail?: RedoFailCallback
  6079. /** 接口调用成功的回调函数 */
  6080. success?: RedoSuccessCallback
  6081. }
  6082. /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
  6083. interface ReferrerInfo {
  6084. /** 来源小程序、公众号或 App 的 appId */
  6085. appId: string
  6086. /** 来源小程序传过来的数据,scene=1037或1038时支持 */
  6087. extraData: IAnyObject
  6088. }
  6089. /** 参照区域的边界 */
  6090. interface RelativeRectResult {
  6091. /** 下边界 */
  6092. bottom: number
  6093. /** 左边界 */
  6094. left: number
  6095. /** 右边界 */
  6096. right: number
  6097. /** 上边界 */
  6098. top: number
  6099. }
  6100. /** 发送端地址信息 */
  6101. interface RemoteInfo {
  6102. /** 发送消息的 socket 的地址 */
  6103. address: string
  6104. /** 使用的协议族,为 IPv4 或者 IPv6 */
  6105. family: string
  6106. /** 端口号 */
  6107. port: number
  6108. /** message 的大小,单位:字节 */
  6109. size: number
  6110. }
  6111. interface RemoveArcOption {
  6112. /** 圆弧 id */
  6113. id: number
  6114. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6115. complete?: RemoveArcCompleteCallback
  6116. /** 接口调用失败的回调函数 */
  6117. fail?: RemoveArcFailCallback
  6118. /** 接口调用成功的回调函数 */
  6119. success?: RemoveArcSuccessCallback
  6120. }
  6121. interface RemoveCustomLayerOption {
  6122. /** 个性化图层id */
  6123. layerId: string
  6124. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6125. complete?: RemoveCustomLayerCompleteCallback
  6126. /** 接口调用失败的回调函数 */
  6127. fail?: RemoveCustomLayerFailCallback
  6128. /** 接口调用成功的回调函数 */
  6129. success?: RemoveCustomLayerSuccessCallback
  6130. }
  6131. interface RemoveFormatOption {
  6132. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6133. complete?: RemoveFormatCompleteCallback
  6134. /** 接口调用失败的回调函数 */
  6135. fail?: RemoveFormatFailCallback
  6136. /** 接口调用成功的回调函数 */
  6137. success?: RemoveFormatSuccessCallback
  6138. }
  6139. interface RemoveGroundOverlayOption {
  6140. /** 图片图层 id */
  6141. id: string
  6142. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6143. complete?: RemoveGroundOverlayCompleteCallback
  6144. /** 接口调用失败的回调函数 */
  6145. fail?: RemoveGroundOverlayFailCallback
  6146. /** 接口调用成功的回调函数 */
  6147. success?: RemoveGroundOverlaySuccessCallback
  6148. }
  6149. interface RemoveMarkersOption {
  6150. /** marker 的 id 集合。 */
  6151. markerIds: any[]
  6152. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6153. complete?: RemoveMarkersCompleteCallback
  6154. /** 接口调用失败的回调函数 */
  6155. fail?: RemoveMarkersFailCallback
  6156. /** 接口调用成功的回调函数 */
  6157. success?: RemoveMarkersSuccessCallback
  6158. }
  6159. interface RemoveSavedFileFailCallbackResult {
  6160. /** 错误信息
  6161. *
  6162. * 可选值:
  6163. * - 'fail file not exist': 指定的 tempFilePath 找不到文件; */
  6164. errMsg: string
  6165. }
  6166. interface RemoveSavedFileOption {
  6167. /** 需要删除的文件路径 (本地路径) */
  6168. filePath: string
  6169. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6170. complete?: RemoveSavedFileCompleteCallback
  6171. /** 接口调用失败的回调函数 */
  6172. fail?: RemoveSavedFileFailCallback
  6173. /** 接口调用成功的回调函数 */
  6174. success?: RemoveSavedFileSuccessCallback
  6175. }
  6176. interface RemoveServiceOption {
  6177. /** service 的 UUID */
  6178. serviceId: string
  6179. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6180. complete?: RemoveServiceCompleteCallback
  6181. /** 接口调用失败的回调函数 */
  6182. fail?: RemoveServiceFailCallback
  6183. /** 接口调用成功的回调函数 */
  6184. success?: RemoveServiceSuccessCallback
  6185. }
  6186. interface RemoveStorageOption {
  6187. /** 本地缓存中指定的 key */
  6188. key: string
  6189. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6190. complete?: RemoveStorageCompleteCallback
  6191. /** 接口调用失败的回调函数 */
  6192. fail?: RemoveStorageFailCallback
  6193. /** 接口调用成功的回调函数 */
  6194. success?: RemoveStorageSuccessCallback
  6195. }
  6196. interface RemoveTabBarBadgeOption {
  6197. /** tabBar 的哪一项,从左边算起 */
  6198. index: number
  6199. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6200. complete?: RemoveTabBarBadgeCompleteCallback
  6201. /** 接口调用失败的回调函数 */
  6202. fail?: RemoveTabBarBadgeFailCallback
  6203. /** 接口调用成功的回调函数 */
  6204. success?: RemoveTabBarBadgeSuccessCallback
  6205. }
  6206. interface RemoveVisualLayerOption {
  6207. /** 可视化图层id */
  6208. layerId: string
  6209. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6210. complete?: RemoveVisualLayerCompleteCallback
  6211. /** 接口调用失败的回调函数 */
  6212. fail?: RemoveVisualLayerFailCallback
  6213. /** 接口调用成功的回调函数 */
  6214. success?: RemoveVisualLayerSuccessCallback
  6215. }
  6216. interface RenameFailCallbackResult {
  6217. /** 错误信息
  6218. *
  6219. * 可选值:
  6220. * - 'fail permission denied, rename ${oldPath} -> ${newPath}': 指定源文件或目标文件没有写权限;
  6221. * - 'fail no such file or directory, rename ${oldPath} -> ${newPath}': 源文件不存在,或目标文件路径的上层目录不存在; */
  6222. errMsg: string
  6223. }
  6224. interface RenameOption {
  6225. /** 新文件路径,支持本地路径 */
  6226. newPath: string
  6227. /** 源文件路径,支持本地路径 */
  6228. oldPath: string
  6229. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6230. complete?: RenameCompleteCallback
  6231. /** 接口调用失败的回调函数 */
  6232. fail?: RenameFailCallback
  6233. /** 接口调用成功的回调函数 */
  6234. success?: RenameSuccessCallback
  6235. }
  6236. /** Canvas 绘图上下文。
  6237. *
  6238. * ****
  6239. *
  6240. * - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。
  6241. * - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。
  6242. * - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取的 video 对象,2.29.0 起支持传入开启了自定义渲染的 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
  6243. *
  6244. * **示例代码**
  6245. *
  6246. * video 画到 2D Canvas 示例
  6247. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tJTak7mU7sfX) */
  6248. interface RenderingContext {}
  6249. interface RequestOption<
  6250. T extends string | IAnyObject | ArrayBuffer =
  6251. | string
  6252. | IAnyObject
  6253. | ArrayBuffer
  6254. > {
  6255. /** 开发者服务器接口地址 */
  6256. url: string
  6257. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6258. complete?: RequestCompleteCallback
  6259. /** 请求的参数 */
  6260. data?: string | IAnyObject | ArrayBuffer
  6261. /** 返回的数据格式
  6262. *
  6263. * 可选值:
  6264. * - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse;
  6265. * - '其他': 不对返回的内容进行 JSON.parse; */
  6266. dataType?: 'json' | '其他'
  6267. /** 需要基础库: `2.10.4`
  6268. *
  6269. * 开启 cache */
  6270. enableCache?: boolean
  6271. /** 需要基础库: `2.20.2`
  6272. *
  6273. * 开启 transfer-encoding chunked。 */
  6274. enableChunked?: boolean
  6275. /** 需要基础库: `2.10.4`
  6276. *
  6277. * 开启 http2 */
  6278. enableHttp2?: boolean
  6279. /** 需要基础库: `2.19.1`
  6280. *
  6281. * 是否开启 HttpDNS 服务。如开启,需要同时填入 httpDNSServiceId 。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
  6282. enableHttpDNS?: boolean
  6283. /** 需要基础库: `2.10.4`
  6284. *
  6285. * 开启 quic */
  6286. enableQuic?: boolean
  6287. /** 接口调用失败的回调函数 */
  6288. fail?: RequestFailCallback
  6289. /** 需要基础库: `2.21.0`
  6290. *
  6291. * wifi下使用移动网络发送请求 */
  6292. forceCellularNetwork?: boolean
  6293. /** 设置请求的 header,header 中不能设置 Referer。
  6294. *
  6295. * `content-type` 默认为 `application/json` */
  6296. header?: IAnyObject
  6297. /** 需要基础库: `2.19.1`
  6298. *
  6299. * HttpDNS 服务商 Id。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
  6300. httpDNSServiceId?: string
  6301. /** HTTP 请求方法
  6302. *
  6303. * 可选值:
  6304. * - 'OPTIONS': HTTP 请求 OPTIONS;
  6305. * - 'GET': HTTP 请求 GET;
  6306. * - 'HEAD': HTTP 请求 HEAD;
  6307. * - 'POST': HTTP 请求 POST;
  6308. * - 'PUT': HTTP 请求 PUT;
  6309. * - 'DELETE': HTTP 请求 DELETE;
  6310. * - 'TRACE': HTTP 请求 TRACE;
  6311. * - 'CONNECT': HTTP 请求 CONNECT; */
  6312. method?:
  6313. | 'OPTIONS'
  6314. | 'GET'
  6315. | 'HEAD'
  6316. | 'POST'
  6317. | 'PUT'
  6318. | 'DELETE'
  6319. | 'TRACE'
  6320. | 'CONNECT'
  6321. /** 需要基础库: `1.7.0`
  6322. *
  6323. * 响应的数据类型
  6324. *
  6325. * 可选值:
  6326. * - 'text': 响应的数据为文本;
  6327. * - 'arraybuffer': 响应的数据为 ArrayBuffer; */
  6328. responseType?: 'text' | 'arraybuffer'
  6329. /** 接口调用成功的回调函数 */
  6330. success?: RequestSuccessCallback<T>
  6331. /** 需要基础库: `2.10.0`
  6332. *
  6333. * 超时时间,单位为毫秒。默认值为 60000 */
  6334. timeout?: number
  6335. }
  6336. interface RequestOrderPaymentOption {
  6337. /** 随机字符串,长度为32个字符以下 */
  6338. nonceStr: string
  6339. /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
  6340. package: string
  6341. /** 签名,具体见微信支付文档 */
  6342. paySign: string
  6343. /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
  6344. timeStamp: string
  6345. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6346. complete?: RequestOrderPaymentCompleteCallback
  6347. /** 外部APP用户ID */
  6348. extUserUin?: string
  6349. /** 接口调用失败的回调函数 */
  6350. fail?: RequestOrderPaymentFailCallback
  6351. /** 订单信息,仅在需要校验的场景下需要传递,具体见[接口说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/requestOrderPayment) */
  6352. orderInfo?: IAnyObject
  6353. /** 签名算法,应与后台下单时的值一致
  6354. *
  6355. * 可选值:
  6356. * - 'MD5': 仅在 v2 版本接口适用;
  6357. * - 'HMAC-SHA256': 仅在 v2 版本接口适用;
  6358. * - 'RSA': 仅在 v3 版本接口适用; */
  6359. signType?: 'MD5' | 'HMAC-SHA256' | 'RSA'
  6360. /** 接口调用成功的回调函数 */
  6361. success?: RequestOrderPaymentSuccessCallback
  6362. }
  6363. interface RequestPaymentOption {
  6364. /** 随机字符串,长度为32个字符以下 */
  6365. nonceStr: string
  6366. /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
  6367. package: string
  6368. /** 签名,具体见微信支付文档 */
  6369. paySign: string
  6370. /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
  6371. timeStamp: string
  6372. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6373. complete?: RequestPaymentCompleteCallback
  6374. /** 接口调用失败的回调函数 */
  6375. fail?: RequestPaymentFailCallback
  6376. /** 签名算法,应与后台下单时的值一致
  6377. *
  6378. * 可选值:
  6379. * - 'MD5': 仅在 v2 版本接口适用;
  6380. * - 'HMAC-SHA256': 仅在 v2 版本接口适用;
  6381. * - 'RSA': 仅在 v3 版本接口适用; */
  6382. signType?: 'MD5' | 'HMAC-SHA256' | 'RSA'
  6383. /** 接口调用成功的回调函数 */
  6384. success?: RequestPaymentSuccessCallback
  6385. }
  6386. interface RequestPictureInPictureOption {
  6387. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6388. complete?: RequestPictureInPictureCompleteCallback
  6389. /** 接口调用失败的回调函数 */
  6390. fail?: RequestPictureInPictureFailCallback
  6391. /** 接口调用成功的回调函数 */
  6392. success?: RequestPictureInPictureSuccessCallback
  6393. }
  6394. interface RequestPluginPaymentOption {
  6395. /** 需要显示在页面中的金额,单位为分 */
  6396. fee: number
  6397. /** 任意数据,传递给功能页中的响应函数 */
  6398. paymentArgs: IAnyObject
  6399. /** 插件版本
  6400. *
  6401. * 可选值:
  6402. * - 'develop': 开发版;
  6403. * - 'trial': 体验版;
  6404. * - 'release': 正式版; */
  6405. version: 'develop' | 'trial' | 'release'
  6406. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6407. complete?: RequestPluginPaymentCompleteCallback
  6408. /** 需要显示在页面中的货币符号的代码 */
  6409. currencyType?: string
  6410. /** 接口调用失败的回调函数 */
  6411. fail?: RequestPluginPaymentFailCallback
  6412. /** 接口调用成功的回调函数 */
  6413. success?: RequestPluginPaymentSuccessCallback
  6414. }
  6415. /** 需要基础库: `2.10.4`
  6416. *
  6417. * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html) */
  6418. interface RequestProfile {
  6419. /** SSL建立完成的时间,如果不是安全连接,则值为 0 */
  6420. SSLconnectionEnd: number
  6421. /** SSL建立连接的时间,如果不是安全连接,则值为 0 */
  6422. SSLconnectionStart: number
  6423. /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
  6424. connectEnd: number
  6425. /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
  6426. connectStart: number
  6427. /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  6428. domainLookupEnd: number
  6429. /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  6430. domainLookupStart: number
  6431. /** 评估当前网络下载的kbps */
  6432. downstreamThroughputKbpsEstimate: number
  6433. /** 评估的网络状态 unknown, offline, slow 2g, 2g, 3g, 4g, last/0, 1, 2, 3, 4, 5, 6 */
  6434. estimate_nettype: number
  6435. /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */
  6436. fetchStart: number
  6437. /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */
  6438. httpRttEstimate: number
  6439. /** 当前请求的IP */
  6440. peerIP: string
  6441. /** 当前请求的端口 */
  6442. port: number
  6443. /** 使用协议类型,有效值:http1.1, h2, quic, unknown */
  6444. protocol: string
  6445. /** 收到字节数 */
  6446. receivedBytedCount: number
  6447. /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */
  6448. redirectEnd: number
  6449. /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */
  6450. redirectStart: number
  6451. /** HTTP请求读取真实文档结束的时间 */
  6452. requestEnd: number
  6453. /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */
  6454. requestStart: number
  6455. /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */
  6456. responseEnd: number
  6457. /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */
  6458. responseStart: number
  6459. /** 当次请求连接过程中实时 rtt */
  6460. rtt: number
  6461. /** 发送的字节数 */
  6462. sendBytesCount: number
  6463. /** 是否复用连接 */
  6464. socketReused: boolean
  6465. /** 当前网络的实际下载kbps */
  6466. throughputKbps: number
  6467. /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */
  6468. transportRttEstimate: number
  6469. }
  6470. interface RequestSubscribeDeviceMessageFailCallbackResult {
  6471. /** 接口调用失败错误码,有可能为空 */
  6472. errCode: number
  6473. /** 接口调用失败错误信息 */
  6474. errMsg: string
  6475. }
  6476. interface RequestSubscribeDeviceMessageOption {
  6477. /** 设备型号 id 。通过微信公众平台注册设备获得。 */
  6478. modelId: string
  6479. /** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-)。 */
  6480. sn: string
  6481. /** 设备票据,5分钟内有效。 */
  6482. snTicket: string
  6483. /** 需要订阅的消息模板的 id 的集合,一次调用最多可订阅3条消息 */
  6484. tmplIds: any[]
  6485. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6486. complete?: RequestSubscribeDeviceMessageCompleteCallback
  6487. /** 接口调用失败的回调函数 */
  6488. fail?: RequestSubscribeDeviceMessageFailCallback
  6489. /** 接口调用成功的回调函数 */
  6490. success?: RequestSubscribeDeviceMessageSuccessCallback
  6491. }
  6492. interface RequestSubscribeDeviceMessageSuccessCallbackResult {
  6493. /** [TEMPLATE_ID]是动态的键,即模板id,值包括'accept'、'reject'、'ban'、'filter'、'acceptWithAudio'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息,'ban'表示已被后台封禁,'acceptWithAudio' 表示用户接收订阅消息并开启了语音提醒,'filter'表示该模板因为模板标题同名被后台过滤。例如 { errMsg: "requestSubscribeDeviceMessage:ok", zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */
  6494. [TEMPLATE_ID: string]: string
  6495. /** 接口调用成功时errMsg值为'requestSubscribeDeviceMessage:ok' */
  6496. errMsg: string
  6497. }
  6498. interface RequestSubscribeMessageFailCallbackResult {
  6499. /** 接口调用失败错误码 */
  6500. errCode: number
  6501. /** 接口调用失败错误信息 */
  6502. errMsg: string
  6503. }
  6504. interface RequestSubscribeMessageOption {
  6505. /** 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 */
  6506. tmplIds: any[]
  6507. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6508. complete?: RequestSubscribeMessageCompleteCallback
  6509. /** 接口调用失败的回调函数 */
  6510. fail?: RequestSubscribeMessageFailCallback
  6511. /** 接口调用成功的回调函数 */
  6512. success?: RequestSubscribeMessageSuccessCallback
  6513. }
  6514. interface RequestSubscribeMessageSuccessCallbackResult {
  6515. /** [TEMPLATE_ID]是动态的键,即模板id,值包括'accept'、'reject'、'ban'、'filter'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息,'ban'表示已被后台封禁,'filter'表示该模板因为模板标题同名被后台过滤。例如 { errMsg: "requestSubscribeMessage:ok", zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */
  6516. [TEMPLATE_ID: string]: string
  6517. /** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
  6518. errMsg: string
  6519. }
  6520. interface RequestSuccessCallbackResult<
  6521. T extends string | IAnyObject | ArrayBuffer =
  6522. | string
  6523. | IAnyObject
  6524. | ArrayBuffer
  6525. > {
  6526. /** 需要基础库: `2.10.0`
  6527. *
  6528. * 开发者服务器返回的 cookies,格式为字符串数组 */
  6529. cookies: string[]
  6530. /** 开发者服务器返回的数据 */
  6531. data: T
  6532. /** 需要基础库: `1.2.0`
  6533. *
  6534. * 开发者服务器返回的 HTTP Response Header */
  6535. header: IAnyObject
  6536. /** 需要基础库: `2.10.4`
  6537. *
  6538. * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html) */
  6539. profile: RequestProfile
  6540. /** 开发者服务器返回的 HTTP 状态码 */
  6541. statusCode: number
  6542. errMsg: string
  6543. }
  6544. interface ReserveChannelsLiveOption {
  6545. /** 预告 id,通过 getChannelsLiveNoticeInfo 接口获取 */
  6546. noticeId: string
  6547. }
  6548. /** 开发者服务器每次返回新chunk时的Response */
  6549. interface Result {
  6550. /** 返回的chunk buffer */
  6551. data: ArrayBuffer
  6552. }
  6553. interface ResumeBGMOption {
  6554. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6555. complete?: ResumeBGMCompleteCallback
  6556. /** 接口调用失败的回调函数 */
  6557. fail?: ResumeBGMFailCallback
  6558. /** 接口调用成功的回调函数 */
  6559. success?: ResumeBGMSuccessCallback
  6560. }
  6561. interface ResumeOption {
  6562. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6563. complete?: ResumeCompleteCallback
  6564. /** 接口调用失败的回调函数 */
  6565. fail?: ResumeFailCallback
  6566. /** 接口调用成功的回调函数 */
  6567. success?: ResumeSuccessCallback
  6568. }
  6569. interface RewardedVideoAdOnCloseListenerResult {
  6570. /** 需要基础库: `2.1.0`
  6571. *
  6572. * 视频是否是在用户完整观看的情况下被关闭的 */
  6573. isEnded: boolean
  6574. }
  6575. interface RewardedVideoAdOnErrorListenerResult {
  6576. /** 需要基础库: `2.2.2`
  6577. *
  6578. * 错误码
  6579. *
  6580. * 可选值:
  6581. * - 1000: 后端接口调用失败;
  6582. * - 1001: 参数错误;
  6583. * - 1002: 广告单元无效;
  6584. * - 1003: 内部错误;
  6585. * - 1004: 无合适的广告;
  6586. * - 1005: 广告组件审核中;
  6587. * - 1006: 广告组件被驳回;
  6588. * - 1007: 广告组件被封禁;
  6589. * - 1008: 广告单元已关闭; */
  6590. errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008
  6591. /** 错误信息 */
  6592. errMsg: string
  6593. }
  6594. interface RmdirFailCallbackResult {
  6595. /** 错误信息
  6596. *
  6597. * 可选值:
  6598. * - 'fail no such file or directory ${dirPath}': 目录不存在;
  6599. * - 'fail directory not empty': 目录不为空;
  6600. * - 'fail permission denied, open ${dirPath}': 指定的 dirPath 路径没有写权限;
  6601. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  6602. errMsg: string
  6603. }
  6604. interface RmdirOption {
  6605. /** 要删除的目录路径 (本地路径) */
  6606. dirPath: string
  6607. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6608. complete?: RmdirCompleteCallback
  6609. /** 接口调用失败的回调函数 */
  6610. fail?: RmdirFailCallback
  6611. /** 需要基础库: `2.3.0`
  6612. *
  6613. * 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 */
  6614. recursive?: boolean
  6615. /** 接口调用成功的回调函数 */
  6616. success?: RmdirSuccessCallback
  6617. }
  6618. interface RunOCROption {
  6619. /** 待识别图像的像素点数据,每四项表示一个像素点的 RGBA */
  6620. frameBuffer: ArrayBuffer
  6621. /** 图像高度 */
  6622. height: number
  6623. /** 图像宽度 */
  6624. width: number
  6625. }
  6626. interface SafeArea {
  6627. /** 安全区域右下角纵坐标 */
  6628. bottom: number
  6629. /** 安全区域的高度,单位逻辑像素 */
  6630. height: number
  6631. /** 安全区域左上角横坐标 */
  6632. left: number
  6633. /** 安全区域右下角横坐标 */
  6634. right: number
  6635. /** 安全区域左上角纵坐标 */
  6636. top: number
  6637. /** 安全区域的宽度,单位逻辑像素 */
  6638. width: number
  6639. }
  6640. interface SaveFileFailCallbackResult {
  6641. /** 错误信息
  6642. *
  6643. * 可选值:
  6644. * - 'fail tempFilePath file not exist': 指定的 tempFilePath 找不到文件;
  6645. * - 'fail permission denied, open "${filePath}"': 指定的 filePath 路径没有写权限;
  6646. * - 'fail no such file or directory "${dirPath}"': 上级目录不存在;
  6647. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  6648. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  6649. errMsg: string
  6650. }
  6651. interface SaveFileOption {
  6652. /** 临时存储文件路径 (本地路径) */
  6653. tempFilePath: string
  6654. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6655. complete?: SaveFileCompleteCallback
  6656. /** 接口调用失败的回调函数 */
  6657. fail?: SaveFileFailCallback
  6658. /** 要存储的文件路径 (本地路径) */
  6659. filePath?: string
  6660. /** 接口调用成功的回调函数 */
  6661. success?: SaveFileSuccessCallback
  6662. }
  6663. interface SaveFileSuccessCallbackResult {
  6664. /** 存储后的文件路径 (本地路径) */
  6665. savedFilePath: string
  6666. errMsg: string
  6667. }
  6668. interface SaveFileToDiskOption {
  6669. /** 待保存文件路径 */
  6670. filePath: string
  6671. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6672. complete?: SaveFileToDiskCompleteCallback
  6673. /** 接口调用失败的回调函数 */
  6674. fail?: SaveFileToDiskFailCallback
  6675. /** 接口调用成功的回调函数 */
  6676. success?: SaveFileToDiskSuccessCallback
  6677. }
  6678. interface SaveImageToPhotosAlbumOption {
  6679. /** 图片文件路径,可以是临时文件路径或永久文件路径 (本地路径) ,不支持网络路径 */
  6680. filePath: string
  6681. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6682. complete?: SaveImageToPhotosAlbumCompleteCallback
  6683. /** 接口调用失败的回调函数 */
  6684. fail?: SaveImageToPhotosAlbumFailCallback
  6685. /** 接口调用成功的回调函数 */
  6686. success?: SaveImageToPhotosAlbumSuccessCallback
  6687. }
  6688. interface SaveVideoToPhotosAlbumOption {
  6689. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
  6690. filePath: string
  6691. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6692. complete?: SaveVideoToPhotosAlbumCompleteCallback
  6693. /** 接口调用失败的回调函数 */
  6694. fail?: SaveVideoToPhotosAlbumFailCallback
  6695. /** 接口调用成功的回调函数 */
  6696. success?: SaveVideoToPhotosAlbumSuccessCallback
  6697. }
  6698. interface ScanCodeOption {
  6699. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6700. complete?: ScanCodeCompleteCallback
  6701. /** 接口调用失败的回调函数 */
  6702. fail?: ScanCodeFailCallback
  6703. /** 需要基础库: `1.2.0`
  6704. *
  6705. * 是否只能从相机扫码,不允许从相册选择图片 */
  6706. onlyFromCamera?: boolean
  6707. /** 需要基础库: `1.7.0`
  6708. *
  6709. * 扫码类型
  6710. *
  6711. * 可选值:
  6712. * - 'barCode': 一维码;
  6713. * - 'qrCode': 二维码;
  6714. * - 'datamatrix': Data Matrix 码;
  6715. * - 'pdf417': PDF417 条码; */
  6716. scanType?: Array<'barCode' | 'qrCode' | 'datamatrix' | 'pdf417'>
  6717. /** 接口调用成功的回调函数 */
  6718. success?: ScanCodeSuccessCallback
  6719. }
  6720. interface ScanCodeSuccessCallbackResult {
  6721. /** 所扫码的字符集 */
  6722. charSet: string
  6723. /** 当所扫的码为当前小程序二维码时,会返回此字段,内容为二维码携带的 path */
  6724. path: string
  6725. /** 原始数据,base64编码 */
  6726. rawData: string
  6727. /** 所扫码的内容 */
  6728. result: string
  6729. /** 所扫码的类型
  6730. *
  6731. * 可选值:
  6732. * - 'QR_CODE': 二维码;
  6733. * - 'AZTEC': 一维码;
  6734. * - 'CODABAR': 一维码;
  6735. * - 'CODE_39': 一维码;
  6736. * - 'CODE_93': 一维码;
  6737. * - 'CODE_128': 一维码;
  6738. * - 'DATA_MATRIX': 二维码;
  6739. * - 'EAN_8': 一维码;
  6740. * - 'EAN_13': 一维码;
  6741. * - 'ITF': 一维码;
  6742. * - 'MAXICODE': 一维码;
  6743. * - 'PDF_417': 二维码;
  6744. * - 'RSS_14': 一维码;
  6745. * - 'RSS_EXPANDED': 一维码;
  6746. * - 'UPC_A': 一维码;
  6747. * - 'UPC_E': 一维码;
  6748. * - 'UPC_EAN_EXTENSION': 一维码;
  6749. * - 'WX_CODE': 二维码;
  6750. * - 'CODE_25': 一维码; */
  6751. scanType:
  6752. | 'QR_CODE'
  6753. | 'AZTEC'
  6754. | 'CODABAR'
  6755. | 'CODE_39'
  6756. | 'CODE_93'
  6757. | 'CODE_128'
  6758. | 'DATA_MATRIX'
  6759. | 'EAN_8'
  6760. | 'EAN_13'
  6761. | 'ITF'
  6762. | 'MAXICODE'
  6763. | 'PDF_417'
  6764. | 'RSS_14'
  6765. | 'RSS_EXPANDED'
  6766. | 'UPC_A'
  6767. | 'UPC_E'
  6768. | 'UPC_EAN_EXTENSION'
  6769. | 'WX_CODE'
  6770. | 'CODE_25'
  6771. errMsg: string
  6772. }
  6773. interface ScrollOffsetCallbackResult {
  6774. /** 节点的 dataset */
  6775. dataset: IAnyObject
  6776. /** 节点的 ID */
  6777. id: string
  6778. /** 节点的水平滚动位置 */
  6779. scrollLeft: number
  6780. /** 节点的竖直滚动位置 */
  6781. scrollTop: number
  6782. }
  6783. interface ScrollToOption {
  6784. /** 是否启用滚动动画 */
  6785. animated?: boolean
  6786. /** 滚动动画时长 (仅在 iOS 下生效) */
  6787. duration?: number
  6788. /** 左边界距离 */
  6789. left?: number
  6790. /** 顶部距离 */
  6791. top?: number
  6792. /** 初始速度 (仅在 iOS 下生效) */
  6793. velocity?: number
  6794. }
  6795. /** 需要基础库: `2.14.4`
  6796. *
  6797. * 增强 ScrollView 实例,可通过 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 的 [NodesRef.node](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.node.html) 方法获取。 仅在 scroll-view 组件开启 enhanced 属性后生效。
  6798. *
  6799. * **示例代码**
  6800. *
  6801. * ```js
  6802. wx.createSelectorQuery()
  6803. .select('#scrollview')
  6804. .node()
  6805. .exec((res) => {
  6806. const scrollView = res[0].node;
  6807. scrollView.scrollEnabled = false;
  6808. })
  6809. ``` */
  6810. interface ScrollViewContext {
  6811. /** 设置滚动边界弹性 (仅在 iOS 下生效) */
  6812. bounces: boolean
  6813. /** 取消滚动惯性 (仅在 iOS 下生效) */
  6814. decelerationDisabled: boolean
  6815. /** 设置滚动减速速率 (仅在 iOS 下生效) */
  6816. fastDeceleration: boolean
  6817. /** 分页滑动开关 */
  6818. pagingEnabled: boolean
  6819. /** 滚动开关 */
  6820. scrollEnabled: boolean
  6821. /** 设置是否显示滚动条 */
  6822. showScrollbar: boolean
  6823. }
  6824. interface SeekBackgroundAudioOption {
  6825. /** 音乐位置,单位:秒 */
  6826. position: number
  6827. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6828. complete?: SeekBackgroundAudioCompleteCallback
  6829. /** 接口调用失败的回调函数 */
  6830. fail?: SeekBackgroundAudioFailCallback
  6831. /** 接口调用成功的回调函数 */
  6832. success?: SeekBackgroundAudioSuccessCallback
  6833. }
  6834. interface SendHCEMessageOption {
  6835. /** 二进制数据 */
  6836. data: ArrayBuffer
  6837. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6838. complete?: SendHCEMessageCompleteCallback
  6839. /** 接口调用失败的回调函数 */
  6840. fail?: SendHCEMessageFailCallback
  6841. /** 接口调用成功的回调函数 */
  6842. success?: SendHCEMessageSuccessCallback
  6843. }
  6844. interface SendMessageOption {
  6845. /** SEI消息 */
  6846. msg: string
  6847. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6848. complete?: SendMessageCompleteCallback
  6849. /** 接口调用失败的回调函数 */
  6850. fail?: SendMessageFailCallback
  6851. /** 接口调用成功的回调函数 */
  6852. success?: SendMessageSuccessCallback
  6853. }
  6854. interface SendSmsOption {
  6855. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6856. complete?: SendSmsCompleteCallback
  6857. /** 预填到发送短信面板的内容 */
  6858. content?: string
  6859. /** 接口调用失败的回调函数 */
  6860. fail?: SendSmsFailCallback
  6861. /** 预填到发送短信面板的手机号 */
  6862. phoneNumber?: string
  6863. /** 接口调用成功的回调函数 */
  6864. success?: SendSmsSuccessCallback
  6865. }
  6866. interface SendSocketMessageOption {
  6867. /** 需要发送的内容 */
  6868. data: string | ArrayBuffer
  6869. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6870. complete?: SendSocketMessageCompleteCallback
  6871. /** 接口调用失败的回调函数 */
  6872. fail?: SendSocketMessageFailCallback
  6873. /** 接口调用成功的回调函数 */
  6874. success?: SendSocketMessageSuccessCallback
  6875. }
  6876. interface SetBGMVolumeOption {
  6877. /** 音量大小,范围是 0-1 */
  6878. volume: string
  6879. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6880. complete?: SetBGMVolumeCompleteCallback
  6881. /** 接口调用失败的回调函数 */
  6882. fail?: SetBGMVolumeFailCallback
  6883. /** 接口调用成功的回调函数 */
  6884. success?: SetBGMVolumeSuccessCallback
  6885. }
  6886. interface SetBLEMTUFailCallbackResult {
  6887. /** 最终协商的 MTU 值。如果协商失败则无此参数。安卓客户端 8.0.9 开始支持。 */
  6888. mtu: number
  6889. }
  6890. interface SetBLEMTUOption {
  6891. /** 蓝牙设备 id */
  6892. deviceId: string
  6893. /** 最大传输单元。设置范围为 (22,512) 区间内,单位 bytes */
  6894. mtu: number
  6895. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6896. complete?: SetBLEMTUCompleteCallback
  6897. /** 接口调用失败的回调函数 */
  6898. fail?: SetBLEMTUFailCallback
  6899. /** 接口调用成功的回调函数 */
  6900. success?: SetBLEMTUSuccessCallback
  6901. }
  6902. interface SetBLEMTUSuccessCallbackResult {
  6903. /** 最终协商的 MTU 值,与传入参数一致。安卓客户端 8.0.9 开始支持。 */
  6904. mtu: number
  6905. errMsg: string
  6906. }
  6907. interface SetBackgroundColorOption {
  6908. /** 窗口的背景色,必须为十六进制颜色值 */
  6909. backgroundColor?: string
  6910. /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */
  6911. backgroundColorBottom?: string
  6912. /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */
  6913. backgroundColorTop?: string
  6914. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6915. complete?: SetBackgroundColorCompleteCallback
  6916. /** 接口调用失败的回调函数 */
  6917. fail?: SetBackgroundColorFailCallback
  6918. /** 接口调用成功的回调函数 */
  6919. success?: SetBackgroundColorSuccessCallback
  6920. }
  6921. interface SetBackgroundFetchTokenOption {
  6922. /** 自定义的登录态 */
  6923. token: string
  6924. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6925. complete?: SetBackgroundFetchTokenCompleteCallback
  6926. /** 接口调用失败的回调函数 */
  6927. fail?: SetBackgroundFetchTokenFailCallback
  6928. /** 接口调用成功的回调函数 */
  6929. success?: SetBackgroundFetchTokenSuccessCallback
  6930. }
  6931. interface SetBackgroundTextStyleOption {
  6932. /** 下拉背景字体、loading 图的样式。
  6933. *
  6934. * 可选值:
  6935. * - 'dark': dark 样式;
  6936. * - 'light': light 样式; */
  6937. textStyle: 'dark' | 'light'
  6938. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6939. complete?: SetBackgroundTextStyleCompleteCallback
  6940. /** 接口调用失败的回调函数 */
  6941. fail?: SetBackgroundTextStyleFailCallback
  6942. /** 接口调用成功的回调函数 */
  6943. success?: SetBackgroundTextStyleSuccessCallback
  6944. }
  6945. interface SetBoundaryOption {
  6946. /** 东北角经纬度 */
  6947. northeast: MapPostion
  6948. /** 西南角经纬度 */
  6949. southwest: MapPostion
  6950. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6951. complete?: SetBoundaryCompleteCallback
  6952. /** 接口调用失败的回调函数 */
  6953. fail?: SetBoundaryFailCallback
  6954. /** 接口调用成功的回调函数 */
  6955. success?: SetBoundarySuccessCallback
  6956. }
  6957. interface SetCenterOffsetOption {
  6958. /** 偏移量,两位数组 */
  6959. offset: number[]
  6960. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6961. complete?: SetCenterOffsetCompleteCallback
  6962. /** 接口调用失败的回调函数 */
  6963. fail?: SetCenterOffsetFailCallback
  6964. /** 接口调用成功的回调函数 */
  6965. success?: SetCenterOffsetSuccessCallback
  6966. }
  6967. interface SetClipboardDataOption {
  6968. /** 剪贴板的内容 */
  6969. data: string
  6970. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6971. complete?: SetClipboardDataCompleteCallback
  6972. /** 接口调用失败的回调函数 */
  6973. fail?: SetClipboardDataFailCallback
  6974. /** 接口调用成功的回调函数 */
  6975. success?: SetClipboardDataSuccessCallback
  6976. }
  6977. interface SetContentsOption {
  6978. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6979. complete?: SetContentsCompleteCallback
  6980. /** 表示内容的delta对象 */
  6981. delta?: IAnyObject
  6982. /** 接口调用失败的回调函数 */
  6983. fail?: SetContentsFailCallback
  6984. /** 带标签的HTML内容 */
  6985. html?: string
  6986. /** 接口调用成功的回调函数 */
  6987. success?: SetContentsSuccessCallback
  6988. }
  6989. interface SetEnable1v1ChatOption {
  6990. /** 是否开启 */
  6991. enable: boolean
  6992. /** 窗口背景色(音频通话背景以及小窗模式背景)
  6993. *
  6994. * 可选值:
  6995. * - 0: #262930;
  6996. * - 1: #FA5151;
  6997. * - 2: #FA9D3B;
  6998. * - 3: #3D7257;
  6999. * - 4: #1485EE;
  7000. * - 5: #6467F0; */
  7001. backgroundType?: 0 | 1 | 2 | 3 | 4 | 5
  7002. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7003. complete?: SetEnable1v1ChatCompleteCallback
  7004. /** 接口调用失败的回调函数 */
  7005. fail?: SetEnable1v1ChatFailCallback
  7006. /** 小窗样式 */
  7007. minWindowType?: number
  7008. /** 接口调用成功的回调函数 */
  7009. success?: SetEnable1v1ChatSuccessCallback
  7010. }
  7011. interface SetEnableDebugOption {
  7012. /** 是否打开调试 */
  7013. enableDebug: boolean
  7014. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7015. complete?: SetEnableDebugCompleteCallback
  7016. /** 接口调用失败的回调函数 */
  7017. fail?: SetEnableDebugFailCallback
  7018. /** 接口调用成功的回调函数 */
  7019. success?: SetEnableDebugSuccessCallback
  7020. }
  7021. interface SetInnerAudioOption {
  7022. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7023. complete?: SetInnerAudioOptionCompleteCallback
  7024. /** 接口调用失败的回调函数 */
  7025. fail?: SetInnerAudioOptionFailCallback
  7026. /** 是否与其他音频混播,设置为 true 之后,不会终止其他应用或微信内的音乐 */
  7027. mixWithOther?: boolean
  7028. /** (仅在 iOS 生效)是否遵循静音开关,设置为 false 之后,即使是在静音模式下,也能播放声音 */
  7029. obeyMuteSwitch?: boolean
  7030. /** true 代表用扬声器播放,false 代表听筒播放,默认值为 true。 */
  7031. speakerOn?: boolean
  7032. /** 接口调用成功的回调函数 */
  7033. success?: SetInnerAudioOptionSuccessCallback
  7034. }
  7035. interface SetKeepScreenOnOption {
  7036. /** 是否保持屏幕常亮 */
  7037. keepScreenOn: boolean
  7038. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7039. complete?: SetKeepScreenOnCompleteCallback
  7040. /** 接口调用失败的回调函数 */
  7041. fail?: SetKeepScreenOnFailCallback
  7042. /** 接口调用成功的回调函数 */
  7043. success?: SetKeepScreenOnSuccessCallback
  7044. }
  7045. interface SetLocMarkerIconOption {
  7046. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7047. complete?: SetLocMarkerIconCompleteCallback
  7048. /** 接口调用失败的回调函数 */
  7049. fail?: SetLocMarkerIconFailCallback
  7050. /** 图标路径,支持网络路径、本地路径、代码包路径 */
  7051. iconPath?: string
  7052. /** 接口调用成功的回调函数 */
  7053. success?: SetLocMarkerIconSuccessCallback
  7054. }
  7055. interface SetMICVolumeOption {
  7056. /** 音量大小,范围是 0.0-1.0 */
  7057. volume: number
  7058. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7059. complete?: SetMICVolumeCompleteCallback
  7060. /** 接口调用失败的回调函数 */
  7061. fail?: SetMICVolumeFailCallback
  7062. /** 接口调用成功的回调函数 */
  7063. success?: SetMICVolumeSuccessCallback
  7064. }
  7065. interface SetNavigationBarColorOption {
  7066. /** 背景颜色值,有效值为十六进制颜色 */
  7067. backgroundColor: string
  7068. /** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */
  7069. frontColor: string
  7070. /** 动画效果 */
  7071. animation?: AnimationOption
  7072. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7073. complete?: SetNavigationBarColorCompleteCallback
  7074. /** 接口调用失败的回调函数 */
  7075. fail?: SetNavigationBarColorFailCallback
  7076. /** 接口调用成功的回调函数 */
  7077. success?: SetNavigationBarColorSuccessCallback
  7078. }
  7079. interface SetNavigationBarTitleOption {
  7080. /** 页面标题 */
  7081. title: string
  7082. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7083. complete?: SetNavigationBarTitleCompleteCallback
  7084. /** 接口调用失败的回调函数 */
  7085. fail?: SetNavigationBarTitleFailCallback
  7086. /** 接口调用成功的回调函数 */
  7087. success?: SetNavigationBarTitleSuccessCallback
  7088. }
  7089. interface SetScreenBrightnessOption {
  7090. /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮。在安卓端支持传入特殊值 -1,表示屏幕亮度跟随系统变化 */
  7091. value: number
  7092. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7093. complete?: SetScreenBrightnessCompleteCallback
  7094. /** 接口调用失败的回调函数 */
  7095. fail?: SetScreenBrightnessFailCallback
  7096. /** 接口调用成功的回调函数 */
  7097. success?: SetScreenBrightnessSuccessCallback
  7098. }
  7099. interface SetStorageOption<T = any> {
  7100. /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  7101. data: T
  7102. /** 本地缓存中指定的 key */
  7103. key: string
  7104. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7105. complete?: SetStorageCompleteCallback
  7106. /** 需要基础库: `2.21.3`
  7107. *
  7108. * 是否开启加密存储。只有异步的 setStorage 接口支持开启加密存储。开启后,将会对 data 使用 AES128 加密,接口回调耗时将会增加。若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true。此外,由于加密后的数据会比原始数据膨胀1.4倍,因此开启 encrypt 的情况下,单个 key 允许存储的最大数据长度为 0.7MB,所有数据存储上限为 7.1MB */
  7109. encrypt?: boolean
  7110. /** 接口调用失败的回调函数 */
  7111. fail?: SetStorageFailCallback
  7112. /** 接口调用成功的回调函数 */
  7113. success?: SetStorageSuccessCallback
  7114. }
  7115. interface SetTabBarBadgeOption {
  7116. /** tabBar 的哪一项,从左边算起 */
  7117. index: number
  7118. /** 显示的文本,超过 4 个字符则显示成 ... */
  7119. text: string
  7120. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7121. complete?: SetTabBarBadgeCompleteCallback
  7122. /** 接口调用失败的回调函数 */
  7123. fail?: SetTabBarBadgeFailCallback
  7124. /** 接口调用成功的回调函数 */
  7125. success?: SetTabBarBadgeSuccessCallback
  7126. }
  7127. interface SetTabBarItemOption {
  7128. /** tabBar 的哪一项,从左边算起 */
  7129. index: number
  7130. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7131. complete?: SetTabBarItemCompleteCallback
  7132. /** 接口调用失败的回调函数 */
  7133. fail?: SetTabBarItemFailCallback
  7134. /** 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效 */
  7135. iconPath?: string
  7136. /** 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效 */
  7137. selectedIconPath?: string
  7138. /** 接口调用成功的回调函数 */
  7139. success?: SetTabBarItemSuccessCallback
  7140. /** tab 上的按钮文字 */
  7141. text?: string
  7142. }
  7143. interface SetTabBarStyleOption {
  7144. /** tab 的背景色,HexColor */
  7145. backgroundColor?: string
  7146. /** tabBar上边框的颜色, 仅支持 black/white */
  7147. borderStyle?: string
  7148. /** tab 上的文字默认颜色,HexColor */
  7149. color?: string
  7150. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7151. complete?: SetTabBarStyleCompleteCallback
  7152. /** 接口调用失败的回调函数 */
  7153. fail?: SetTabBarStyleFailCallback
  7154. /** tab 上的文字选中时的颜色,HexColor */
  7155. selectedColor?: string
  7156. /** 接口调用成功的回调函数 */
  7157. success?: SetTabBarStyleSuccessCallback
  7158. }
  7159. interface SetTimeoutOption {
  7160. /** 设置超时时间 (ms) */
  7161. timeout: number
  7162. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7163. complete?: SetTimeoutCompleteCallback
  7164. /** 接口调用失败的回调函数 */
  7165. fail?: SetTimeoutFailCallback
  7166. /** 接口调用成功的回调函数 */
  7167. success?: SetTimeoutSuccessCallback
  7168. }
  7169. interface SetTopBarTextOption {
  7170. /** 置顶栏文字 */
  7171. text: string
  7172. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7173. complete?: SetTopBarTextCompleteCallback
  7174. /** 接口调用失败的回调函数 */
  7175. fail?: SetTopBarTextFailCallback
  7176. /** 接口调用成功的回调函数 */
  7177. success?: SetTopBarTextSuccessCallback
  7178. }
  7179. interface SetVisualEffectOnCaptureOption {
  7180. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7181. complete?: SetVisualEffectOnCaptureCompleteCallback
  7182. /** 接口调用失败的回调函数 */
  7183. fail?: SetVisualEffectOnCaptureFailCallback
  7184. /** 接口调用成功的回调函数 */
  7185. success?: SetVisualEffectOnCaptureSuccessCallback
  7186. /** 截屏/录屏时的表现,仅支持 none / hidden,传入 hidden 则表示在截屏/录屏时隐藏屏幕 */
  7187. visualEffect?: string
  7188. }
  7189. interface SetWifiListOption {
  7190. /** 提供预设的 Wi-Fi 信息列表 */
  7191. wifiList: WifiData[]
  7192. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7193. complete?: SetWifiListCompleteCallback
  7194. /** 接口调用失败的回调函数 */
  7195. fail?: SetWifiListFailCallback
  7196. /** 接口调用成功的回调函数 */
  7197. success?: SetWifiListSuccessCallback
  7198. }
  7199. interface SetWindowSizeOption {
  7200. /** 窗口高度,以像素为单位 */
  7201. height: number
  7202. /** 窗口宽度,以像素为单位 */
  7203. width: number
  7204. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7205. complete?: SetWindowSizeCompleteCallback
  7206. /** 接口调用失败的回调函数 */
  7207. fail?: SetWindowSizeFailCallback
  7208. /** 接口调用成功的回调函数 */
  7209. success?: SetWindowSizeSuccessCallback
  7210. }
  7211. interface SetZoomOption {
  7212. /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */
  7213. zoom: number
  7214. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7215. complete?: SetZoomCompleteCallback
  7216. /** 接口调用失败的回调函数 */
  7217. fail?: SetZoomFailCallback
  7218. /** 接口调用成功的回调函数 */
  7219. success?: SetZoomSuccessCallback
  7220. }
  7221. interface SetZoomSuccessCallbackResult {
  7222. /** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */
  7223. zoom: number
  7224. errMsg: string
  7225. }
  7226. interface ShareFileMessageOption {
  7227. /** 要分享的文件地址,必须为本地路径或临时路径 */
  7228. filePath: string
  7229. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7230. complete?: ShareFileMessageCompleteCallback
  7231. /** 接口调用失败的回调函数 */
  7232. fail?: ShareFileMessageFailCallback
  7233. /** 自定义文件名,若留空则使用filePath中的文件名 */
  7234. fileName?: string
  7235. /** 接口调用成功的回调函数 */
  7236. success?: ShareFileMessageSuccessCallback
  7237. }
  7238. interface ShareToWeRunOption {
  7239. /** 运动数据列表 */
  7240. recordList: WxaSportRecord[]
  7241. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7242. complete?: ShareToWeRunCompleteCallback
  7243. /** 接口调用失败的回调函数 */
  7244. fail?: ShareToWeRunFailCallback
  7245. /** 接口调用成功的回调函数 */
  7246. success?: ShareToWeRunSuccessCallback
  7247. }
  7248. interface ShareVideoMessageOption {
  7249. /** 要分享的视频地址,必须为本地路径或临时路径 */
  7250. videoPath: string
  7251. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7252. complete?: ShareVideoMessageCompleteCallback
  7253. /** 接口调用失败的回调函数 */
  7254. fail?: ShareVideoMessageFailCallback
  7255. /** 接口调用成功的回调函数 */
  7256. success?: ShareVideoMessageSuccessCallback
  7257. /** 缩略图路径,若留空则使用视频首帧 */
  7258. thumbPath?: string
  7259. }
  7260. interface ShowActionSheetOption {
  7261. /** 按钮的文字数组,数组长度最大为 6 */
  7262. itemList: string[]
  7263. /** 需要基础库: `2.14.0`
  7264. *
  7265. * 警示文案 */
  7266. alertText?: string
  7267. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7268. complete?: ShowActionSheetCompleteCallback
  7269. /** 接口调用失败的回调函数 */
  7270. fail?: ShowActionSheetFailCallback
  7271. /** 按钮的文字颜色 */
  7272. itemColor?: string
  7273. /** 接口调用成功的回调函数 */
  7274. success?: ShowActionSheetSuccessCallback
  7275. }
  7276. interface ShowActionSheetSuccessCallbackResult {
  7277. /** 用户点击的按钮序号,从上到下的顺序,从0开始 */
  7278. tapIndex: number
  7279. errMsg: string
  7280. }
  7281. interface ShowLoadingOption {
  7282. /** 提示的内容 */
  7283. title: string
  7284. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7285. complete?: ShowLoadingCompleteCallback
  7286. /** 接口调用失败的回调函数 */
  7287. fail?: ShowLoadingFailCallback
  7288. /** 是否显示透明蒙层,防止触摸穿透 */
  7289. mask?: boolean
  7290. /** 接口调用成功的回调函数 */
  7291. success?: ShowLoadingSuccessCallback
  7292. }
  7293. interface ShowModalOption {
  7294. /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
  7295. cancelColor?: string
  7296. /** 取消按钮的文字,最多 4 个字符 */
  7297. cancelText?: string
  7298. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7299. complete?: ShowModalCompleteCallback
  7300. /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
  7301. confirmColor?: string
  7302. /** 确认按钮的文字,最多 4 个字符 */
  7303. confirmText?: string
  7304. /** 提示的内容 */
  7305. content?: string
  7306. /** 需要基础库: `2.17.1`
  7307. *
  7308. * 是否显示输入框 */
  7309. editable?: boolean
  7310. /** 接口调用失败的回调函数 */
  7311. fail?: ShowModalFailCallback
  7312. /** 需要基础库: `2.17.1`
  7313. *
  7314. * 显示输入框时的提示文本 */
  7315. placeholderText?: string
  7316. /** 是否显示取消按钮 */
  7317. showCancel?: boolean
  7318. /** 接口调用成功的回调函数 */
  7319. success?: ShowModalSuccessCallback
  7320. /** 提示的标题 */
  7321. title?: string
  7322. }
  7323. interface ShowModalSuccessCallbackResult {
  7324. /** 需要基础库: `1.1.0`
  7325. *
  7326. * 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
  7327. cancel: boolean
  7328. /** 为 true 时,表示用户点击了确定按钮 */
  7329. confirm: boolean
  7330. /** editable 为 true 时,用户输入的文本 */
  7331. content: string
  7332. errMsg: string
  7333. }
  7334. interface ShowNavigationBarLoadingOption {
  7335. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7336. complete?: ShowNavigationBarLoadingCompleteCallback
  7337. /** 接口调用失败的回调函数 */
  7338. fail?: ShowNavigationBarLoadingFailCallback
  7339. /** 接口调用成功的回调函数 */
  7340. success?: ShowNavigationBarLoadingSuccessCallback
  7341. }
  7342. interface ShowRedPackageOption {
  7343. /** 封面地址 */
  7344. url: string
  7345. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7346. complete?: ShowRedPackageCompleteCallback
  7347. /** 接口调用失败的回调函数 */
  7348. fail?: ShowRedPackageFailCallback
  7349. /** 接口调用成功的回调函数 */
  7350. success?: ShowRedPackageSuccessCallback
  7351. }
  7352. interface ShowShareImageMenuOption {
  7353. /** 要分享的图片地址,必须为本地路径或临时路径 */
  7354. path: string
  7355. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7356. complete?: ShowShareImageMenuCompleteCallback
  7357. /** 接口调用失败的回调函数 */
  7358. fail?: ShowShareImageMenuFailCallback
  7359. /** 接口调用成功的回调函数 */
  7360. success?: ShowShareImageMenuSuccessCallback
  7361. }
  7362. interface ShowShareMenuOption {
  7363. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7364. complete?: ShowShareMenuCompleteCallback
  7365. /** 接口调用失败的回调函数 */
  7366. fail?: ShowShareMenuFailCallback
  7367. /** 需要基础库: `2.11.3`
  7368. *
  7369. * 本接口为 Beta 版本,暂只在 Android 平台支持。需要显示的转发按钮名称列表,默认['shareAppMessage']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 */
  7370. menus?: string[]
  7371. /** 接口调用成功的回调函数 */
  7372. success?: ShowShareMenuSuccessCallback
  7373. /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  7374. withShareTicket?: boolean
  7375. }
  7376. interface ShowTabBarOption {
  7377. /** 是否需要动画效果 */
  7378. animation?: boolean
  7379. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7380. complete?: ShowTabBarCompleteCallback
  7381. /** 接口调用失败的回调函数 */
  7382. fail?: ShowTabBarFailCallback
  7383. /** 接口调用成功的回调函数 */
  7384. success?: ShowTabBarSuccessCallback
  7385. }
  7386. interface ShowTabBarRedDotOption {
  7387. /** tabBar 的哪一项,从左边算起 */
  7388. index: number
  7389. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7390. complete?: ShowTabBarRedDotCompleteCallback
  7391. /** 接口调用失败的回调函数 */
  7392. fail?: ShowTabBarRedDotFailCallback
  7393. /** 接口调用成功的回调函数 */
  7394. success?: ShowTabBarRedDotSuccessCallback
  7395. }
  7396. interface ShowToastOption {
  7397. /** 提示的内容 */
  7398. title: string
  7399. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7400. complete?: ShowToastCompleteCallback
  7401. /** 提示的延迟时间 */
  7402. duration?: number
  7403. /** 接口调用失败的回调函数 */
  7404. fail?: ShowToastFailCallback
  7405. /** 图标
  7406. *
  7407. * 可选值:
  7408. * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;
  7409. * - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;
  7410. * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
  7411. * - 'none': 不显示图标,此时 title 文本最多可显示两行,[1.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)及以上版本支持; */
  7412. icon?: 'success' | 'error' | 'loading' | 'none'
  7413. /** 需要基础库: `1.1.0`
  7414. *
  7415. * 自定义图标的本地路径,image 的优先级高于 icon */
  7416. image?: string
  7417. /** 是否显示透明蒙层,防止触摸穿透 */
  7418. mask?: boolean
  7419. /** 接口调用成功的回调函数 */
  7420. success?: ShowToastSuccessCallback
  7421. }
  7422. interface Size {
  7423. /** 变化后的窗口高度,单位 px */
  7424. windowHeight: number
  7425. /** 变化后的窗口宽度,单位 px */
  7426. windowWidth: number
  7427. }
  7428. /** 当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  7429. interface SkylineInfo {
  7430. /** 当前运行环境是否支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) */
  7431. isSupported: boolean
  7432. /** 当前运行环境不支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的原因,仅在 `isSupported` 为 `false` 时出现
  7433. *
  7434. * 可选值:
  7435. * - 'client not supported': 当前微信客户端不支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html),可以尝试通过升级微信客户端解决;
  7436. * - 'baselib not supported': 当前基础库不支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html),基础库会自动更新到当前客户端所能支持的最新的版本,基础库不支持时也可以尝试通过升级微信客户端解决;
  7437. * - 'a-b test not enabled': 命中了 _We 分析_ 平台上的 AB 实验关闭的情况。详细可以查看 [Skyline 起步 > 配置 We 分析 AB 实验](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/#%E9%85%8D%E7%BD%AE-We-%E5%88%86%E6%9E%90-AB-%E5%AE%9E%E9%AA%8C) 一节;
  7438. * - 'SwitchRender option set to webview': 本地调试的快捷切换入口被设置为了强制使用 Webview. 详情可以查看 [Skyline 起步 > 快捷切换入口](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/#%E5%BF%AB%E6%8D%B7%E5%88%87%E6%8D%A2%E5%85%A5%E5%8F%A3) 一节; */
  7439. reason:
  7440. | 'client not supported'
  7441. | 'baselib not supported'
  7442. | 'a-b test not enabled'
  7443. | 'SwitchRender option set to webview'
  7444. /** 当前运行环境 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的版本号,形如 `0.9.7` */
  7445. version: string
  7446. }
  7447. /** 需要基础库: `2.10.4`
  7448. *
  7449. * 网络请求过程中一些调试信息 */
  7450. interface SocketProfile {
  7451. /** 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
  7452. connectEnd: number
  7453. /** 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
  7454. connectStart: number
  7455. /** 上层请求到返回的耗时 */
  7456. cost: number
  7457. /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  7458. domainLookupEnd: number
  7459. /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  7460. domainLookupStart: number
  7461. /** 组件准备好使用 SOCKET 建立请求的时间,这发生在检查本地缓存之前 */
  7462. fetchStart: number
  7463. /** 握手耗时 */
  7464. handshakeCost: number
  7465. /** 单次连接的耗时,包括 connect ,tls */
  7466. rtt: number
  7467. }
  7468. interface SocketTaskCloseOption {
  7469. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  7470. code?: number
  7471. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7472. complete?: FileSystemManagerCloseCompleteCallback
  7473. /** 接口调用失败的回调函数 */
  7474. fail?: SocketTaskCloseFailCallback
  7475. /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */
  7476. reason?: string
  7477. /** 接口调用成功的回调函数 */
  7478. success?: FileSystemManagerCloseSuccessCallback
  7479. }
  7480. interface SocketTaskOnCloseListenerResult {
  7481. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  7482. code: number
  7483. /** 一个可读的字符串,表示连接被关闭的原因。 */
  7484. reason: string
  7485. }
  7486. interface SocketTaskOnMessageListenerResult {
  7487. /** 服务器返回的消息 */
  7488. data: string | ArrayBuffer
  7489. }
  7490. interface SocketTaskSendOption {
  7491. /** 需要发送的内容 */
  7492. data: string | ArrayBuffer
  7493. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7494. complete?: SendCompleteCallback
  7495. /** 接口调用失败的回调函数 */
  7496. fail?: SendFailCallback
  7497. /** 接口调用成功的回调函数 */
  7498. success?: SendSuccessCallback
  7499. }
  7500. /** 动画配置 */
  7501. interface SpringOption {
  7502. damping?: number
  7503. mass?: number
  7504. overshootClamping?: boolean
  7505. restDisplacementThreshold?: number
  7506. restSpeedThreshold?: number
  7507. stiffness?: number
  7508. velocity?: number
  7509. }
  7510. interface StartAccelerometerOption {
  7511. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7512. complete?: StartAccelerometerCompleteCallback
  7513. /** 接口调用失败的回调函数 */
  7514. fail?: StartAccelerometerFailCallback
  7515. /** 需要基础库: `2.1.0`
  7516. *
  7517. * 监听加速度数据回调函数的执行频率
  7518. *
  7519. * 可选值:
  7520. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  7521. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  7522. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  7523. interval?: 'game' | 'ui' | 'normal'
  7524. /** 接口调用成功的回调函数 */
  7525. success?: StartAccelerometerSuccessCallback
  7526. }
  7527. interface StartAdvertisingObject {
  7528. /** 广播自定义参数 */
  7529. advertiseRequest: AdvertiseReqObj
  7530. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7531. complete?: StartAdvertisingCompleteCallback
  7532. /** 接口调用失败的回调函数 */
  7533. fail?: StartAdvertisingFailCallback
  7534. /** 广播功率
  7535. *
  7536. * 可选值:
  7537. * - 'low': 功率低;
  7538. * - 'medium': 功率适中;
  7539. * - 'high': 功率高; */
  7540. powerLevel?: 'low' | 'medium' | 'high'
  7541. /** 接口调用成功的回调函数 */
  7542. success?: StartAdvertisingSuccessCallback
  7543. }
  7544. interface StartBeaconDiscoveryOption {
  7545. /** Beacon 设备广播的 UUID 列表 */
  7546. uuids: string[]
  7547. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7548. complete?: StartBeaconDiscoveryCompleteCallback
  7549. /** 接口调用失败的回调函数 */
  7550. fail?: StartBeaconDiscoveryFailCallback
  7551. /** 是否校验蓝牙开关,仅在 iOS 下有效。iOS 11 起,控制面板里关掉蓝牙,还是能继续使用 Beacon 服务。 */
  7552. ignoreBluetoothAvailable?: boolean
  7553. /** 接口调用成功的回调函数 */
  7554. success?: StartBeaconDiscoverySuccessCallback
  7555. }
  7556. interface StartBluetoothDevicesDiscoveryOption {
  7557. /** 是否允许重复上报同一设备。如果允许重复上报,则 [wx.onBlueToothDeviceFound](#) 方法会多次上报同一设备,但是 RSSI 值会有不同。 */
  7558. allowDuplicatesKey?: boolean
  7559. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7560. complete?: StartBluetoothDevicesDiscoveryCompleteCallback
  7561. /** 接口调用失败的回调函数 */
  7562. fail?: StartBluetoothDevicesDiscoveryFailCallback
  7563. /** 上报设备的间隔,单位 ms。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */
  7564. interval?: number
  7565. /** 扫描模式,越高扫描越快,也越耗电。仅安卓微信客户端 7.0.12 及以上支持。
  7566. *
  7567. * 可选值:
  7568. * - 'low': 低;
  7569. * - 'medium': 中;
  7570. * - 'high': 高; */
  7571. powerLevel?: 'low' | 'medium' | 'high'
  7572. /** 要搜索的蓝牙设备主服务的 UUID 列表(支持 16/32/128 位 UUID)。某些蓝牙设备会广播自己的主 service 的 UUID。如果设置此参数,则只搜索广播包有对应 UUID 的主服务的蓝牙设备。建议通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */
  7573. services?: string[]
  7574. /** 接口调用成功的回调函数 */
  7575. success?: StartBluetoothDevicesDiscoverySuccessCallback
  7576. }
  7577. interface StartCompassOption {
  7578. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7579. complete?: StartCompassCompleteCallback
  7580. /** 接口调用失败的回调函数 */
  7581. fail?: StartCompassFailCallback
  7582. /** 接口调用成功的回调函数 */
  7583. success?: StartCompassSuccessCallback
  7584. }
  7585. interface StartDeviceMotionListeningOption {
  7586. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7587. complete?: StartDeviceMotionListeningCompleteCallback
  7588. /** 接口调用失败的回调函数 */
  7589. fail?: StartDeviceMotionListeningFailCallback
  7590. /** 监听设备方向的变化回调函数的执行频率
  7591. *
  7592. * 可选值:
  7593. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  7594. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  7595. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  7596. interval?: 'game' | 'ui' | 'normal'
  7597. /** 接口调用成功的回调函数 */
  7598. success?: StartDeviceMotionListeningSuccessCallback
  7599. }
  7600. interface StartDiscoveryOption {
  7601. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7602. complete?: StartDiscoveryCompleteCallback
  7603. /** 接口调用失败的回调函数 */
  7604. fail?: StartDiscoveryFailCallback
  7605. /** 接口调用成功的回调函数 */
  7606. success?: StartDiscoverySuccessCallback
  7607. }
  7608. interface StartGyroscopeOption {
  7609. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7610. complete?: StartGyroscopeCompleteCallback
  7611. /** 接口调用失败的回调函数 */
  7612. fail?: StartGyroscopeFailCallback
  7613. /** 监听陀螺仪数据回调函数的执行频率
  7614. *
  7615. * 可选值:
  7616. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  7617. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  7618. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  7619. interval?: 'game' | 'ui' | 'normal'
  7620. /** 接口调用成功的回调函数 */
  7621. success?: StartGyroscopeSuccessCallback
  7622. }
  7623. interface StartHCEOption {
  7624. /** 需要注册到系统的 AID 列表 */
  7625. aid_list: string[]
  7626. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7627. complete?: StartHCECompleteCallback
  7628. /** 接口调用失败的回调函数 */
  7629. fail?: StartHCEFailCallback
  7630. /** 接口调用成功的回调函数 */
  7631. success?: StartHCESuccessCallback
  7632. }
  7633. interface StartLocalServiceDiscoveryFailCallbackResult {
  7634. /** 错误信息
  7635. *
  7636. * 可选值:
  7637. * - 'invalid param': serviceType 为空;
  7638. * - 'scan task already exist': 在当前 startLocalServiceDiscovery 发起的搜索未停止的情况下,再次调用 startLocalServiceDiscovery; */
  7639. errMsg: string
  7640. }
  7641. interface StartLocalServiceDiscoveryOption {
  7642. /** 要搜索的服务类型 */
  7643. serviceType: string
  7644. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7645. complete?: StartLocalServiceDiscoveryCompleteCallback
  7646. /** 接口调用失败的回调函数 */
  7647. fail?: StartLocalServiceDiscoveryFailCallback
  7648. /** 接口调用成功的回调函数 */
  7649. success?: StartLocalServiceDiscoverySuccessCallback
  7650. }
  7651. interface StartLocationUpdateBackgroundOption {
  7652. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7653. complete?: StartLocationUpdateBackgroundCompleteCallback
  7654. /** 接口调用失败的回调函数 */
  7655. fail?: StartLocationUpdateBackgroundFailCallback
  7656. /** 接口调用成功的回调函数 */
  7657. success?: StartLocationUpdateBackgroundSuccessCallback
  7658. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  7659. type?: string
  7660. }
  7661. interface StartLocationUpdateOption {
  7662. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7663. complete?: StartLocationUpdateCompleteCallback
  7664. /** 接口调用失败的回调函数 */
  7665. fail?: StartLocationUpdateFailCallback
  7666. /** 接口调用成功的回调函数 */
  7667. success?: StartLocationUpdateSuccessCallback
  7668. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  7669. type?: string
  7670. }
  7671. interface StartPreviewOption {
  7672. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7673. complete?: StartPreviewCompleteCallback
  7674. /** 接口调用失败的回调函数 */
  7675. fail?: StartPreviewFailCallback
  7676. /** 接口调用成功的回调函数 */
  7677. success?: StartPreviewSuccessCallback
  7678. }
  7679. interface StartPullDownRefreshOption {
  7680. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7681. complete?: StartPullDownRefreshCompleteCallback
  7682. /** 接口调用失败的回调函数 */
  7683. fail?: StartPullDownRefreshFailCallback
  7684. /** 接口调用成功的回调函数 */
  7685. success?: StartPullDownRefreshSuccessCallback
  7686. }
  7687. interface StartRecordSuccessCallbackResult {
  7688. /** 录音文件的临时路径 (本地路径) */
  7689. tempFilePath: string
  7690. errMsg: string
  7691. }
  7692. interface StartRecordTimeoutCallbackResult {
  7693. /** 封面图片文件的临时路径 (本地路径) */
  7694. tempThumbPath: string
  7695. /** 视频的文件的临时路径 (本地路径) */
  7696. tempVideoPath: string
  7697. }
  7698. interface StartSoterAuthenticationOption {
  7699. /** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */
  7700. challenge: string
  7701. /** 请求使用的可接受的生物认证方式
  7702. *
  7703. * 可选值:
  7704. * - 'fingerPrint': 指纹识别;
  7705. * - 'facial': 人脸识别;
  7706. * - 'speech': 声纹识别(暂未支持); */
  7707. requestAuthModes: Array<'fingerPrint' | 'facial' | 'speech'>
  7708. /** 验证描述,即识别过程中显示在界面上的对话框提示内容 */
  7709. authContent?: string
  7710. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7711. complete?: StartSoterAuthenticationCompleteCallback
  7712. /** 接口调用失败的回调函数 */
  7713. fail?: StartSoterAuthenticationFailCallback
  7714. /** 接口调用成功的回调函数 */
  7715. success?: StartSoterAuthenticationSuccessCallback
  7716. }
  7717. interface StartSoterAuthenticationSuccessCallbackResult {
  7718. /** 生物认证方式 */
  7719. authMode: string
  7720. /** 错误码 */
  7721. errCode: number
  7722. /** 错误信息 */
  7723. errMsg: string
  7724. /** 在设备安全区域(TEE)内获得的本机安全信息(如TEE名称版本号等以及防重放参数)以及本次认证信息(仅Android支持,本次认证的指纹ID)。具体说明见下文 */
  7725. resultJSON: string
  7726. /** 用SOTER安全密钥对 `resultJSON` 的签名(SHA256 with RSA/PSS, saltlen=20) */
  7727. resultJSONSignature: string
  7728. }
  7729. interface StartWifiOption {
  7730. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7731. complete?: StartWifiCompleteCallback
  7732. /** 接口调用失败的回调函数 */
  7733. fail?: StartWifiFailCallback
  7734. /** 接口调用成功的回调函数 */
  7735. success?: StartWifiSuccessCallback
  7736. }
  7737. interface StatFailCallbackResult {
  7738. /** 错误信息
  7739. *
  7740. * 可选值:
  7741. * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限;
  7742. * - 'fail no such file or directory ${path}': 文件不存在;
  7743. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  7744. errMsg: string
  7745. }
  7746. interface StatOption {
  7747. /** 文件/目录路径 (本地路径) */
  7748. path: string
  7749. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7750. complete?: StatCompleteCallback
  7751. /** 接口调用失败的回调函数 */
  7752. fail?: StatFailCallback
  7753. /** 需要基础库: `2.3.0`
  7754. *
  7755. * 是否递归获取目录下的每个文件的 Stats 信息 */
  7756. recursive?: boolean
  7757. /** 接口调用成功的回调函数 */
  7758. success?: StatSuccessCallback
  7759. }
  7760. interface StatSuccessCallbackResult {
  7761. /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Array.&lt;[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)&gt;
  7762. *
  7763. * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Array,数组的每一项是一个对象,每个对象包含 path 和 stats。 */
  7764. stats: Stats | Stats[]
  7765. errMsg: string
  7766. }
  7767. /** 描述文件状态的对象 */
  7768. interface Stats {
  7769. /** 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime */
  7770. lastAccessedTime: number
  7771. /** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */
  7772. lastModifiedTime: number
  7773. /** 文件的类型和存取的权限,对应 POSIX stat.st_mode */
  7774. mode: string
  7775. /** 文件大小,单位:B,对应 POSIX stat.st_size */
  7776. size: number
  7777. }
  7778. interface StepOption {
  7779. /** 动画延迟时间,单位 ms */
  7780. delay?: number
  7781. /** 动画持续时间,单位 ms */
  7782. duration?: number
  7783. /** 动画的效果
  7784. *
  7785. * 可选值:
  7786. * - 'linear': 动画从头到尾的速度是相同的;
  7787. * - 'ease': 动画以低速开始,然后加快,在结束前变慢;
  7788. * - 'ease-in': 动画以低速开始;
  7789. * - 'ease-in-out': 动画以低速开始和结束;
  7790. * - 'ease-out': 动画以低速结束;
  7791. * - 'step-start': 动画第一帧就跳至结束状态直到结束;
  7792. * - 'step-end': 动画一直保持开始状态,最后一帧跳到结束状态; */
  7793. timingFunction?:
  7794. | 'linear'
  7795. | 'ease'
  7796. | 'ease-in'
  7797. | 'ease-in-out'
  7798. | 'ease-out'
  7799. | 'step-start'
  7800. | 'step-end'
  7801. transformOrigin?: string
  7802. }
  7803. /** 贴纸类型 */
  7804. interface Sticker {
  7805. /** 贴纸帧数 */
  7806. len: number
  7807. /** 贴纸资源路径。资源必须为一个资源文件夹路径或一个压缩包路径,文件夹或压缩包内的贴纸资源必须按照 `{title}_{index}.{ext}` 格式命名。其中 `{title}` 为贴纸名称;`{index}` 为帧序号,从0开始;`{ext}` 为拓展名。 */
  7808. path: string
  7809. /** 贴纸名称 */
  7810. title: string
  7811. /** 贴纸触发动作
  7812. *
  7813. * 可选值:
  7814. * - -1: 循环播放;
  7815. * - 10: 张嘴;
  7816. * - 11: 噘嘴/kiss;
  7817. * - 12: 眨/闭左眼;
  7818. * - 13: 眨/闭右眼;
  7819. * - 14: 眨/闭眼;
  7820. * - 15: 挑眉毛;
  7821. * - 16: 左右摇头;
  7822. * - 17: 上下点头;
  7823. * - 100: 比心;
  7824. * - 101: 张开手掌;
  7825. * - 102: 剪刀手/比耶/胜利;
  7826. * - 103: 握拳;
  7827. * - 104: 数字1;
  7828. * - 105: 我爱你;
  7829. * - 106: 点赞;
  7830. * - 107: OK;
  7831. * - 108: Rock&Roll;
  7832. * - 109: 数字6;
  7833. * - 110: 数字8;
  7834. * - 111: 暂不支持(留空);
  7835. * - 112: 双手抱拳/恭喜发财; */
  7836. active?:
  7837. | -1
  7838. | 10
  7839. | 11
  7840. | 12
  7841. | 13
  7842. | 14
  7843. | 15
  7844. | 16
  7845. | 17
  7846. | 100
  7847. | 101
  7848. | 102
  7849. | 103
  7850. | 104
  7851. | 105
  7852. | 106
  7853. | 107
  7854. | 108
  7855. | 109
  7856. | 110
  7857. | 111
  7858. | 112
  7859. /** 贴纸ID */
  7860. id?: string
  7861. /** 贴纸资源 md5 */
  7862. md5?: string
  7863. /** 贴纸位置,格式为 [x1,y1,x2,y2] 。当 `type` 为 `'2D'` 或 `'front'` 时必填。仅 2D 贴纸和前景贴纸有效 */
  7864. pos?: string[]
  7865. /** 背景贴纸展示位置。仅背景贴纸有效
  7866. *
  7867. * 可选值:
  7868. * - 0: 背景贴纸;
  7869. * - 1: 只在人像区域显示的贴纸; */
  7870. segtype?: 0 | 1
  7871. }
  7872. interface StopAccelerometerOption {
  7873. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7874. complete?: StopAccelerometerCompleteCallback
  7875. /** 接口调用失败的回调函数 */
  7876. fail?: StopAccelerometerFailCallback
  7877. /** 接口调用成功的回调函数 */
  7878. success?: StopAccelerometerSuccessCallback
  7879. }
  7880. interface StopAdvertisingOption {
  7881. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7882. complete?: StopAdvertisingCompleteCallback
  7883. /** 接口调用失败的回调函数 */
  7884. fail?: StopAdvertisingFailCallback
  7885. /** 接口调用成功的回调函数 */
  7886. success?: StopAdvertisingSuccessCallback
  7887. }
  7888. interface StopBGMOption {
  7889. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7890. complete?: StopBGMCompleteCallback
  7891. /** 接口调用失败的回调函数 */
  7892. fail?: StopBGMFailCallback
  7893. /** 接口调用成功的回调函数 */
  7894. success?: StopBGMSuccessCallback
  7895. }
  7896. interface StopBackgroundAudioOption {
  7897. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7898. complete?: StopBackgroundAudioCompleteCallback
  7899. /** 接口调用失败的回调函数 */
  7900. fail?: StopBackgroundAudioFailCallback
  7901. /** 接口调用成功的回调函数 */
  7902. success?: StopBackgroundAudioSuccessCallback
  7903. }
  7904. interface StopBeaconDiscoveryOption {
  7905. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7906. complete?: StopBeaconDiscoveryCompleteCallback
  7907. /** 接口调用失败的回调函数 */
  7908. fail?: StopBeaconDiscoveryFailCallback
  7909. /** 接口调用成功的回调函数 */
  7910. success?: StopBeaconDiscoverySuccessCallback
  7911. }
  7912. interface StopBluetoothDevicesDiscoveryOption {
  7913. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7914. complete?: StopBluetoothDevicesDiscoveryCompleteCallback
  7915. /** 接口调用失败的回调函数 */
  7916. fail?: StopBluetoothDevicesDiscoveryFailCallback
  7917. /** 接口调用成功的回调函数 */
  7918. success?: StopBluetoothDevicesDiscoverySuccessCallback
  7919. }
  7920. interface StopCompassOption {
  7921. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7922. complete?: StopCompassCompleteCallback
  7923. /** 接口调用失败的回调函数 */
  7924. fail?: StopCompassFailCallback
  7925. /** 接口调用成功的回调函数 */
  7926. success?: StopCompassSuccessCallback
  7927. }
  7928. interface StopDeviceMotionListeningOption {
  7929. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7930. complete?: StopDeviceMotionListeningCompleteCallback
  7931. /** 接口调用失败的回调函数 */
  7932. fail?: StopDeviceMotionListeningFailCallback
  7933. /** 接口调用成功的回调函数 */
  7934. success?: StopDeviceMotionListeningSuccessCallback
  7935. }
  7936. interface StopDiscoveryOption {
  7937. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7938. complete?: StopDiscoveryCompleteCallback
  7939. /** 接口调用失败的回调函数 */
  7940. fail?: StopDiscoveryFailCallback
  7941. /** 接口调用成功的回调函数 */
  7942. success?: StopDiscoverySuccessCallback
  7943. }
  7944. interface StopFaceDetectOption {
  7945. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7946. complete?: StopFaceDetectCompleteCallback
  7947. /** 接口调用失败的回调函数 */
  7948. fail?: StopFaceDetectFailCallback
  7949. /** 接口调用成功的回调函数 */
  7950. success?: StopFaceDetectSuccessCallback
  7951. }
  7952. interface StopGyroscopeOption {
  7953. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7954. complete?: StopGyroscopeCompleteCallback
  7955. /** 接口调用失败的回调函数 */
  7956. fail?: StopGyroscopeFailCallback
  7957. /** 接口调用成功的回调函数 */
  7958. success?: StopGyroscopeSuccessCallback
  7959. }
  7960. interface StopHCEOption {
  7961. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7962. complete?: StopHCECompleteCallback
  7963. /** 接口调用失败的回调函数 */
  7964. fail?: StopHCEFailCallback
  7965. /** 接口调用成功的回调函数 */
  7966. success?: StopHCESuccessCallback
  7967. }
  7968. interface StopLocalServiceDiscoveryFailCallbackResult {
  7969. /** 错误信息
  7970. *
  7971. * 可选值:
  7972. * - 'task not found': 在当前没有处在搜索服务中的情况下调用 stopLocalServiceDiscovery; */
  7973. errMsg: string
  7974. }
  7975. interface StopLocalServiceDiscoveryOption {
  7976. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7977. complete?: StopLocalServiceDiscoveryCompleteCallback
  7978. /** 接口调用失败的回调函数 */
  7979. fail?: StopLocalServiceDiscoveryFailCallback
  7980. /** 接口调用成功的回调函数 */
  7981. success?: StopLocalServiceDiscoverySuccessCallback
  7982. }
  7983. interface StopLocationUpdateOption {
  7984. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7985. complete?: StopLocationUpdateCompleteCallback
  7986. /** 接口调用失败的回调函数 */
  7987. fail?: StopLocationUpdateFailCallback
  7988. /** 接口调用成功的回调函数 */
  7989. success?: StopLocationUpdateSuccessCallback
  7990. }
  7991. interface StopOption {
  7992. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7993. complete?: StopCompleteCallback
  7994. /** 接口调用失败的回调函数 */
  7995. fail?: StopFailCallback
  7996. /** 接口调用成功的回调函数 */
  7997. success?: StopSuccessCallback
  7998. }
  7999. interface StopPreviewOption {
  8000. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8001. complete?: StopPreviewCompleteCallback
  8002. /** 接口调用失败的回调函数 */
  8003. fail?: StopPreviewFailCallback
  8004. /** 接口调用成功的回调函数 */
  8005. success?: StopPreviewSuccessCallback
  8006. }
  8007. interface StopPullDownRefreshOption {
  8008. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8009. complete?: StopPullDownRefreshCompleteCallback
  8010. /** 接口调用失败的回调函数 */
  8011. fail?: StopPullDownRefreshFailCallback
  8012. /** 接口调用成功的回调函数 */
  8013. success?: StopPullDownRefreshSuccessCallback
  8014. }
  8015. interface StopRecordSuccessCallbackResult {
  8016. /** 封面图片文件的临时路径 (本地路径) */
  8017. tempThumbPath: string
  8018. /** 视频的文件的临时路径 (本地路径) */
  8019. tempVideoPath: string
  8020. errMsg: string
  8021. }
  8022. interface StopVoiceOption {
  8023. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8024. complete?: StopVoiceCompleteCallback
  8025. /** 接口调用失败的回调函数 */
  8026. fail?: StopVoiceFailCallback
  8027. /** 接口调用成功的回调函数 */
  8028. success?: StopVoiceSuccessCallback
  8029. }
  8030. interface StopWifiOption {
  8031. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8032. complete?: StopWifiCompleteCallback
  8033. /** 接口调用失败的回调函数 */
  8034. fail?: StopWifiFailCallback
  8035. /** 接口调用成功的回调函数 */
  8036. success?: StopWifiSuccessCallback
  8037. }
  8038. interface SubscribeVoIPVideoMembersOption {
  8039. /** 订阅的成员列表 */
  8040. openIdList: string[]
  8041. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8042. complete?: SubscribeVoIPVideoMembersCompleteCallback
  8043. /** 接口调用失败的回调函数 */
  8044. fail?: SubscribeVoIPVideoMembersFailCallback
  8045. /** 接口调用成功的回调函数 */
  8046. success?: SubscribeVoIPVideoMembersSuccessCallback
  8047. }
  8048. /** 订阅消息设置
  8049. *
  8050. * **示例代码**
  8051. *
  8052. * ```javascript
  8053. wx.getSetting({
  8054. withSubscriptions: true,
  8055. success (res) {
  8056. console.log(res.authSetting)
  8057. // res.authSetting = {
  8058. // "scope.userInfo": true,
  8059. // "scope.userLocation": true
  8060. // }
  8061. console.log(res.subscriptionsSetting)
  8062. // res.subscriptionsSetting = {
  8063. // mainSwitch: true, // 订阅消息总开关
  8064. // itemSettings: { // 每一项开关
  8065. // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
  8066. // SYS_MSG_TYPE_RANK: 'accept'
  8067. // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
  8068. // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
  8069. // }
  8070. // }
  8071. }
  8072. })
  8073. ``` */
  8074. interface SubscriptionsSetting {
  8075. /** 订阅消息总开关,true为开启,false为关闭 */
  8076. mainSwitch: boolean
  8077. /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](https://developers.weixin.qq.com/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html)
  8078. * ## 注意事项
  8079. * - itemSettings 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
  8080. itemSettings?: IAnyObject
  8081. }
  8082. interface SwitchCameraOption {
  8083. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8084. complete?: SwitchCameraCompleteCallback
  8085. /** 接口调用失败的回调函数 */
  8086. fail?: SwitchCameraFailCallback
  8087. /** 接口调用成功的回调函数 */
  8088. success?: SwitchCameraSuccessCallback
  8089. }
  8090. interface SwitchTabOption {
  8091. /** 需要跳转的 tabBar 页面的路径 (代码包路径)(需在 app.json 的 [tabBar](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#tabbar) 字段定义的页面),路径后不能带参数。 */
  8092. url: string
  8093. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8094. complete?: SwitchTabCompleteCallback
  8095. /** 接口调用失败的回调函数 */
  8096. fail?: SwitchTabFailCallback
  8097. /** 接口调用成功的回调函数 */
  8098. success?: SwitchTabSuccessCallback
  8099. }
  8100. interface SystemInfo {
  8101. /** 需要基础库: `1.1.0`
  8102. *
  8103. * 客户端基础库版本 */
  8104. SDKVersion: string
  8105. /** 需要基础库: `2.6.0`
  8106. *
  8107. * 允许微信使用相册的开关(仅 iOS 有效) */
  8108. albumAuthorized: boolean
  8109. /** 需要基础库: `1.8.0`
  8110. *
  8111. * 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
  8112. benchmarkLevel: number
  8113. /** 需要基础库: `2.6.0`
  8114. *
  8115. * 蓝牙的系统开关 */
  8116. bluetoothEnabled: boolean
  8117. /** 需要基础库: `1.5.0`
  8118. *
  8119. * 设备品牌 */
  8120. brand: string
  8121. /** 需要基础库: `2.6.0`
  8122. *
  8123. * 允许微信使用摄像头的开关 */
  8124. cameraAuthorized: boolean
  8125. /** 设备方向
  8126. *
  8127. * 可选值:
  8128. * - 'portrait': 竖屏;
  8129. * - 'landscape': 横屏; */
  8130. deviceOrientation: 'portrait' | 'landscape'
  8131. /** 需要基础库: `2.15.0`
  8132. *
  8133. * 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 */
  8134. enableDebug: boolean
  8135. /** 需要基础库: `1.5.0`
  8136. *
  8137. * 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
  8138. fontSizeSetting: number
  8139. /** 需要基础库: `2.12.3`
  8140. *
  8141. * 当前小程序运行的宿主环境 */
  8142. host: SystemInfoHost
  8143. /** 微信设置的语言 */
  8144. language: string
  8145. /** 需要基础库: `2.6.0`
  8146. *
  8147. * 允许微信使用定位的开关 */
  8148. locationAuthorized: boolean
  8149. /** 需要基础库: `2.6.0`
  8150. *
  8151. * 地理位置的系统开关 */
  8152. locationEnabled: boolean
  8153. /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
  8154. locationReducedAccuracy: boolean
  8155. /** 需要基础库: `2.6.0`
  8156. *
  8157. * 允许微信使用麦克风的开关 */
  8158. microphoneAuthorized: boolean
  8159. /** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */
  8160. model: string
  8161. /** 需要基础库: `2.6.0`
  8162. *
  8163. * 允许微信通知带有提醒的开关(仅 iOS 有效) */
  8164. notificationAlertAuthorized: boolean
  8165. /** 需要基础库: `2.6.0`
  8166. *
  8167. * 允许微信通知的开关 */
  8168. notificationAuthorized: boolean
  8169. /** 需要基础库: `2.6.0`
  8170. *
  8171. * 允许微信通知带有标记的开关(仅 iOS 有效) */
  8172. notificationBadgeAuthorized: boolean
  8173. /** 需要基础库: `2.6.0`
  8174. *
  8175. * 允许微信通知带有声音的开关(仅 iOS 有效) */
  8176. notificationSoundAuthorized: boolean
  8177. /** 需要基础库: `2.19.3`
  8178. *
  8179. * 允许微信使用日历的开关 */
  8180. phoneCalendarAuthorized: boolean
  8181. /** 设备像素比 */
  8182. pixelRatio: number
  8183. /** 客户端平台
  8184. *
  8185. * 可选值:
  8186. * - 'ios': iOS微信(包含 iPhone、iPad);
  8187. * - 'android': Android微信;
  8188. * - 'windows': Windows微信;
  8189. * - 'mac': macOS微信;
  8190. * - 'devtools': 微信开发者工具; */
  8191. platform: 'ios' | 'android' | 'windows' | 'mac' | 'devtools'
  8192. /** 需要基础库: `2.7.0`
  8193. *
  8194. * 在竖屏正方向下的安全区域 */
  8195. safeArea: SafeArea
  8196. /** 需要基础库: `1.1.0`
  8197. *
  8198. * 屏幕高度,单位px */
  8199. screenHeight: number
  8200. /** 需要基础库: `1.1.0`
  8201. *
  8202. * 屏幕宽度,单位px */
  8203. screenWidth: number
  8204. /** 需要基础库: `1.9.0`
  8205. *
  8206. * 状态栏的高度,单位px */
  8207. statusBarHeight: number
  8208. /** 操作系统及版本 */
  8209. system: string
  8210. /** 微信版本号 */
  8211. version: string
  8212. /** 需要基础库: `2.6.0`
  8213. *
  8214. * Wi-Fi 的系统开关 */
  8215. wifiEnabled: boolean
  8216. /** 可使用窗口高度,单位px */
  8217. windowHeight: number
  8218. /** 可使用窗口宽度,单位px */
  8219. windowWidth: number
  8220. /** 需要基础库: `2.11.0`
  8221. *
  8222. * 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
  8223. *
  8224. * 可选值:
  8225. * - 'dark': 深色主题;
  8226. * - 'light': 浅色主题; */
  8227. theme?: 'dark' | 'light'
  8228. }
  8229. /** 需要基础库: `2.12.3`
  8230. *
  8231. * 当前小程序运行的宿主环境 */
  8232. interface SystemInfoHost {
  8233. /** 宿主 app 对应的 appId */
  8234. appId: string
  8235. }
  8236. interface SystemSetting {
  8237. /** 蓝牙的系统开关 */
  8238. bluetoothEnabled: boolean
  8239. /** 设备方向
  8240. *
  8241. * 可选值:
  8242. * - 'portrait': 竖屏;
  8243. * - 'landscape': 横屏; */
  8244. deviceOrientation: 'portrait' | 'landscape'
  8245. /** 地理位置的系统开关 */
  8246. locationEnabled: boolean
  8247. /** Wi-Fi 的系统开关 */
  8248. wifiEnabled: boolean
  8249. }
  8250. interface TCPSocketConnectOption {
  8251. /** 套接字要连接的地址 */
  8252. address: string
  8253. /** 套接字要连接的端口 */
  8254. port: number
  8255. /** 套接字要连接的超时时间,默认为 2s */
  8256. timeout?: number
  8257. }
  8258. interface TCPSocketOnMessageListenerResult {
  8259. /** 接收端地址信息 */
  8260. localInfo: LocalInfo
  8261. /** 收到的消息 */
  8262. message: ArrayBuffer
  8263. /** 发送端地址信息 */
  8264. remoteInfo: RemoteInfo
  8265. }
  8266. interface TakePhotoOption {
  8267. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8268. complete?: TakePhotoCompleteCallback
  8269. /** 接口调用失败的回调函数 */
  8270. fail?: TakePhotoFailCallback
  8271. /** 成像质量
  8272. *
  8273. * 可选值:
  8274. * - 'high': 高质量;
  8275. * - 'normal': 普通质量;
  8276. * - 'low': 低质量; */
  8277. quality?: 'high' | 'normal' | 'low'
  8278. /** 需要基础库: `2.22.0`
  8279. *
  8280. * 是否开启镜像 */
  8281. selfieMirror?: boolean
  8282. /** 接口调用成功的回调函数 */
  8283. success?: TakePhotoSuccessCallback
  8284. }
  8285. interface TakePhotoSuccessCallbackResult {
  8286. /** 照片文件的临时路径 (本地路径),安卓是jpg图片格式,ios是png */
  8287. tempImagePath: string
  8288. errMsg: string
  8289. }
  8290. /** 标签类型枚举 */
  8291. interface TechType {
  8292. /** 对应IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */
  8293. isoDep: string
  8294. /** 对应MifareClassic实例,实例支持MIFARE Classic标签的读写 */
  8295. mifareClassic: string
  8296. /** 对应MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */
  8297. mifareUltralight: string
  8298. /** 对应Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */
  8299. ndef: string
  8300. /** 对应NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */
  8301. nfcA: string
  8302. /** 对应NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */
  8303. nfcB: string
  8304. /** 对应NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */
  8305. nfcF: string
  8306. /** 对应NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */
  8307. nfcV: string
  8308. }
  8309. interface TextMetrics {
  8310. /** 文本的宽度 */
  8311. width: number
  8312. }
  8313. /** 动画配置 */
  8314. interface TimingOption {
  8315. /** 动画时长 */
  8316. duration?: number
  8317. /** worklet 函数定义的动画曲线。可使用 wx.worklet.Easing 中预设的动画曲线。 */
  8318. easing?: string
  8319. }
  8320. interface ToScreenLocationOption {
  8321. /** 纬度 */
  8322. latitude: number
  8323. /** 经度 */
  8324. longitude: number
  8325. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8326. complete?: ToScreenLocationCompleteCallback
  8327. /** 接口调用失败的回调函数 */
  8328. fail?: ToScreenLocationFailCallback
  8329. /** 接口调用成功的回调函数 */
  8330. success?: ToScreenLocationSuccessCallback
  8331. }
  8332. interface ToScreenLocationSuccessCallbackResult {
  8333. /** x 坐标值 */
  8334. x: number
  8335. /** y 坐标值 */
  8336. y: number
  8337. errMsg: string
  8338. }
  8339. interface ToggleTorchOption {
  8340. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8341. complete?: ToggleTorchCompleteCallback
  8342. /** 接口调用失败的回调函数 */
  8343. fail?: ToggleTorchFailCallback
  8344. /** 接口调用成功的回调函数 */
  8345. success?: ToggleTorchSuccessCallback
  8346. }
  8347. /** 跟踪能力配置,目前不同的跟踪能力之间是互斥的,默认使用平面跟踪能力。需要注意目前 track 中不同的跟踪配置存在互斥关系(比如 marker 跟踪配置和 OSD 跟踪配置不能同时存在),请按需配置。 */
  8348. interface Track {
  8349. /** 平面跟踪配置 */
  8350. plane: PlaneTrack
  8351. /** 需要基础库: `2.27.0`
  8352. *
  8353. * OCR检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
  8354. OCR?: OCRTrack
  8355. /** 需要基础库: `2.24.5`
  8356. *
  8357. * OSD 跟踪配置 */
  8358. OSD?: boolean
  8359. /** 需要基础库: `2.28.0`
  8360. *
  8361. * 人体检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
  8362. body?: BodyTrack
  8363. /** 需要基础库: `2.25.0`
  8364. *
  8365. * 人脸检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。 */
  8366. face?: FaceTrack
  8367. /** 需要基础库: `2.28.0`
  8368. *
  8369. * 手势检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
  8370. hand?: HandTrack
  8371. /** 需要基础库: `2.24.5`
  8372. *
  8373. * marker 跟踪配置 */
  8374. marker?: boolean
  8375. /** 需要基础库: `2.28.0`
  8376. *
  8377. * 提供基础AR功能,输出相机旋转的3个自由度的位姿,利用手机陀螺仪传感器,实现快速稳定的AR定位能力,适用于简单AR场景。 */
  8378. threeDof?: boolean
  8379. }
  8380. interface TransceiveOption {
  8381. /** 需要传递的二进制数据 */
  8382. data: ArrayBuffer
  8383. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8384. complete?: TransceiveCompleteCallback
  8385. /** 接口调用失败的回调函数 */
  8386. fail?: TransceiveFailCallback
  8387. /** 接口调用成功的回调函数 */
  8388. success?: TransceiveSuccessCallback
  8389. }
  8390. interface TransceiveSuccessCallbackResult {
  8391. data: ArrayBuffer
  8392. errMsg: string
  8393. }
  8394. interface TranslateMarkerOption {
  8395. /** 移动过程中是否自动旋转 marker */
  8396. autoRotate: boolean
  8397. /** 指定 marker 移动到的目标点 */
  8398. destination: DestinationOption
  8399. /** 指定 marker */
  8400. markerId: number
  8401. /** marker 的旋转角度 */
  8402. rotate: number
  8403. /** 动画结束回调函数 */
  8404. animationEnd?: (...args: any[]) => any
  8405. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8406. complete?: TranslateMarkerCompleteCallback
  8407. /** 动画持续时长,平移与旋转分别计算 */
  8408. duration?: number
  8409. /** 接口调用失败的回调函数 */
  8410. fail?: TranslateMarkerFailCallback
  8411. /** 需要基础库: `2.13.0`
  8412. *
  8413. * 平移和旋转同时进行 */
  8414. moveWithRotate?: boolean
  8415. /** 接口调用成功的回调函数 */
  8416. success?: TranslateMarkerSuccessCallback
  8417. }
  8418. interface TruncateFailCallbackResult {
  8419. /** 错误信息
  8420. *
  8421. * 可选值:
  8422. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
  8423. * - 'fail illegal operation on a directory, open "${filePath}"': 指定的 filePath 是一个已经存在的目录;
  8424. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
  8425. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  8426. * - 'fail sdcard not mounted': android sdcard 挂载失败; */
  8427. errMsg: string
  8428. }
  8429. interface TruncateOption {
  8430. /** 要截断的文件路径 (本地路径) */
  8431. filePath: string
  8432. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8433. complete?: TruncateCompleteCallback
  8434. /** 接口调用失败的回调函数 */
  8435. fail?: TruncateFailCallback
  8436. /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  8437. length?: number
  8438. /** 接口调用成功的回调函数 */
  8439. success?: TruncateSuccessCallback
  8440. }
  8441. interface TruncateSyncOption {
  8442. /** 要截断的文件路径 (本地路径) */
  8443. filePath: string
  8444. /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  8445. length?: number
  8446. }
  8447. interface UDPSocketConnectOption {
  8448. /** 要发消息的地址 */
  8449. address: string
  8450. /** 要发送消息的端口号 */
  8451. port: number
  8452. }
  8453. interface UDPSocketOnMessageListenerResult {
  8454. /** 接收端地址信息,2.18.0 起支持 */
  8455. localInfo: LocalInfo
  8456. /** 收到的消息。消息长度需要小于4096。 */
  8457. message: ArrayBuffer
  8458. /** 发送端地址信息 */
  8459. remoteInfo: RemoteInfo
  8460. }
  8461. interface UDPSocketSendOption {
  8462. /** 要发消息的地址。在基础库 <= 2.9.3 版本必须是和本机同网段的 IP 地址,或安全域名列表内的域名地址;之后版本可以是任意 IP 和域名 */
  8463. address: string
  8464. /** 要发送的数据 */
  8465. message: string | ArrayBuffer
  8466. /** 要发送消息的端口号 */
  8467. port: number
  8468. /** 发送数据的长度,仅当 message 为 ArrayBuffer 类型时有效 */
  8469. length?: number
  8470. /** 发送数据的偏移量,仅当 message 为 ArrayBuffer 类型时有效 */
  8471. offset?: number
  8472. /** 向指定地址发消息时,是否要开启广播,基础库 2.24.0 开始支持 */
  8473. setBroadcast?: boolean
  8474. }
  8475. interface UndoOption {
  8476. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8477. complete?: UndoCompleteCallback
  8478. /** 接口调用失败的回调函数 */
  8479. fail?: UndoFailCallback
  8480. /** 接口调用成功的回调函数 */
  8481. success?: UndoSuccessCallback
  8482. }
  8483. interface UnlinkFailCallbackResult {
  8484. /** 错误信息
  8485. *
  8486. * 可选值:
  8487. * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限;
  8488. * - 'fail no such file or directory ${path}': 文件不存在;
  8489. * - 'fail operation not permitted, unlink ${filePath}': 传入的 filePath 是一个目录;
  8490. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  8491. errMsg: string
  8492. }
  8493. interface UnlinkOption {
  8494. /** 要删除的文件路径 (本地路径) */
  8495. filePath: string
  8496. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8497. complete?: UnlinkCompleteCallback
  8498. /** 接口调用失败的回调函数 */
  8499. fail?: UnlinkFailCallback
  8500. /** 接口调用成功的回调函数 */
  8501. success?: UnlinkSuccessCallback
  8502. }
  8503. interface UnzipFailCallbackResult {
  8504. /** 错误信息
  8505. *
  8506. * 可选值:
  8507. * - 'fail permission denied, unzip ${zipFilePath} -> ${destPath}': 指定目标文件路径没有写权限;
  8508. * - 'fail no such file or directory, unzip ${zipFilePath} -> "${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */
  8509. errMsg: string
  8510. }
  8511. interface UnzipOption {
  8512. /** 目标目录路径, 支持本地路径 */
  8513. targetPath: string
  8514. /** 源文件路径,支持本地路径, 只可以是 zip 压缩文件 */
  8515. zipFilePath: string
  8516. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8517. complete?: UnzipCompleteCallback
  8518. /** 接口调用失败的回调函数 */
  8519. fail?: UnzipFailCallback
  8520. /** 接口调用成功的回调函数 */
  8521. success?: UnzipSuccessCallback
  8522. }
  8523. /** 参数列表 */
  8524. interface UpdatableMessageFrontEndParameter {
  8525. /** 参数名 */
  8526. name: string
  8527. /** 参数值 */
  8528. value: string
  8529. }
  8530. /** 需要基础库: `2.4.0`
  8531. *
  8532. * 动态消息的模板信息 */
  8533. interface UpdatableMessageFrontEndTemplateInfo {
  8534. /** 参数列表 */
  8535. parameterList: UpdatableMessageFrontEndParameter[]
  8536. }
  8537. interface UpdateGroundOverlayOption {
  8538. /** 图片覆盖的经纬度范围 */
  8539. bounds: MapBounds
  8540. /** 图片图层 id */
  8541. id: string
  8542. /** 图片路径,支持网络图片、临时路径、代码包路径 */
  8543. src: string
  8544. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8545. complete?: UpdateGroundOverlayCompleteCallback
  8546. /** 接口调用失败的回调函数 */
  8547. fail?: UpdateGroundOverlayFailCallback
  8548. /** 图层透明度 */
  8549. opacity?: number
  8550. /** 接口调用成功的回调函数 */
  8551. success?: UpdateGroundOverlaySuccessCallback
  8552. /** 是否可见 */
  8553. visible?: boolean
  8554. /** 图层绘制顺序 */
  8555. zIndex?: number
  8556. }
  8557. interface UpdateShareMenuOption {
  8558. /** 需要基础库: `2.4.0`
  8559. *
  8560. * 动态消息的 activityId。通过 [updatableMessage.createActivityId](#) 接口获取 */
  8561. activityId?: string
  8562. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8563. complete?: UpdateShareMenuCompleteCallback
  8564. /** 接口调用失败的回调函数 */
  8565. fail?: UpdateShareMenuFailCallback
  8566. /** 需要基础库: `2.13.0`
  8567. *
  8568. * 是否是私密消息。详见 [小程序私密消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html) */
  8569. isPrivateMessage?: boolean
  8570. /** 需要基础库: `2.4.0`
  8571. *
  8572. * 是否是动态消息,详见[动态消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/updatable-message.html) */
  8573. isUpdatableMessage?: boolean
  8574. /** 接口调用成功的回调函数 */
  8575. success?: UpdateShareMenuSuccessCallback
  8576. /** 需要基础库: `2.4.0`
  8577. *
  8578. * 动态消息的模板信息 */
  8579. templateInfo?: UpdatableMessageFrontEndTemplateInfo
  8580. /** 需要基础库: `2.11.0`
  8581. *
  8582. * 群待办消息的id,通过toDoActivityId可以把多个群待办消息聚合为同一个。通过 [updatableMessage.createActivityId](#) 接口获取。详见[群待办消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  8583. toDoActivityId?: string
  8584. /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  8585. withShareTicket?: boolean
  8586. }
  8587. interface UpdateVoIPChatMuteConfigOption {
  8588. /** 静音设置 */
  8589. muteConfig: MuteConfig
  8590. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8591. complete?: UpdateVoIPChatMuteConfigCompleteCallback
  8592. /** 接口调用失败的回调函数 */
  8593. fail?: UpdateVoIPChatMuteConfigFailCallback
  8594. /** 接口调用成功的回调函数 */
  8595. success?: UpdateVoIPChatMuteConfigSuccessCallback
  8596. }
  8597. interface UpdateWeChatAppOption {
  8598. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8599. complete?: UpdateWeChatAppCompleteCallback
  8600. /** 接口调用失败的回调函数 */
  8601. fail?: UpdateWeChatAppFailCallback
  8602. /** 接口调用成功的回调函数 */
  8603. success?: UpdateWeChatAppSuccessCallback
  8604. }
  8605. interface UploadFileOption {
  8606. /** 要上传文件资源的路径 (本地路径) */
  8607. filePath: string
  8608. /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
  8609. name: string
  8610. /** 开发者服务器地址 */
  8611. url: string
  8612. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8613. complete?: UploadFileCompleteCallback
  8614. /** 接口调用失败的回调函数 */
  8615. fail?: UploadFileFailCallback
  8616. /** HTTP 请求中其他额外的 form data */
  8617. formData?: IAnyObject
  8618. /** HTTP 请求 Header,Header 中不能设置 Referer */
  8619. header?: IAnyObject
  8620. /** 接口调用成功的回调函数 */
  8621. success?: UploadFileSuccessCallback
  8622. /** 需要基础库: `2.10.0`
  8623. *
  8624. * 超时时间,单位为毫秒 */
  8625. timeout?: number
  8626. }
  8627. interface UploadFileSuccessCallbackResult {
  8628. /** 开发者服务器返回的数据 */
  8629. data: string
  8630. /** 开发者服务器返回的 HTTP 状态码 */
  8631. statusCode: number
  8632. errMsg: string
  8633. }
  8634. interface UploadTaskOnProgressUpdateListenerResult {
  8635. /** 上传进度百分比 */
  8636. progress: number
  8637. /** 预期需要上传的数据总长度,单位 Bytes */
  8638. totalBytesExpectedToSend: number
  8639. /** 已经上传的数据长度,单位 Bytes */
  8640. totalBytesSent: number
  8641. }
  8642. /** @warning **用户头像昵称获取规则已调整,参考 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)、[小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
  8643. *
  8644. * 用户信息 */
  8645. interface UserInfo {
  8646. /** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */
  8647. avatarUrl: string
  8648. /** 用户所在城市。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
  8649. city: string
  8650. /** 用户所在国家。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
  8651. country: string
  8652. /** 用户性别。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801)
  8653. *
  8654. * 可选值:
  8655. * - 0: 未知;
  8656. * - 1: 男性;
  8657. * - 2: 女性; */
  8658. gender: 0 | 1 | 2
  8659. /** 显示 country,province,city 所用的语言。强制返回 “zh_CN”,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801)
  8660. *
  8661. * 可选值:
  8662. * - 'en': 英文;
  8663. * - 'zh_CN': 简体中文;
  8664. * - 'zh_TW': 繁体中文; */
  8665. language: 'en' | 'zh_CN' | 'zh_TW'
  8666. /** 用户昵称 */
  8667. nickName: string
  8668. /** 用户所在省份。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
  8669. province: string
  8670. }
  8671. /** 需要基础库: `2.28.0`
  8672. *
  8673. * 人体 anchor
  8674. *
  8675. * **示例代码**
  8676. *
  8677. * [静态图像body检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-body-detect)
  8678. *
  8679. * [实时摄像头body检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/body-detect) */
  8680. interface VKBodyAnchor {
  8681. /** 关键点的置信度 */
  8682. confidence: number[]
  8683. /** 识别序号 */
  8684. detectId: number
  8685. /** 唯一标识 */
  8686. id: number
  8687. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8688. origin: VKOrigin
  8689. /** 关键点 */
  8690. points: VKOrigin[]
  8691. /** 总体置信值 */
  8692. score: number
  8693. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8694. size: VKSize
  8695. /** 类型
  8696. *
  8697. * 可选值:
  8698. * - 5: 人体; */
  8699. type: 5
  8700. }
  8701. /** 需要基础库: `2.20.0`
  8702. *
  8703. * 相机对象 */
  8704. interface VKCamera {
  8705. /** 需要基础库: `2.22.0`
  8706. *
  8707. * 相机内参,只有 v2 版本支持 */
  8708. intrinsics: Float32Array
  8709. /** 视图矩阵 */
  8710. viewMatrix: Float32Array
  8711. }
  8712. interface VKConfig {
  8713. /** 跟踪能力配置,目前不同的跟踪能力之间是互斥的,默认使用平面跟踪能力。需要注意目前 track 中不同的跟踪配置存在互斥关系(比如 marker 跟踪配置和 OSD 跟踪配置不能同时存在),请按需配置。 */
  8714. track: Track
  8715. /** 需要基础库: `2.23.0`
  8716. *
  8717. * 绑定的 WebGLRenderingContext 对象 */
  8718. gl?: WebGLRenderingContext
  8719. /** 需要基础库: `2.22.0`
  8720. *
  8721. * vision kit 版本。
  8722. *
  8723. * 可选值:
  8724. * - 'v1': v1适用于用户在平面场景下,例如桌面,地面,泛平面场景,放置虚拟物体,不提供真实世界距离。用户放置物体时,手机相机倾斜向下对着目标平面点击即可,具有广泛的机型支持;
  8725. * - 'v2': v2提供真实物理距离的 ar 定位功能,提供平面识别功能,用户在平面范围点击放置虚拟物体的功能,具有[有限的机型支持](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/plane.html#%E9%99%84%E5%BD%95)。iOS 设备在基础库 2.22.0 开始支持v2。安卓设备在基础库 2.25.1 开始支持v2,另外,安卓v2不支持竖直平面。**使用v2算法需要初始化,移动手机进行左右平移初始化效果最佳。**; */
  8726. version?: 'v1' | 'v2'
  8727. }
  8728. /** 需要基础库: `2.25.0`
  8729. *
  8730. * 人脸 anchor
  8731. *
  8732. * **示例代码**
  8733. *
  8734. * [静态图像人脸检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-face-detect)
  8735. *
  8736. * [实时摄像头人脸检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/face-detect) */
  8737. interface VKFaceAnchor {
  8738. /** 人脸角度信息 */
  8739. angle: number[]
  8740. /** 关键点的置信度 */
  8741. confidence: number[]
  8742. /** 识别序号 */
  8743. detectId: number
  8744. /** 唯一标识 */
  8745. id: number
  8746. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8747. origin: VKOrigin
  8748. /** 人脸 106 个关键点的坐标 */
  8749. points: VKPoint[]
  8750. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8751. size: VKSize
  8752. /** 类型
  8753. *
  8754. * 可选值:
  8755. * - 3: 人脸; */
  8756. type: 3
  8757. }
  8758. /** 需要基础库: `2.20.0`
  8759. *
  8760. * vision kit 会话对象。 */
  8761. interface VKFrame {
  8762. /** [VKCamera](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.html)
  8763. *
  8764. * 相机对象 */
  8765. camera: VKCamera
  8766. /** 生成时间,单位:纳秒(ns) */
  8767. timestamp: number
  8768. }
  8769. /** 需要基础库: `2.28.0`
  8770. *
  8771. * 手势 anchor
  8772. *
  8773. * **示例代码**
  8774. *
  8775. * [静态图像hand检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-hand-detect)
  8776. *
  8777. * [实时摄像头hand检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/hand-detect) */
  8778. interface VKHandAnchor {
  8779. /** 关键点的置信度 */
  8780. confidence: number[]
  8781. /** 识别序号 */
  8782. detectId: number
  8783. /** 手势分类, 返回整数-1到18, -1表示无效手势
  8784. *
  8785. * 可选值:
  8786. * - 0: 单手比心;
  8787. * - 1: 布(数字5);
  8788. * - 2: 剪刀(数字2);
  8789. * - 3: 握拳;
  8790. * - 4: 数字1;
  8791. * - 5: 热爱;
  8792. * - 6: 点赞;
  8793. * - 7: 数字3;
  8794. * - 8: 摇滚;
  8795. * - 9: 数字6;
  8796. * - 10: 数字8;
  8797. * - 11: 双手抱拳(恭喜发财);
  8798. * - 12: 数字4;
  8799. * - 13: 比ok;
  8800. * - 14: 不喜欢(踩);
  8801. * - 15: 双手比心;
  8802. * - 16: 祈祷(双手合十);
  8803. * - 17: 双手抱拳;
  8804. * - 18: 无手势动作;
  8805. * - -1: 无效手势; */
  8806. gesture:
  8807. | 0
  8808. | 1
  8809. | 2
  8810. | 3
  8811. | 4
  8812. | 5
  8813. | 6
  8814. | 7
  8815. | 8
  8816. | 9
  8817. | 10
  8818. | 11
  8819. | 12
  8820. | 13
  8821. | 14
  8822. | 15
  8823. | 16
  8824. | 17
  8825. | 18
  8826. | -1
  8827. /** 唯一标识 */
  8828. id: number
  8829. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8830. origin: VKOrigin
  8831. /** 关键点 */
  8832. points: VKOrigin[]
  8833. /** 总体置信值 */
  8834. score: number
  8835. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8836. size: VKSize
  8837. /** 类型
  8838. *
  8839. * 可选值:
  8840. * - 7: 手势; */
  8841. type: 7
  8842. }
  8843. interface VKMarker {
  8844. /** marker id */
  8845. markerId: number
  8846. /** 图片路径 */
  8847. path: string
  8848. }
  8849. /** 需要基础库: `2.24.5`
  8850. *
  8851. * marker anchor
  8852. *
  8853. * **示例代码**
  8854. *
  8855. * [2D Marker能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/2dmarker-ar) */
  8856. interface VKMarkerAnchor {
  8857. /** 唯一标识 */
  8858. id: number
  8859. /** marker id */
  8860. markerId: number
  8861. /** 图片路径 */
  8862. path: string
  8863. /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
  8864. transform: Float32Array
  8865. /** 类型
  8866. *
  8867. * 可选值:
  8868. * - 1: marker; */
  8869. type: 1
  8870. }
  8871. /** 需要基础库: `2.27.0`
  8872. *
  8873. * OCR anchor
  8874. *
  8875. * **示例代码**
  8876. *
  8877. * [静态图像OCR检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-ocr-detect)
  8878. *
  8879. * [实时摄像头OCR检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/ocr-detect) */
  8880. interface VKOCRAnchor {
  8881. /** 唯一标识 */
  8882. id: number
  8883. /** 识别的文字结果 */
  8884. text: string
  8885. /** 类型
  8886. *
  8887. * 可选值:
  8888. * - 6: OCR; */
  8889. type: 6
  8890. }
  8891. /** 需要基础库: `2.24.5`
  8892. *
  8893. * OSD anchor
  8894. *
  8895. * **示例代码**
  8896. *
  8897. * [单样本检测(OSD)能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/osd-ar) */
  8898. interface VKOSDAnchor {
  8899. /** 唯一标识 */
  8900. id: number
  8901. /** marker id */
  8902. markerId: number
  8903. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8904. origin: VKOrigin
  8905. /** 图片路径 */
  8906. path: string
  8907. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  8908. size: VKSize
  8909. /** 类型
  8910. *
  8911. * 可选值:
  8912. * - 2: OSD; */
  8913. type: 2
  8914. }
  8915. interface VKOrigin {
  8916. /** 横坐标 */
  8917. x: number
  8918. /** 纵坐标 */
  8919. y: number
  8920. }
  8921. /** 需要基础库: `2.22.0`
  8922. *
  8923. * 平面 anchor,只有 v2 版本支持
  8924. *
  8925. * **示例代码**
  8926. *
  8927. * v1 版本:[水平面AR能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/plane-ar)
  8928. * v2 版本:[水平面AR能力v2使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/plane-ar-v2) */
  8929. interface VKPlaneAnchor {
  8930. /** 方向 */
  8931. alignment: number
  8932. /** 唯一标识 */
  8933. id: number
  8934. /** 尺寸 */
  8935. size: VKSize
  8936. /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
  8937. transform: Float32Array
  8938. /** 类型
  8939. *
  8940. * 可选值:
  8941. * - 0: 平面; */
  8942. type: 0
  8943. }
  8944. /** 人脸 106 个关键点的坐标 */
  8945. interface VKPoint {
  8946. /** 横坐标 */
  8947. x: number
  8948. /** 纵坐标 */
  8949. y: number
  8950. }
  8951. /** 需要基础库: `2.20.0`
  8952. *
  8953. * vision kit 会话对象。 */
  8954. interface VKSession {
  8955. /** 相机尺寸 */
  8956. cameraSize: VKSize
  8957. /** 会话配置 */
  8958. config: VKConfig
  8959. /** 会话状态
  8960. *
  8961. * 可选值:
  8962. * - 0: 不可用;
  8963. * - 1: 运行中;
  8964. * - 2: 暂停中;
  8965. * - 3: 初始化中; */
  8966. state: 0 | 1 | 2 | 3
  8967. }
  8968. interface VKSize {
  8969. /** 高度 */
  8970. height: number
  8971. /** 宽度 */
  8972. width: number
  8973. }
  8974. interface VibrateLongOption {
  8975. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8976. complete?: VibrateLongCompleteCallback
  8977. /** 接口调用失败的回调函数 */
  8978. fail?: VibrateLongFailCallback
  8979. /** 接口调用成功的回调函数 */
  8980. success?: VibrateLongSuccessCallback
  8981. }
  8982. interface VibrateShortFailCallbackResult {
  8983. /** 错误信息
  8984. *
  8985. * 可选值:
  8986. * - 'style is not support': 当前设备不支持设置震动等级; */
  8987. errMsg: string
  8988. }
  8989. interface VibrateShortOption {
  8990. /** 需要基础库: `2.13.0`
  8991. *
  8992. * 震动强度类型,有效值为:heavy、medium、light */
  8993. type: string
  8994. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8995. complete?: VibrateShortCompleteCallback
  8996. /** 接口调用失败的回调函数 */
  8997. fail?: VibrateShortFailCallback
  8998. /** 接口调用成功的回调函数 */
  8999. success?: VibrateShortSuccessCallback
  9000. }
  9001. interface VideoContextRequestFullScreenOption {
  9002. /** 需要基础库: `1.7.0`
  9003. *
  9004. * 设置全屏时视频的方向,不指定则根据宽高比自动判断。
  9005. *
  9006. * 可选值:
  9007. * - 0: 正常竖向;
  9008. * - 90: 屏幕逆时针90度;
  9009. * - -90: 屏幕顺时针90度; */
  9010. direction?: 0 | 90 | -90
  9011. }
  9012. interface VideoDecoderStartOption {
  9013. /** 需要解码的视频源文件。基础库 2.13.0 以下的版本只支持本地路径。 2.13.0 开始支持 http:// 和 https:// 协议的远程路径。 */
  9014. source: string
  9015. /** 需要基础库: `2.15.0`
  9016. *
  9017. * 是否不需要音频轨道 */
  9018. abortAudio?: boolean
  9019. /** 需要基础库: `2.15.0`
  9020. *
  9021. * 是否不需要视频轨道 */
  9022. abortVideo?: boolean
  9023. /** 解码模式。0:按 pts 解码;1:以最快速度解码 */
  9024. mode?: number
  9025. }
  9026. interface VoIP1v1ChatUser {
  9027. /** 昵称 */
  9028. nickname: string
  9029. /** 小程序内 openid */
  9030. openid: string
  9031. /** 头像 */
  9032. headImage?: string
  9033. }
  9034. /** 需要基础库: `2.19.0`
  9035. *
  9036. * WebAudioContext 实例,通过[wx.createWebAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html) 接口获取该实例。
  9037. *
  9038. * **示例代码**
  9039. *
  9040. * ```js
  9041. // 监听状态
  9042. const audioCtx = wx.createWebAudioContext()
  9043. audioCtx.onstatechange = () => {
  9044. console.log(ctx.state)
  9045. }
  9046. setTimeout(audioCtx.suspend, 1000)
  9047. setTimeout(audioCtx.resume, 2000)
  9048. ``` */
  9049. interface WebAudioContext {
  9050. /** 获取当前上下文的时间戳。 */
  9051. currentTime: number
  9052. /** [WebAudioContextNode](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContextNode.html)
  9053. *
  9054. * 当前上下文的最终目标节点,一般是音频渲染设备。 */
  9055. destination: WebAudioContextNode
  9056. /** 空间音频监听器。 */
  9057. listener: AudioListener
  9058. /** 可写属性,开发者可以对该属性设置一个监听函数,当WebAudio状态改变的时候,会触发开发者设置的监听函数。 */
  9059. onstatechange: (...args: any[]) => any
  9060. /** 采样率,通常在8000-96000之间,通常44100hz的采样率最为常见。 */
  9061. sampleRate: number
  9062. /** 当前WebAudio上下文的状态。可能的值如下:suspended(暂停)、running(正在运行)、closed(已关闭)。需要注意的是,不要在 audioContext close后再访问state属性 */
  9063. state: string
  9064. }
  9065. /** 需要基础库: `2.19.0`
  9066. *
  9067. * 一类音频处理模块,不同的Node具备不同的功能,如GainNode(音量调整)等。一个WebAudioContextNode可以通过上下文来创建。
  9068. * 目前已经支持以下Node:
  9069. * IIRFilterNode
  9070. * WaveShaperNode
  9071. * ConstantSourceNode
  9072. * ChannelMergerNode
  9073. * OscillatorNode
  9074. * GainNode
  9075. * BiquadFilterNode
  9076. * PeriodicWaveNode
  9077. * BufferSourceNode
  9078. * ChannelSplitterNode
  9079. * ChannelMergerNode
  9080. * DelayNode
  9081. * DynamicsCompressorNode
  9082. * ScriptProcessorNode
  9083. * PannerNode
  9084. * AnalyserNode */
  9085. interface WebAudioContextNode {
  9086. /** 表示监听器的前向系统在同一笛卡尔坐标系中的水平位置,作为位置(位置x,位置和位置和位置)值。 */
  9087. forwardX: number
  9088. /** 表示听众的前向方向在同一笛卡尔坐标系中作为位置(位置x,位置和位置和位置)值的垂直位置。 */
  9089. forwardY: number
  9090. /** 表示与position (positionX、positionY和positionZ)值在同一笛卡尔坐标系下的听者前进方向的纵向(前后)位置。 */
  9091. forwardZ: number
  9092. /** 右手笛卡尔坐标系中X轴的位置。 */
  9093. positionX: number
  9094. /** 右手笛卡尔坐标系中Y轴的位置。 */
  9095. positionY: number
  9096. /** 右手笛卡尔坐标系中Z轴的位置。 */
  9097. positionZ: number
  9098. /** 设置监听器的方向 */
  9099. setOrientation: (...args: any[]) => any
  9100. /** 设置监听器的位置
  9101. *
  9102. * /** */
  9103. setPosition: (...args: any[]) => any
  9104. /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向前方向的水平位置。 */
  9105. upX: number
  9106. /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向上方向的水平位置。 */
  9107. upY: number
  9108. /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向后方向的水平位置。 */
  9109. upZ: number
  9110. }
  9111. /** 提供预设的 Wi-Fi 信息列表 */
  9112. interface WifiData {
  9113. /** Wi-Fi 的 BSSID */
  9114. BSSID?: string
  9115. /** Wi-Fi 的 SSID */
  9116. SSID?: string
  9117. /** Wi-Fi 设备密码 */
  9118. password?: string
  9119. }
  9120. /** Wifi 信息
  9121. *
  9122. * **注意**
  9123. *
  9124. * - 安卓 wx.connectWifi / wx.getConnectedWifi 若设置了 partialInfo:true ,或者调用了 wx.onWifiConnectedWithPartialInfo 事件。将会返回只包含 SSID 属性的 WifiInfo 对象。
  9125. * - iOS wx.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
  9126. * - 在某些情况下,可能 Wi-Fi 已经连接成功,但会因为获取不到完整的 WifiInfo 对象报错。具体错误信息为 errCode: 12010, errMsg: can't gain current wifi 或 no wifi is connected 。如果开发者不需要完整的 WifiInfo 对象,则可以通过采取上述策略解决报错问题。 */
  9127. interface WifiInfo {
  9128. /** Wi-Fi 的 BSSID */
  9129. BSSID: string
  9130. /** Wi-Fi 的 SSID */
  9131. SSID: string
  9132. /** 需要基础库: `2.12.0`
  9133. *
  9134. * Wi-Fi 频段单位 MHz */
  9135. frequency: number
  9136. /** Wi-Fi 是否安全 */
  9137. secure: boolean
  9138. /** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
  9139. signalStrength: number
  9140. }
  9141. interface WindowInfo {
  9142. /** 设备像素比 */
  9143. pixelRatio: number
  9144. /** 在竖屏正方向下的安全区域 */
  9145. safeArea: SafeArea
  9146. /** 屏幕高度,单位px */
  9147. screenHeight: number
  9148. /** 窗口上边缘的y值 */
  9149. screenTop: number
  9150. /** 屏幕宽度,单位px */
  9151. screenWidth: number
  9152. /** 状态栏的高度,单位px */
  9153. statusBarHeight: number
  9154. /** 可使用窗口高度,单位px */
  9155. windowHeight: number
  9156. /** 可使用窗口宽度,单位px */
  9157. windowWidth: number
  9158. }
  9159. /** Worker 实例,主线程中可通过 [wx.createWorker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html) 接口获取,worker 线程中可通过全局变量 `worker` 获取。
  9160. *
  9161. * **示例代码**
  9162. *
  9163. * 运行以下代码需先进行基础配置,详细请查阅 [小程序多线程](https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html) | [小游戏多线程](https://developers.weixin.qq.com/minigame/dev/guide/base-ability/worker.html) 文档了解基础知识和配置方法。
  9164. *
  9165. * ```js
  9166. const worker = wx.createWorker('workers/request/index.js') // 文件名指定 worker 的入口文件路径,绝对路径
  9167. worker.onMessage(function (res) {
  9168. console.log(res)
  9169. })
  9170. // 监听worker被系统回收事件
  9171. worker.onProcessKilled(function () {
  9172. console.log('worker has been killed')
  9173. // 重新创建一个worker
  9174. // wx.createWorker()
  9175. })
  9176. worker.postMessage({
  9177. msg: 'hello worker'
  9178. })
  9179. worker.terminate()
  9180. ``` */
  9181. interface Worker {
  9182. /** worker内的环境变量 */
  9183. env: WorkerEnv
  9184. }
  9185. /** worker内的环境变量 */
  9186. interface WorkerEnv {
  9187. /** 文件系统中的用户目录路径 (本地路径) */
  9188. USER_DATA_PATH: string
  9189. }
  9190. interface WorkerOnMessageListenerResult {
  9191. /** 主线程/Worker 线程向当前线程发送的消息 */
  9192. message: IAnyObject
  9193. }
  9194. interface WriteBLECharacteristicValueOption {
  9195. /** 蓝牙特征的 UUID */
  9196. characteristicId: string
  9197. /** 蓝牙设备 id */
  9198. deviceId: string
  9199. /** 蓝牙特征对应服务的 UUID */
  9200. serviceId: string
  9201. /** 蓝牙设备特征对应的二进制值 */
  9202. value: ArrayBuffer
  9203. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9204. complete?: WriteBLECharacteristicValueCompleteCallback
  9205. /** 接口调用失败的回调函数 */
  9206. fail?: WriteBLECharacteristicValueFailCallback
  9207. /** 接口调用成功的回调函数 */
  9208. success?: WriteBLECharacteristicValueSuccessCallback
  9209. /** 蓝牙特征值的写模式设置,有两种模式,iOS 优先 write,安卓优先 writeNoResponse 。(基础库 2.22.0 开始支持)
  9210. *
  9211. * 可选值:
  9212. * - 'write': 强制回复写,不支持时报错;
  9213. * - 'writeNoResponse': 强制无回复写,不支持时报错; */
  9214. writeType?: 'write' | 'writeNoResponse'
  9215. }
  9216. interface WriteCharacteristicValueObject {
  9217. /** 蓝牙特征的 UUID */
  9218. characteristicId: string
  9219. /** 是否需要通知主机 value 已更新 */
  9220. needNotify: boolean
  9221. /** 蓝牙特征对应服务的 UUID */
  9222. serviceId: string
  9223. /** characteristic 对应的二进制值 */
  9224. value: ArrayBuffer
  9225. /** 可选,处理回包时使用 */
  9226. callbackId?: number
  9227. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9228. complete?: WriteCharacteristicValueCompleteCallback
  9229. /** 接口调用失败的回调函数 */
  9230. fail?: WriteCharacteristicValueFailCallback
  9231. /** 接口调用成功的回调函数 */
  9232. success?: WriteCharacteristicValueSuccessCallback
  9233. }
  9234. interface WriteFailCallbackResult {
  9235. /** 错误信息
  9236. *
  9237. * 可选值:
  9238. * - 'bad file descriptor': 无效的文件描述符;
  9239. * - 'fail permission denied': 指定的 fd 路径没有写权限;
  9240. * - 'fail sdcard not mounted': android sdcard 挂载失败; */
  9241. errMsg: string
  9242. }
  9243. interface WriteFileFailCallbackResult {
  9244. /** 错误信息
  9245. *
  9246. * 可选值:
  9247. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
  9248. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
  9249. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  9250. * - 'fail sdcard not mounted': Android sdcard 挂载失败;
  9251. * - 'fail base64 encode error': base64 格式错误; */
  9252. errMsg: string
  9253. }
  9254. interface WriteFileOption {
  9255. /** 要写入的文本或二进制数据 */
  9256. data: string | ArrayBuffer
  9257. /** 要写入的文件路径 (本地路径) */
  9258. filePath: string
  9259. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9260. complete?: WriteFileCompleteCallback
  9261. /** 指定写入文件的字符编码
  9262. *
  9263. * 可选值:
  9264. * - 'ascii': ;
  9265. * - 'base64': (注意,选择 base64 编码,data 只需要传 base64 内容本身,不要传 Data URI 前缀,否则会报 fail base64 encode error 错误。例如,传 aGVsbG8= 而不是传 data:image/png;base64,aGVsbG8= );
  9266. * - 'binary': ;
  9267. * - 'hex': ;
  9268. * - 'ucs2': 以小端序读取;
  9269. * - 'ucs-2': 以小端序读取;
  9270. * - 'utf16le': 以小端序读取;
  9271. * - 'utf-16le': 以小端序读取;
  9272. * - 'utf-8': ;
  9273. * - 'utf8': ;
  9274. * - 'latin1': ; */
  9275. encoding?:
  9276. | 'ascii'
  9277. | 'base64'
  9278. | 'binary'
  9279. | 'hex'
  9280. | 'ucs2'
  9281. | 'ucs-2'
  9282. | 'utf16le'
  9283. | 'utf-16le'
  9284. | 'utf-8'
  9285. | 'utf8'
  9286. | 'latin1'
  9287. /** 接口调用失败的回调函数 */
  9288. fail?: WriteFileFailCallback
  9289. /** 接口调用成功的回调函数 */
  9290. success?: WriteFileSuccessCallback
  9291. }
  9292. interface WriteNdefMessageOption {
  9293. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9294. complete?: WriteNdefMessageCompleteCallback
  9295. /** 接口调用失败的回调函数 */
  9296. fail?: WriteNdefMessageFailCallback
  9297. /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */
  9298. records?: any[]
  9299. /** 接口调用成功的回调函数 */
  9300. success?: WriteNdefMessageSuccessCallback
  9301. /** text 数组 */
  9302. texts?: any[]
  9303. /** uri 数组 */
  9304. uris?: any[]
  9305. }
  9306. interface WriteOption {
  9307. /** 写入的内容,类型为 String 或 ArrayBuffer */
  9308. data: string | ArrayBuffer
  9309. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  9310. fd: string
  9311. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9312. complete?: WriteCompleteCallback
  9313. /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8
  9314. *
  9315. * 可选值:
  9316. * - 'ascii': ;
  9317. * - 'base64': ;
  9318. * - 'binary': ;
  9319. * - 'hex': ;
  9320. * - 'ucs2': 以小端序读取;
  9321. * - 'ucs-2': 以小端序读取;
  9322. * - 'utf16le': 以小端序读取;
  9323. * - 'utf-16le': 以小端序读取;
  9324. * - 'utf-8': ;
  9325. * - 'utf8': ;
  9326. * - 'latin1': ; */
  9327. encoding?:
  9328. | 'ascii'
  9329. | 'base64'
  9330. | 'binary'
  9331. | 'hex'
  9332. | 'ucs2'
  9333. | 'ucs-2'
  9334. | 'utf16le'
  9335. | 'utf-16le'
  9336. | 'utf-8'
  9337. | 'utf8'
  9338. | 'latin1'
  9339. /** 接口调用失败的回调函数 */
  9340. fail?: WriteFailCallback
  9341. /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 arrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */
  9342. length?: number
  9343. /** 只在 data 类型是 ArrayBuffer 时有效,决定 arrayBuffe 中要被写入的部位,即 arrayBuffer 中的索引,默认0 */
  9344. offset?: number
  9345. /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */
  9346. position?: number
  9347. /** 接口调用成功的回调函数 */
  9348. success?: WriteSuccessCallback
  9349. }
  9350. /** 文件写入结果。 通过 [FileSystemManager.writeSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html) 接口返回 */
  9351. interface WriteResult {
  9352. /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */
  9353. bytesWritten: number
  9354. }
  9355. interface WriteSuccessCallbackResult {
  9356. /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */
  9357. bytesWritten: number
  9358. errMsg: string
  9359. }
  9360. interface WriteSyncOption {
  9361. /** 写入的内容,类型为 String 或 ArrayBuffer */
  9362. data: string | ArrayBuffer
  9363. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  9364. fd: string
  9365. /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8
  9366. *
  9367. * 可选值:
  9368. * - 'ascii': ;
  9369. * - 'base64': ;
  9370. * - 'binary': ;
  9371. * - 'hex': ;
  9372. * - 'ucs2': 以小端序读取;
  9373. * - 'ucs-2': 以小端序读取;
  9374. * - 'utf16le': 以小端序读取;
  9375. * - 'utf-16le': 以小端序读取;
  9376. * - 'utf-8': ;
  9377. * - 'utf8': ;
  9378. * - 'latin1': ; */
  9379. encoding?:
  9380. | 'ascii'
  9381. | 'base64'
  9382. | 'binary'
  9383. | 'hex'
  9384. | 'ucs2'
  9385. | 'ucs-2'
  9386. | 'utf16le'
  9387. | 'utf-16le'
  9388. | 'utf-8'
  9389. | 'utf8'
  9390. | 'latin1'
  9391. /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 arrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */
  9392. length?: number
  9393. /** 只在 data 类型是 ArrayBuffer 时有效,决定 arrayBuffe 中要被写入的部位,即 arrayBuffer 中的索引,默认0 */
  9394. offset?: number
  9395. /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */
  9396. position?: number
  9397. }
  9398. interface WxStartRecordOption {
  9399. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9400. complete?: StartRecordCompleteCallback
  9401. /** 接口调用失败的回调函数 */
  9402. fail?: StartRecordFailCallback
  9403. /** 接口调用成功的回调函数 */
  9404. success?: WxStartRecordSuccessCallback
  9405. }
  9406. interface WxStopRecordOption {
  9407. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9408. complete?: StopRecordCompleteCallback
  9409. /** 接口调用失败的回调函数 */
  9410. fail?: StopRecordFailCallback
  9411. /** 接口调用成功的回调函数 */
  9412. success?: WxStopRecordSuccessCallback
  9413. }
  9414. /** 运动数据列表 */
  9415. interface WxaSportRecord {
  9416. /** 消耗卡路里 */
  9417. calorie: number
  9418. /** 运动距离 */
  9419. distance: number
  9420. /** 运动时长 */
  9421. time: number
  9422. /** 运动项目id */
  9423. typeId: number
  9424. }
  9425. /** 帧纹理对象 */
  9426. interface YUVTextureRes {
  9427. /** UV 分量纹理 */
  9428. uvTexture: WebGLTexture
  9429. /** Y 分量纹理 */
  9430. yTexture: WebGLTexture
  9431. }
  9432. /** 文件路径 */
  9433. interface ZipFileItem {
  9434. /** 文件内容 */
  9435. data: string | ArrayBuffer
  9436. /** 错误信息 */
  9437. errMsg: string
  9438. }
  9439. interface Animation {
  9440. /** [Object Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html)
  9441. *
  9442. * 在插件中使用:支持
  9443. *
  9444. * 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */
  9445. export(): AnimationExportResult
  9446. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.backgroundColor(string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html)
  9447. *
  9448. * 在插件中使用:支持
  9449. *
  9450. * 设置背景色 */
  9451. backgroundColor(
  9452. /** 颜色值 */
  9453. value: string
  9454. ): Animation
  9455. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.bottom(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html)
  9456. *
  9457. * 在插件中使用:支持
  9458. *
  9459. * 设置 bottom 值 */
  9460. bottom(
  9461. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  9462. value: number | string
  9463. ): Animation
  9464. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.height(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html)
  9465. *
  9466. * 在插件中使用:支持
  9467. *
  9468. * 设置高度 */
  9469. height(
  9470. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  9471. value: number | string
  9472. ): Animation
  9473. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.left(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.left.html)
  9474. *
  9475. * 在插件中使用:支持
  9476. *
  9477. * 设置 left 值 */
  9478. left(
  9479. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  9480. value: number | string
  9481. ): Animation
  9482. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix.html)
  9483. *
  9484. * 在插件中使用:支持
  9485. *
  9486. * 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix) */
  9487. matrix(): Animation
  9488. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix3d()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix3d.html)
  9489. *
  9490. * 在插件中使用:支持
  9491. *
  9492. * 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d) */
  9493. matrix3d(): Animation
  9494. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.opacity(number value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.opacity.html)
  9495. *
  9496. * 在插件中使用:支持
  9497. *
  9498. * 设置透明度 */
  9499. opacity(
  9500. /** 透明度,范围 0-1 */
  9501. value: number
  9502. ): Animation
  9503. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.right(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html)
  9504. *
  9505. * 在插件中使用:支持
  9506. *
  9507. * 设置 right 值 */
  9508. right(
  9509. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  9510. value: number | string
  9511. ): Animation
  9512. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate.html)
  9513. *
  9514. * 在插件中使用:支持
  9515. *
  9516. * 从原点顺时针旋转一个角度 */
  9517. rotate(
  9518. /** 旋转的角度。范围 [-180, 180] */
  9519. angle: number
  9520. ): Animation
  9521. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate3d(number x, number y, number z, number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate3d.html)
  9522. *
  9523. * 在插件中使用:支持
  9524. *
  9525. * 从 固定 轴顺时针旋转一个角度 */
  9526. rotate3d(
  9527. /** 旋转轴的 x 坐标 */
  9528. x: number,
  9529. /** 旋转轴的 y 坐标 */
  9530. y: number,
  9531. /** 旋转轴的 z 坐标 */
  9532. z: number,
  9533. /** 旋转的角度。范围 [-180, 180] */
  9534. angle: number
  9535. ): Animation
  9536. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateX.html)
  9537. *
  9538. * 在插件中使用:支持
  9539. *
  9540. * 从 X 轴顺时针旋转一个角度 */
  9541. rotateX(
  9542. /** 旋转的角度。范围 [-180, 180] */
  9543. angle: number
  9544. ): Animation
  9545. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateY.html)
  9546. *
  9547. * 在插件中使用:支持
  9548. *
  9549. * 从 Y 轴顺时针旋转一个角度 */
  9550. rotateY(
  9551. /** 旋转的角度。范围 [-180, 180] */
  9552. angle: number
  9553. ): Animation
  9554. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateZ(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateZ.html)
  9555. *
  9556. * 在插件中使用:支持
  9557. *
  9558. * 从 Z 轴顺时针旋转一个角度 */
  9559. rotateZ(
  9560. /** 旋转的角度。范围 [-180, 180] */
  9561. angle: number
  9562. ): Animation
  9563. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale(number sx, number sy)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale.html)
  9564. *
  9565. * 在插件中使用:支持
  9566. *
  9567. * 缩放 */
  9568. scale(
  9569. /** 当仅有 sx 参数时,表示在 X 轴、Y 轴同时缩放sx倍数 */
  9570. sx: number,
  9571. /** 在 Y 轴缩放 sy 倍数 */
  9572. sy?: number
  9573. ): Animation
  9574. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale3d(number sx, number sy, number sz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale3d.html)
  9575. *
  9576. * 在插件中使用:支持
  9577. *
  9578. * 缩放 */
  9579. scale3d(
  9580. /** x 轴的缩放倍数 */
  9581. sx: number,
  9582. /** y 轴的缩放倍数 */
  9583. sy: number,
  9584. /** z 轴的缩放倍数 */
  9585. sz: number
  9586. ): Animation
  9587. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleX(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleX.html)
  9588. *
  9589. * 在插件中使用:支持
  9590. *
  9591. * 缩放 X 轴 */
  9592. scaleX(
  9593. /** X 轴的缩放倍数 */
  9594. scale: number
  9595. ): Animation
  9596. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleY(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleY.html)
  9597. *
  9598. * 在插件中使用:支持
  9599. *
  9600. * 缩放 Y 轴 */
  9601. scaleY(
  9602. /** Y 轴的缩放倍数 */
  9603. scale: number
  9604. ): Animation
  9605. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleZ(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleZ.html)
  9606. *
  9607. * 在插件中使用:支持
  9608. *
  9609. * 缩放 Z 轴 */
  9610. scaleZ(
  9611. /** Z 轴的缩放倍数 */
  9612. scale: number
  9613. ): Animation
  9614. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skew(number ax, number ay)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skew.html)
  9615. *
  9616. * 在插件中使用:支持
  9617. *
  9618. * 对 X、Y 轴坐标进行倾斜 */
  9619. skew(
  9620. /** 对 X 轴坐标倾斜的角度,范围 [-180, 180] */
  9621. ax: number,
  9622. /** 对 Y 轴坐标倾斜的角度,范围 [-180, 180] */
  9623. ay: number
  9624. ): Animation
  9625. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewX.html)
  9626. *
  9627. * 在插件中使用:支持
  9628. *
  9629. * 对 X 轴坐标进行倾斜 */
  9630. skewX(
  9631. /** 倾斜的角度,范围 [-180, 180] */
  9632. angle: number
  9633. ): Animation
  9634. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewY.html)
  9635. *
  9636. * 在插件中使用:支持
  9637. *
  9638. * 对 Y 轴坐标进行倾斜 */
  9639. skewY(
  9640. /** 倾斜的角度,范围 [-180, 180] */
  9641. angle: number
  9642. ): Animation
  9643. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.step(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html)
  9644. *
  9645. * 在插件中使用:支持
  9646. *
  9647. * 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。 */
  9648. step(option?: StepOption): Animation
  9649. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.top(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.top.html)
  9650. *
  9651. * 在插件中使用:支持
  9652. *
  9653. * 设置 top 值 */
  9654. top(
  9655. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  9656. value: number | string
  9657. ): Animation
  9658. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate(number tx, number ty)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate.html)
  9659. *
  9660. * 在插件中使用:支持
  9661. *
  9662. * 平移变换 */
  9663. translate(
  9664. /** 当仅有该参数时表示在 X 轴偏移 tx,单位 px */
  9665. tx?: number,
  9666. /** 在 Y 轴平移的距离,单位为 px */
  9667. ty?: number
  9668. ): Animation
  9669. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate3d(number tx, number ty, number tz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate3d.html)
  9670. *
  9671. * 在插件中使用:支持
  9672. *
  9673. * 对 xyz 坐标进行平移变换 */
  9674. translate3d(
  9675. /** 在 X 轴平移的距离,单位为 px */
  9676. tx?: number,
  9677. /** 在 Y 轴平移的距离,单位为 px */
  9678. ty?: number,
  9679. /** 在 Z 轴平移的距离,单位为 px */
  9680. tz?: number
  9681. ): Animation
  9682. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateX(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateX.html)
  9683. *
  9684. * 在插件中使用:支持
  9685. *
  9686. * 对 X 轴平移 */
  9687. translateX(
  9688. /** 在 X 轴平移的距离,单位为 px */
  9689. translation: number
  9690. ): Animation
  9691. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateY(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateY.html)
  9692. *
  9693. * 在插件中使用:支持
  9694. *
  9695. * 对 Y 轴平移 */
  9696. translateY(
  9697. /** 在 Y 轴平移的距离,单位为 px */
  9698. translation: number
  9699. ): Animation
  9700. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateZ(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateZ.html)
  9701. *
  9702. * 在插件中使用:支持
  9703. *
  9704. * 对 Z 轴平移 */
  9705. translateZ(
  9706. /** 在 Z 轴平移的距离,单位为 px */
  9707. translation: number
  9708. ): Animation
  9709. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.width(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.width.html)
  9710. *
  9711. * 在插件中使用:支持
  9712. *
  9713. * 设置宽度 */
  9714. width(
  9715. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  9716. value: number | string
  9717. ): Animation
  9718. }
  9719. interface AudioBuffer {
  9720. /** [AudioBuffer.copyFromChannel()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyFromChannel.html)
  9721. *
  9722. * 在插件中使用:不支持
  9723. *
  9724. * 从AudioBuffer的指定频道复制到数组终端。 */
  9725. copyFromChannel(): void
  9726. /** [AudioBuffer.copyToChannel(Float32Array source, number channelNumber, number startInChannel)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyToChannel.html)
  9727. *
  9728. * 在插件中使用:不支持
  9729. *
  9730. * 从指定数组复制样本到audioBuffer的特定通道
  9731. *
  9732. * **示例代码**
  9733. *
  9734. * 示例代码参考AudioBuffer.copyFromChannel */
  9735. copyToChannel(
  9736. /** 需要复制的源数组 */
  9737. source: Float32Array,
  9738. /** 需要复制到的目的通道号 */
  9739. channelNumber: number,
  9740. /** 复制偏移数据量 */
  9741. startInChannel: number
  9742. ): void
  9743. /** [Float32Array AudioBuffer.getChannelData(number channel)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.getChannelData.html)
  9744. *
  9745. * 在插件中使用:不支持
  9746. *
  9747. * 返回一个 Float32Array,包含了带有频道的PCM数据,由频道参数定义(有0代表第一个频道) */
  9748. getChannelData(
  9749. /** 要获取特定通道数据的索引 */
  9750. channel: number
  9751. ): Float32Array
  9752. }
  9753. interface AudioContext {
  9754. /** [AudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html)
  9755. *
  9756. * 在插件中使用:支持
  9757. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  9758. *
  9759. * 暂停音频。 */
  9760. pause(): void
  9761. /** [AudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html)
  9762. *
  9763. * 在插件中使用:支持
  9764. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  9765. *
  9766. * 播放音频。 */
  9767. play(): void
  9768. /** [AudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.seek.html)
  9769. *
  9770. * 在插件中使用:支持
  9771. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  9772. *
  9773. * 跳转到指定位置。 */
  9774. seek(
  9775. /** 跳转位置,单位 s */
  9776. position: number
  9777. ): void
  9778. /** [AudioContext.setSrc(string src)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.setSrc.html)
  9779. *
  9780. * 在插件中使用:支持
  9781. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  9782. *
  9783. * 设置音频地址 */
  9784. setSrc(
  9785. /** 音频地址 */
  9786. src: string
  9787. ): void
  9788. }
  9789. interface BLEPeripheralServer {
  9790. /** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html)
  9791. *
  9792. * 需要基础库: `2.10.3`
  9793. *
  9794. * 在插件中使用:不支持
  9795. *
  9796. * 添加服务。 */
  9797. addService(option: AddServiceOption): void
  9798. /** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html)
  9799. *
  9800. * 需要基础库: `2.10.3`
  9801. *
  9802. * 在插件中使用:不支持
  9803. *
  9804. * 关闭当前服务端。 */
  9805. close(option?: BLEPeripheralServerCloseOption): void
  9806. /** [BLEPeripheralServer.offCharacteristicReadRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html)
  9807. *
  9808. * 需要基础库: `2.10.3`
  9809. *
  9810. * 在插件中使用:不支持
  9811. *
  9812. * 移除已连接的设备请求读当前外围设备的特征值事件的监听函数
  9813. *
  9814. * **示例代码**
  9815. *
  9816. * ```js
  9817. const listener = function (res) { console.log(res) }
  9818. BLEPeripheralServer.onCharacteristicReadRequest(listener)
  9819. BLEPeripheralServer.offCharacteristicReadRequest(listener) // 需传入与监听时同一个的函数对象
  9820. ``` */
  9821. offCharacteristicReadRequest(
  9822. /** onCharacteristicReadRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  9823. listener?: OffCharacteristicReadRequestCallback
  9824. ): void
  9825. /** [BLEPeripheralServer.offCharacteristicSubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html)
  9826. *
  9827. * 需要基础库: `2.13.0`
  9828. *
  9829. * 在插件中使用:不支持
  9830. *
  9831. * 移除特征订阅事件的监听函数
  9832. *
  9833. * **示例代码**
  9834. *
  9835. * ```js
  9836. const listener = function (res) { console.log(res) }
  9837. BLEPeripheralServer.onCharacteristicSubscribed(listener)
  9838. BLEPeripheralServer.offCharacteristicSubscribed(listener) // 需传入与监听时同一个的函数对象
  9839. ``` */
  9840. offCharacteristicSubscribed(
  9841. /** onCharacteristicSubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  9842. listener?: OffCharacteristicSubscribedCallback
  9843. ): void
  9844. /** [BLEPeripheralServer.offCharacteristicUnsubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html)
  9845. *
  9846. * 需要基础库: `2.13.0`
  9847. *
  9848. * 在插件中使用:不支持
  9849. *
  9850. * 移除取消特征订阅事件的监听函数
  9851. *
  9852. * **示例代码**
  9853. *
  9854. * ```js
  9855. const listener = function (res) { console.log(res) }
  9856. BLEPeripheralServer.onCharacteristicUnsubscribed(listener)
  9857. BLEPeripheralServer.offCharacteristicUnsubscribed(listener) // 需传入与监听时同一个的函数对象
  9858. ``` */
  9859. offCharacteristicUnsubscribed(
  9860. /** onCharacteristicUnsubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  9861. listener?: OffCharacteristicUnsubscribedCallback
  9862. ): void
  9863. /** [BLEPeripheralServer.offCharacteristicWriteRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html)
  9864. *
  9865. * 需要基础库: `2.10.3`
  9866. *
  9867. * 在插件中使用:不支持
  9868. *
  9869. * 移除已连接的设备请求写当前外围设备的特征值事件的监听函数
  9870. *
  9871. * **示例代码**
  9872. *
  9873. * ```js
  9874. const listener = function (res) { console.log(res) }
  9875. BLEPeripheralServer.onCharacteristicWriteRequest(listener)
  9876. BLEPeripheralServer.offCharacteristicWriteRequest(listener) // 需传入与监听时同一个的函数对象
  9877. ``` */
  9878. offCharacteristicWriteRequest(
  9879. /** onCharacteristicWriteRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  9880. listener?: OffCharacteristicWriteRequestCallback
  9881. ): void
  9882. /** [BLEPeripheralServer.onCharacteristicReadRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html)
  9883. *
  9884. * 需要基础库: `2.10.3`
  9885. *
  9886. * 在插件中使用:不支持
  9887. *
  9888. * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 写回数据,否则主机不会收到响应。 */
  9889. onCharacteristicReadRequest(
  9890. /** 已连接的设备请求读当前外围设备的特征值事件的监听函数 */
  9891. listener: OnCharacteristicReadRequestCallback
  9892. ): void
  9893. /** [BLEPeripheralServer.onCharacteristicSubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html)
  9894. *
  9895. * 需要基础库: `2.13.0`
  9896. *
  9897. * 在插件中使用:不支持
  9898. *
  9899. * 监听特征订阅事件,仅 iOS 支持。 */
  9900. onCharacteristicSubscribed(
  9901. /** 特征订阅事件的监听函数 */
  9902. listener: OnCharacteristicSubscribedCallback
  9903. ): void
  9904. /** [BLEPeripheralServer.onCharacteristicUnsubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html)
  9905. *
  9906. * 需要基础库: `2.13.0`
  9907. *
  9908. * 在插件中使用:不支持
  9909. *
  9910. * 监听取消特征订阅事件,仅 iOS 支持。 */
  9911. onCharacteristicUnsubscribed(
  9912. /** 取消特征订阅事件的监听函数 */
  9913. listener: OnCharacteristicUnsubscribedCallback
  9914. ): void
  9915. /** [BLEPeripheralServer.onCharacteristicWriteRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html)
  9916. *
  9917. * 需要基础库: `2.10.3`
  9918. *
  9919. * 在插件中使用:不支持
  9920. *
  9921. * 监听已连接的设备请求写当前外围设备的特征值事件。收到该消息后需要立刻调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 写回数据,否则主机不会收到响应。 */
  9922. onCharacteristicWriteRequest(
  9923. /** 已连接的设备请求写当前外围设备的特征值事件的监听函数 */
  9924. listener: OnCharacteristicWriteRequestCallback
  9925. ): void
  9926. /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html)
  9927. *
  9928. * 需要基础库: `2.10.3`
  9929. *
  9930. * 在插件中使用:不支持
  9931. *
  9932. * 移除服务。 */
  9933. removeService(option: RemoveServiceOption): void
  9934. /** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html)
  9935. *
  9936. * 需要基础库: `2.10.3`
  9937. *
  9938. * 在插件中使用:不支持
  9939. *
  9940. * 开始广播本地创建的外围设备。
  9941. *
  9942. * **注意**
  9943. *
  9944. * - Android 8.0.9 开始,支持直接使用 16/32/128 位 UUID;
  9945. * - Android 8.0.9 以下版本只支持 128 位 UUID,使用 16/32 位的 UUID 时需要进行补位(系统会自动识别是否属于预分配区间),可以参考[蓝牙指南](https://developers.weixin.qq.com/miniprogram/dev/framework/device/ble.html);
  9946. * - iOS 必须直接使用 16 位的 UUID,不能补位到 128 位,否则系统组包时仍会按照 128 位传输。iOS 暂不支持 32 位 UUID。
  9947. * - iOS 同时只能发起一个广播,安卓支持同时发起多个广播。
  9948. * - 传 beacon 参数时,不能同时传入 deviceName,serviceUuids,manufacturerData 参数。 */
  9949. startAdvertising(Object: StartAdvertisingObject): void
  9950. /** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html)
  9951. *
  9952. * 需要基础库: `2.10.3`
  9953. *
  9954. * 在插件中使用:不支持
  9955. *
  9956. * 停止广播。 */
  9957. stopAdvertising(option?: StopAdvertisingOption): void
  9958. /** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html)
  9959. *
  9960. * 需要基础库: `2.10.3`
  9961. *
  9962. * 在插件中使用:不支持
  9963. *
  9964. * 往指定特征写入二进制数据值,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。 */
  9965. writeCharacteristicValue(Object: WriteCharacteristicValueObject): void
  9966. }
  9967. interface BackgroundAudioError {
  9968. /** 错误信息
  9969. *
  9970. * | 错误码 | 错误信息 | 说明 |
  9971. * | - | - | - |
  9972. * | 10001 | | 系统错误 |
  9973. * | 10002 | | 网络错误 |
  9974. * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length |
  9975. * | 10004 | | 格式错误 |
  9976. * | -1 | | 未知错误 | */ errMsg: string
  9977. /** 错误码
  9978. *
  9979. * | 错误码 | 错误信息 | 说明 |
  9980. * | - | - | - |
  9981. * | 10001 | | 系统错误 |
  9982. * | 10002 | | 网络错误 |
  9983. * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length |
  9984. * | 10004 | | 格式错误 |
  9985. * | -1 | | 未知错误 | */ errCode: number
  9986. }
  9987. interface BackgroundAudioManager {
  9988. /** [BackgroundAudioManager.onCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onCanplay.html)
  9989. *
  9990. * 在插件中使用:支持
  9991. *
  9992. * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */
  9993. onCanplay(
  9994. /** 背景音频进入可播放状态事件的监听函数 */
  9995. listener: OnCanplayCallback
  9996. ): void
  9997. /** [BackgroundAudioManager.onEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html)
  9998. *
  9999. * 在插件中使用:支持
  10000. *
  10001. * 监听背景音频自然播放结束事件 */
  10002. onEnded(
  10003. /** 背景音频自然播放结束事件的监听函数 */
  10004. listener: OnEndedCallback
  10005. ): void
  10006. /** [BackgroundAudioManager.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html)
  10007. *
  10008. * 在插件中使用:支持
  10009. *
  10010. * 监听背景音频播放错误事件 */
  10011. onError(
  10012. /** 背景音频播放错误事件的监听函数 */
  10013. listener: BackgroundAudioManagerOnErrorCallback
  10014. ): void
  10015. /** [BackgroundAudioManager.onNext(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onNext.html)
  10016. *
  10017. * 在插件中使用:支持
  10018. *
  10019. * 监听用户在系统音乐播放面板点击下一曲事件(仅iOS) */
  10020. onNext(
  10021. /** 用户在系统音乐播放面板点击下一曲事件的监听函数 */
  10022. listener: OnNextCallback
  10023. ): void
  10024. /** [BackgroundAudioManager.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPause.html)
  10025. *
  10026. * 在插件中使用:支持
  10027. *
  10028. * 监听背景音频暂停事件 */
  10029. onPause(
  10030. /** 背景音频暂停事件的监听函数 */
  10031. listener: OnPauseCallback
  10032. ): void
  10033. /** [BackgroundAudioManager.onPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html)
  10034. *
  10035. * 在插件中使用:支持
  10036. *
  10037. * 监听背景音频播放事件 */
  10038. onPlay(
  10039. /** 背景音频播放事件的监听函数 */
  10040. listener: OnPlayCallback
  10041. ): void
  10042. /** [BackgroundAudioManager.onPrev(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html)
  10043. *
  10044. * 在插件中使用:支持
  10045. *
  10046. * 监听用户在系统音乐播放面板点击上一曲事件(仅iOS) */
  10047. onPrev(
  10048. /** 用户在系统音乐播放面板点击上一曲事件的监听函数 */
  10049. listener: OnPrevCallback
  10050. ): void
  10051. /** [BackgroundAudioManager.onSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeked.html)
  10052. *
  10053. * 在插件中使用:支持
  10054. *
  10055. * 监听背景音频完成跳转操作事件 */
  10056. onSeeked(
  10057. /** 背景音频完成跳转操作事件的监听函数 */
  10058. listener: OnSeekedCallback
  10059. ): void
  10060. /** [BackgroundAudioManager.onSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html)
  10061. *
  10062. * 在插件中使用:支持
  10063. *
  10064. * 监听背景音频开始跳转操作事件 */
  10065. onSeeking(
  10066. /** 背景音频开始跳转操作事件的监听函数 */
  10067. listener: OnSeekingCallback
  10068. ): void
  10069. /** [BackgroundAudioManager.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html)
  10070. *
  10071. * 在插件中使用:支持
  10072. *
  10073. * 监听背景音频停止事件 */
  10074. onStop(
  10075. /** 背景音频停止事件的监听函数 */
  10076. listener: InnerAudioContextOnStopCallback
  10077. ): void
  10078. /** [BackgroundAudioManager.onTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html)
  10079. *
  10080. * 在插件中使用:支持
  10081. *
  10082. * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */
  10083. onTimeUpdate(
  10084. /** 背景音频播放进度更新事件的监听函数 */
  10085. listener: OnTimeUpdateCallback
  10086. ): void
  10087. /** [BackgroundAudioManager.onWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html)
  10088. *
  10089. * 在插件中使用:支持
  10090. *
  10091. * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
  10092. onWaiting(
  10093. /** 音频加载中事件的监听函数 */
  10094. listener: OnWaitingCallback
  10095. ): void
  10096. /** [BackgroundAudioManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.pause.html)
  10097. *
  10098. * 在插件中使用:支持
  10099. *
  10100. * 暂停音乐 */
  10101. pause(): void
  10102. /** [BackgroundAudioManager.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.play.html)
  10103. *
  10104. * 在插件中使用:支持
  10105. *
  10106. * 播放音乐 */
  10107. play(): void
  10108. /** [BackgroundAudioManager.seek(number currentTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.seek.html)
  10109. *
  10110. * 在插件中使用:支持
  10111. *
  10112. * 跳转到指定位置 */
  10113. seek(
  10114. /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
  10115. currentTime: number
  10116. ): void
  10117. /** [BackgroundAudioManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.stop.html)
  10118. *
  10119. * 在插件中使用:支持
  10120. *
  10121. * 停止音乐 */
  10122. stop(): void
  10123. }
  10124. interface BeaconError {
  10125. /** 错误信息
  10126. *
  10127. * | 错误码 | 错误信息 | 说明 |
  10128. * | - | - | - |
  10129. * | 0 | ok | 正常 |
  10130. * | 11000 | unsupport | 系统或设备不支持 |
  10131. * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
  10132. * | 11002 | location service unavailable | 位置服务不可用 |
  10133. * | 11003 | already start | 已经开始搜索 |
  10134. * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
  10135. * | 11005 | system error | 系统错误 |
  10136. * | 11006 | invalid data | 参数不正确 | */ errMsg: string
  10137. /** 错误码
  10138. *
  10139. * | 错误码 | 错误信息 | 说明 |
  10140. * | - | - | - |
  10141. * | 0 | ok | 正常 |
  10142. * | 11000 | unsupport | 系统或设备不支持 |
  10143. * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
  10144. * | 11002 | location service unavailable | 位置服务不可用 |
  10145. * | 11003 | already start | 已经开始搜索 |
  10146. * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
  10147. * | 11005 | system error | 系统错误 |
  10148. * | 11006 | invalid data | 参数不正确 | */ errCode: number
  10149. }
  10150. interface BluetoothError {
  10151. /** 错误信息
  10152. *
  10153. * | 错误码 | 错误信息 | 说明 |
  10154. * | - | - | - |
  10155. * | 0 | ok | 正常 |
  10156. * | -1 | already connect | 已连接 |
  10157. * | 10000 | not init | 未初始化蓝牙适配器 |
  10158. * | 10001 | not available | 当前蓝牙适配器不可用 |
  10159. * | 10002 | no device | 没有找到指定设备 |
  10160. * | 10003 | connection fail | 连接失败 |
  10161. * | 10004 | no service | 没有找到指定服务 |
  10162. * | 10005 | no characteristic | 没有找到指定特征 |
  10163. * | 10006 | no connection | 当前连接已断开 |
  10164. * | 10007 | property not support | 当前特征不支持此操作 |
  10165. * | 10008 | system error | 其余所有系统上报的异常 |
  10166. * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
  10167. * | 10012 | operate time out | 连接超时 |
  10168. * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errMsg: string
  10169. /** 错误码
  10170. *
  10171. * | 错误码 | 错误信息 | 说明 |
  10172. * | - | - | - |
  10173. * | 0 | ok | 正常 |
  10174. * | -1 | already connect | 已连接 |
  10175. * | 10000 | not init | 未初始化蓝牙适配器 |
  10176. * | 10001 | not available | 当前蓝牙适配器不可用 |
  10177. * | 10002 | no device | 没有找到指定设备 |
  10178. * | 10003 | connection fail | 连接失败 |
  10179. * | 10004 | no service | 没有找到指定服务 |
  10180. * | 10005 | no characteristic | 没有找到指定特征 |
  10181. * | 10006 | no connection | 当前连接已断开 |
  10182. * | 10007 | property not support | 当前特征不支持此操作 |
  10183. * | 10008 | system error | 其余所有系统上报的异常 |
  10184. * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
  10185. * | 10012 | operate time out | 连接超时 |
  10186. * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errCode: number
  10187. }
  10188. interface CacheManager {
  10189. /** [Array.&lt;string&gt; CacheManager.addRules(Object rules)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRules.html)
  10190. *
  10191. * 需要基础库: `2.24.0`
  10192. *
  10193. * 在插件中使用:不支持
  10194. *
  10195. * 批量添加规则,规则写法可参考 [CacheManager.addRule](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html)。 */
  10196. addRules(
  10197. /** 规则列表 */
  10198. rules: IAnyObject
  10199. ): string[]
  10200. /** [CacheManager.clearCaches()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearCaches.html)
  10201. *
  10202. * 需要基础库: `2.24.0`
  10203. *
  10204. * 在插件中使用:不支持
  10205. *
  10206. * 清空所有缓存。 */
  10207. clearCaches(): void
  10208. /** [CacheManager.clearRules()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearRules.html)
  10209. *
  10210. * 需要基础库: `2.24.0`
  10211. *
  10212. * 在插件中使用:不支持
  10213. *
  10214. * 清空所有规则,同时会删除对应规则下所有缓存。 */
  10215. clearRules(): void
  10216. /** [CacheManager.deleteCache(string id)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCache.html)
  10217. *
  10218. * 需要基础库: `2.24.0`
  10219. *
  10220. * 在插件中使用:不支持
  10221. *
  10222. * 删除缓存。 */
  10223. deleteCache(
  10224. /** 缓存 id */
  10225. id: string
  10226. ): void
  10227. /** [CacheManager.deleteCaches(Array.&lt;string&gt; ids)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCaches.html)
  10228. *
  10229. * 需要基础库: `2.24.0`
  10230. *
  10231. * 在插件中使用:不支持
  10232. *
  10233. * 批量删除缓存。 */
  10234. deleteCaches(
  10235. /** 缓存 id 列表 */
  10236. ids: string[]
  10237. ): void
  10238. /** [CacheManager.deleteRule(string id)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html)
  10239. *
  10240. * 需要基础库: `2.24.0`
  10241. *
  10242. * 在插件中使用:不支持
  10243. *
  10244. * 删除规则,同时会删除对应规则下所有缓存。 */
  10245. deleteRule(
  10246. /** 规则 id */
  10247. id: string
  10248. ): void
  10249. /** [CacheManager.deleteRules(Array.&lt;string&gt; ids)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRules.html)
  10250. *
  10251. * 需要基础库: `2.24.0`
  10252. *
  10253. * 在插件中使用:不支持
  10254. *
  10255. * 批量删除规则,同时会删除对应规则下所有缓存。 */
  10256. deleteRules(
  10257. /** 规则 id 列表 */
  10258. ids: string[]
  10259. ): void
  10260. /** [CacheManager.off(string eventName, function handler)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.off.html)
  10261. *
  10262. * 需要基础库: `2.24.0`
  10263. *
  10264. * 在插件中使用:不支持
  10265. *
  10266. * 取消事件监听。 */
  10267. off(
  10268. /** 事件名 */
  10269. eventName: string,
  10270. /** 事件句柄 */
  10271. handler: (...args: any[]) => any
  10272. ): void
  10273. /** [CacheManager.on(string eventName, function handler)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.on.html)
  10274. *
  10275. * 需要基础库: `2.24.0`
  10276. *
  10277. * 在插件中使用:不支持
  10278. *
  10279. * 监听事件。
  10280. *
  10281. * ****
  10282. *
  10283. * 这里 request 事件会提供 request 事件对象,用于做后续的处理;在 request 事件中需要返回一个 promise,用来生成 wx.request 请求的返回内容。
  10284. *
  10285. * #### 示例代码
  10286. *
  10287. * ```js
  10288. async function handler(evt) {
  10289. // evt.url - 请求 url
  10290. // evt.data - 请求参数
  10291. // evt.method - 请求方法
  10292. // evt.request - 原始 request 方法,返回一个 promise
  10293. // if (evt.url === '/xxx') {
  10294. // // 如果有些请求仍然希望走到网络,则可以如下处理
  10295. // const res = await evt.request()
  10296. // // res 即为网络请求返回
  10297. // }
  10298. return new Promsie((resolve, reject) => {
  10299. // do sth
  10300. if (data) {
  10301. // 这里 resolve 的 data 就会作为 wx.request 的 success 回调结果返回
  10302. resolve(data)
  10303. } else {
  10304. // 这里 reject 的错误信息就会作为 wx.request 的 fail 回调结果返回
  10305. reject('no data')
  10306. }
  10307. })
  10308. }
  10309. cacheManager.on('request', handler)
  10310. ``` */
  10311. on(
  10312. /** 事件名
  10313. *
  10314. * 参数 eventName 可选值:
  10315. * - 'request': 发生 wx.request 请求,只在缓存管理器开启阶段会触发;
  10316. * - 'enterWeakNetwork': 进入弱网/离线状态;
  10317. * - 'exitWeakNetwork': 离开弱网/离线状态; */
  10318. eventName: 'request' | 'enterWeakNetwork' | 'exitWeakNetwork',
  10319. /** 事件句柄 */
  10320. handler: (...args: any[]) => any
  10321. ): void
  10322. /** [CacheManager.start()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.start.html)
  10323. *
  10324. * 需要基础库: `2.24.0`
  10325. *
  10326. * 在插件中使用:不支持
  10327. *
  10328. * 开启缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 1。 */
  10329. start(): void
  10330. /** [CacheManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.stop.html)
  10331. *
  10332. * 需要基础库: `2.24.0`
  10333. *
  10334. * 在插件中使用:不支持
  10335. *
  10336. * 关闭缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 0。 */
  10337. stop(): void
  10338. /** [Object CacheManager.match(Object evt)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.match.html)
  10339. *
  10340. * 需要基础库: `2.24.0`
  10341. *
  10342. * 在插件中使用:不支持
  10343. *
  10344. * 匹配命中的缓存规则,一般需要和 request 事件搭配使用。
  10345. *
  10346. * **示例代码**
  10347. *
  10348. * ```js
  10349. function handler(evt) {
  10350. const cache = cacheManager.match(evt)
  10351. // 若有重复监听,则取第一个 handler 返回的 promise
  10352. return new Promise((resolve, reject) => {
  10353. if (cache.data) {
  10354. resolve(cache.data)
  10355. } else {
  10356. reject('no cache')
  10357. }
  10358. })
  10359. }
  10360. cacheManager.on('request', handler)
  10361. ``` */
  10362. match(
  10363. /** request 事件对象 */
  10364. evt: IAnyObject
  10365. ): MatchCache
  10366. /** [string CacheManager.addRule(Object rule)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html)
  10367. *
  10368. * 需要基础库: `2.24.0`
  10369. *
  10370. * 在插件中使用:不支持
  10371. *
  10372. * 添加规则。
  10373. *
  10374. * **规则说明**
  10375. *
  10376. * 支持的规则写法有字符串、正则和对象三种:
  10377. *
  10378. * ### 字符串写法
  10379. *
  10380. * 1. `addRule('/abc')`:纯 uri 串。
  10381. * 2. `addRule('GET /abc'):带方法的 uri 串,除了匹配 uri 外,还会匹配请求方法。如例子中必须是 GET 方法请求才会被匹配。
  10382. * 3. `addRule('/abc/:id'):带可变部分的 uri 串,id 可以是任意符合标准的字符串,表示这一段可以动态变化。比如 `/abc/123` 和 `/abc/321` 都会被匹配,而 `/abc/123/xxx` 因为多了一段,就不会被匹配。
  10383. * 4. `addRule('/abc?aa'):带 query 参数的 uri 串,包含 aa 参数,值可以为任意值。比如 `/abc?aa=haha` 会被匹配,但是 `/abc` 就不会被匹配,因为缺少规则中声明的 aa 参数;不过如果请求是 `/abc?aa=haha&bb=123`,虽然多带了 bb 参数,但是因为包含了 aa 参数,所以也可以被匹配。
  10384. * 5. `addRule('/abc?dd=haha'):带 query 参数的 uri 串,包含 dd 参数且值为 haha。比如 `/abc?dd=haha` 和 `/abc?dd=haha&bb=123` 会被匹配,而 `/abc?dd=123` 就不会被匹配,因为规则要求了 dd 参数的值。
  10385. *
  10386. * > 以上写法中的 uri 串如果只有 path 部分,则会取全局 origin 进行补全。比如全局 origin 是 `https://weixin.qq.com`,而规则是 `/abc`,则会补全为 `https://weixin.qq.com/abc`。因此在前面例子中 `addRule('/abc')` 和 `addRule('https://weixin.qq.com/abc')` 的写法效果一致。所以一般情况下如果需要匹配的请求 origin 和全局 origin 一致,则规则中可忽略不写 orign。
  10387. *
  10388. * ### 正则写法
  10389. *
  10390. * 1. `addRule(/\/(abc|cba)$/ig)`:直接正则匹配请求的 uri,同时会比对请求 origin 和全局 origin 是否一致。
  10391. * 2. `addRule(/^https:\/\/weixin.qq.com\/(abc|cba)$/ig)`:带有 orign 部分的正则表达式,则只匹配 uri,不再比对 origin。
  10392. *
  10393. * ### 对象写法
  10394. *
  10395. * 使用规则对象,可以更为详细的描述规则内容。(一般使用规则对象,是为了匹配请求参数)
  10396. *
  10397. * #### 规则对象:
  10398. *
  10399. * | 属性名 | 类型 | 默认值 | 备注 |
  10400. * |---|---|---|---|
  10401. * | id | string | | 规则 id,如果不填则会由基础库生成 |
  10402. * | method | string | | 请求方法,可选值 GET/POST/PATCH/PUT/DELETE,如果为空则表示前面提到的所有方法都能被匹配到 |
  10403. * | url | any | 必填 | uri 匹配规则,可参考规则字符串写法和正则写法 |
  10404. * | maxAge | number | 7 * 24 * 60 * 60 * 1000 | 缓存有效时间,单位为 ms,不填则默认取缓存管理器全局的缓存有效时间 |
  10405. * | dataSchema | Array\<DataRule\> | | 匹配请求参数 |
  10406. *
  10407. * 其中,dataSchema 用来匹配对象类型的请求参数(比如 wx.request 的 data),默认可以不填,即不做参数匹配。
  10408. *
  10409. * dataSchema 的类型是一个 DataRule 对象数组,一个 DataRule 对象描述一个参数,比如一个 wx.request 请求的 data 是 `{a: 123, b: 'haha', c: true}`,你想要用一条规则来匹配其中的 a 和 b 参数,如果 a 是数字且 b 是字符串就能命中该规则,那么就需要在 dataSchema 中补充两个 DataRule 对象,即 `[{name: 'a', schema: {type: 'number'}}, {name: 'b', schema: {type: 'string'}}]`。
  10410. *
  10411. * #### DataRule 对象:
  10412. *
  10413. * | 属性名 | 类型 | 默认值 | 备注 |
  10414. * |---|---|---|---|
  10415. * | name | string | | 需要匹配的参数名 |
  10416. * | schema | DataSchema/Array\<DataSchema\> | 需要匹配的参数模式,支持数组,表示该参数值有多种模式 |
  10417. *
  10418. * name 表示要匹配的参数名,schema 为 DataSchema 对象,用来描述该参数的类型和值。
  10419. *
  10420. * 一个 DataRule 对象也可以匹配可能拥有多种类型的参数,所以 schema 也支持为 DataSchema 对象数组。比如上述例子中,希望匹配的 a 参数必须是数值或者字符串,那么可以这么写:`{name: 'a', schema: [{type: 'number'}, {type: 'string'}]}`。
  10421. *
  10422. * #### DataSchema 对象:
  10423. *
  10424. * | 属性名 | 类型 | 默认值 | 备注 |
  10425. * |---|---|---|---|
  10426. * | type | string | | 需要匹配的 data 对象的参数类型,string、number、boolean、null、object、any(表示任意类型),同时支持数组模式(数组模式则在类型后面加 [],如 string[] 表示字符串数组) |
  10427. * | value | string/regexp/function/Array\<DataRule\> | | 需要匹配的 data 对象的参数值,当 type 为基本类型时,可以用 string/regexp 来匹配固定的值,也可以通过 function 来确定值是否匹配,如果传入的 type 是 object,那么表示需要嵌套匹配值是否正确,可以传入 Array<DataRule> |
  10428. *
  10429. * type 参数表示要匹配的参数类型,value 表示要匹配的参数值。其中 value 支持多种写法,不同写法有如下匹配方式:
  10430. *
  10431. * 1. 字符串写法:直接判值的字符串形式是否和给定字符串一样,比如 value 值为 `123`,就要求参数值必须为 123 才能与之匹配。
  10432. * 2. 正则写法:直接判值的字符串形式是否能被正则匹配,比如 value 值为 `/\d+/ig`,就要求参数值必须为数字,如果参数值为 `abc` 则不会被匹配。
  10433. * 3. 函数写法:在匹配时会调用用户传入的函数,交由用户判断是否匹配。
  10434. * 4. DataRule 数组写法:当参数类型为对象时,那么字符串写法和正则写法就无法使用,需要传入 DataRule 数组来进行匹配,即通过嵌套 DataRule 数组的方式来匹配嵌套的对象。
  10435. *
  10436. * ### 示例代码
  10437. *
  10438. * ```js
  10439. const ruleId = cacheManager.addRule({
  10440. id: 'haha-rule',
  10441. method: 'GET',
  10442. url: '/haha',
  10443. maxAge: 123455,
  10444. dataSchema: [
  10445. // data 字段的匹配,默认为空,表示不匹配
  10446. // 类型可以是:string、number、boolean、null、object、any(表示任意类型均可),以及这些类型的数组表示方式
  10447. {name: 'aaa', schema: {type: 'string'}}, // 类型为 string
  10448. {name: 'bbb', schema: [{type: 'number'}, {type: 'string'}]}, // 类型为 number, string
  10449. {name: 'ccc', schema: {type: 'string', value: 'abc'}}, // 值为 abc
  10450. {name: 'ddd', schema: {type: 'string', value: /(abc|cba)/ig}}, // 值符合该正则匹配,如果该值不是字符串类型,则会被尝试转成字符串后再进行比较
  10451. {name: 'ddd', schema: {type: 'string', value: val => val === '123'}}, // 传入函数来校验值
  10452. {name: 'eee', schema: {type: 'object', value: [{ // 类型为对象,则通过嵌套的方式来逐层校验
  10453. name: 'aaa', schema: {type: 'string'},
  10454. // ...
  10455. // 嵌套 dataSchema,同上面的方式一样来匹配嵌套的对象
  10456. }]}},
  10457. {name: 'fff', schema: {type: 'string[]'}}, // 类型为 string 数组
  10458. {name: 'ggg', schema: {type: 'any'}}, // 类型为任意类型
  10459. {name: 'hhh', schema: {type: 'any[]'}}, // 类型为任意类型的数组
  10460. }],
  10461. })
  10462. ```
  10463. *
  10464. * ### 补充说明
  10465. *
  10466. * 用户可以添加多条规则,每条规则都会去解析网络请求,然后判断是否命中规则。假设有多条规则命中,则取第一条命中的规则。
  10467. *
  10468. * ### 缓存覆盖
  10469. *
  10470. * 不同的网络请求也可能命中同一条规则,所以每条规则可能对应多个缓存。每条规则会有一个规则 id,每个缓存会有一个缓存 id,一个规则 id 可能对应多个缓存 id,而缓存管理器的缓存存储是基于缓存 id 标识的,如果两个不同的请求生成了同样的缓存 id,那么后发生的请求结果缓存会覆盖前者。因此使用时需要思考缓存的覆盖情况,目前缓存 id 生成方式如下:
  10471. *
  10472. * 1. 规则使用字符串写法:那么按 method + url + 规则中声明的 query 参数来生成缓存 id。
  10473. *
  10474. * > 需要注意的是这里不使用真实请求中的 query 参数来生成缓存 id,而是使用规则中匹配到的 query 来生成缓存 id。比如规则是 `/abc?aa=123`,请求是 GET 方法的 `/abc?aa=123&bb=123`,那么就会基于 `GET /abc?aa=123` 来生成缓存 id。而规则里没有声明 `bb=123`,所以 bb 参数不会被纳入缓存 id 的生成基准。
  10475. *
  10476. * 2. 规则使用正则写法:那么只按 method + url 生成缓存 id,不考虑 query 参数。
  10477. * 3. 规则使用对象写法:如果规则对象中的 url 是字符串写法,那么按 method + url + 规则中声明的 query 参数 + 规则中 dataSchema 声明的请求参数来生成缓存 id;如果规则对象中的 url 是正则写法,那么按 method + url + 规则中 dataSchema 声明的请求参数来生成缓存 id。
  10478. *
  10479. * > 生成缓存 id 时没有使用请求中完整的 query 参数或者请求参数来作为基准,是考虑到很多请求可能会带上 token 或时间戳等参数。因为此参数存在不确定性,会导致每次请求生成的缓存 id 都不同,进而导致缓存命中率下降,故采取规则中声明的 query 参数和 dataSchema 声明的请求参数来作为生成缓存 id 的基准。 */
  10480. addRule(
  10481. /** 规则 */
  10482. rule: IAnyObject
  10483. ): string
  10484. }
  10485. interface CameraContext {
  10486. /** [CameraContext.setZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html)
  10487. *
  10488. * 需要基础库: `2.10.0`
  10489. *
  10490. * 在插件中使用:支持
  10491. *
  10492. * 设置缩放级别 */
  10493. setZoom(option: SetZoomOption): void
  10494. /** [CameraContext.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html)
  10495. *
  10496. * 在插件中使用:支持
  10497. *
  10498. * 开始录像 */
  10499. startRecord(option: CameraContextStartRecordOption): void
  10500. /** [CameraContext.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html)
  10501. *
  10502. * 在插件中使用:支持
  10503. *
  10504. * 结束录像 */
  10505. stopRecord(option: CameraContextStopRecordOption): void
  10506. /** [CameraContext.takePhoto(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html)
  10507. *
  10508. * 在插件中使用:支持
  10509. *
  10510. * 拍摄照片 */
  10511. takePhoto(option: TakePhotoOption): void
  10512. /** [[CameraFrameListener](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.html) CameraContext.onCameraFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.onCameraFrame.html)
  10513. *
  10514. * 需要基础库: `2.7.0`
  10515. *
  10516. * 在插件中使用:不支持
  10517. *
  10518. * 获取 Camera 实时帧数据
  10519. *
  10520. * ****
  10521. *
  10522. * 注: 使用该接口需同时在 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件属性中指定 frame-size。
  10523. *
  10524. * **示例代码**
  10525. *
  10526. * ```js
  10527. const context = wx.createCameraContext()
  10528. const listener = context.onCameraFrame((frame) => {
  10529. console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height)
  10530. })
  10531. listener.start()
  10532. ``` */
  10533. onCameraFrame(
  10534. /** 回调函数 */
  10535. callback: OnCameraFrameCallback
  10536. ): CameraFrameListener
  10537. }
  10538. interface CameraFrameListener {
  10539. /** [CameraFrameListener.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.start.html)
  10540. *
  10541. * 在插件中使用:不支持
  10542. *
  10543. * 开始监听帧数据 */
  10544. start(option?: CameraFrameListenerStartOption): void
  10545. /** [CameraFrameListener.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html)
  10546. *
  10547. * 在插件中使用:不支持
  10548. *
  10549. * 停止监听帧数据 */
  10550. stop(option?: StopOption): void
  10551. }
  10552. interface Canvas {
  10553. /** [Canvas.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html)
  10554. *
  10555. * 需要基础库: `2.7.0`
  10556. *
  10557. * 在插件中使用:支持
  10558. *
  10559. * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
  10560. cancelAnimationFrame(requestID: number): void
  10561. /** [[ImageData](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/ImageData.html) Canvas.createImageData()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImageData.html)
  10562. *
  10563. * 需要基础库: `2.9.0`
  10564. *
  10565. * 在插件中使用:支持
  10566. *
  10567. * 创建一个 ImageData 对象。仅支持在 2D Canvas 中使用。 */
  10568. createImageData(): ImageData
  10569. /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) Canvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html)
  10570. *
  10571. * 需要基础库: `2.7.0`
  10572. *
  10573. * 在插件中使用:支持
  10574. *
  10575. * 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
  10576. createImage(): Image
  10577. /** [[Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) Canvas.createPath2D([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createPath2D.html)
  10578. *
  10579. * 需要基础库: `2.11.0`
  10580. *
  10581. * 在插件中使用:支持
  10582. *
  10583. * 创建 Path2D 对象 */
  10584. createPath2D(
  10585. /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) */
  10586. path: Path2D
  10587. ): Path2D
  10588. /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html)
  10589. *
  10590. * 需要基础库: `2.7.0`
  10591. *
  10592. * 在插件中使用:支持
  10593. *
  10594. * 该方法返回 Canvas 的绘图上下文
  10595. *
  10596. * ****
  10597. *
  10598. * 支持获取 2D 和 WebGL 绘图上下文 */
  10599. getContext(contextType: string): any
  10600. /** [number Canvas.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html)
  10601. *
  10602. * 需要基础库: `2.7.0`
  10603. *
  10604. * 在插件中使用:支持
  10605. *
  10606. * 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
  10607. requestAnimationFrame(
  10608. /** 执行的 callback */
  10609. callback: (...args: any[]) => any
  10610. ): number
  10611. /** [string Canvas.toDataURL(string type, number encoderOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html)
  10612. *
  10613. * 需要基础库: `2.11.0`
  10614. *
  10615. * 在插件中使用:支持
  10616. *
  10617. * 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。 */
  10618. toDataURL(
  10619. /** 图片格式,默认为 image/png */
  10620. type: string,
  10621. /** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */
  10622. encoderOptions: number
  10623. ): string
  10624. }
  10625. interface CanvasContext {
  10626. /** [CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arc.html)
  10627. *
  10628. * 在插件中使用:支持
  10629. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10630. *
  10631. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10632. *
  10633. * 创建一条弧线。
  10634. *
  10635. * - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。
  10636. * - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。
  10637. *
  10638. * **示例代码**
  10639. *
  10640. * ```javascript
  10641. const ctx = wx.createCanvasContext('myCanvas')
  10642. // Draw coordinates
  10643. ctx.arc(100, 75, 50, 0, 2 * Math.PI)
  10644. ctx.setFillStyle('#EEEEEE')
  10645. ctx.fill()
  10646. ctx.beginPath()
  10647. ctx.moveTo(40, 75)
  10648. ctx.lineTo(160, 75)
  10649. ctx.moveTo(100, 15)
  10650. ctx.lineTo(100, 135)
  10651. ctx.setStrokeStyle('#AAAAAA')
  10652. ctx.stroke()
  10653. ctx.setFontSize(12)
  10654. ctx.setFillStyle('black')
  10655. ctx.fillText('0', 165, 78)
  10656. ctx.fillText('0.5*PI', 83, 145)
  10657. ctx.fillText('1*PI', 15, 78)
  10658. ctx.fillText('1.5*PI', 83, 10)
  10659. // Draw points
  10660. ctx.beginPath()
  10661. ctx.arc(100, 75, 2, 0, 2 * Math.PI)
  10662. ctx.setFillStyle('lightgreen')
  10663. ctx.fill()
  10664. ctx.beginPath()
  10665. ctx.arc(100, 25, 2, 0, 2 * Math.PI)
  10666. ctx.setFillStyle('blue')
  10667. ctx.fill()
  10668. ctx.beginPath()
  10669. ctx.arc(150, 75, 2, 0, 2 * Math.PI)
  10670. ctx.setFillStyle('red')
  10671. ctx.fill()
  10672. // Draw arc
  10673. ctx.beginPath()
  10674. ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)
  10675. ctx.setStrokeStyle('#333333')
  10676. ctx.stroke()
  10677. ctx.draw()
  10678. ```
  10679. *
  10680. * ![](@program/dev/image/canvas/arc.png)
  10681. *
  10682. * 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下:
  10683. *
  10684. * - 绿色: 圆心 (100, 75)
  10685. * - 红色: 起始弧度 (0)
  10686. * - 蓝色: 终止弧度 (1.5 * Math.PI) */
  10687. arc(
  10688. /** 圆心的 x 坐标 */
  10689. x: number,
  10690. /** 圆心的 y 坐标 */
  10691. y: number,
  10692. /** 圆的半径 */
  10693. r: number,
  10694. /** 起始弧度,单位弧度(在3点钟方向) */
  10695. sAngle: number,
  10696. /** 终止弧度 */
  10697. eAngle: number,
  10698. /** 弧度的方向是否是逆时针 */
  10699. counterclockwise?: boolean
  10700. ): void
  10701. /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html)
  10702. *
  10703. * 需要基础库: `1.9.90`
  10704. *
  10705. * 在插件中使用:支持
  10706. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10707. *
  10708. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10709. *
  10710. * 根据控制点和半径绘制圆弧路径。 */
  10711. arcTo(
  10712. /** 第一个控制点的 x 轴坐标 */
  10713. x1: number,
  10714. /** 第一个控制点的 y 轴坐标 */
  10715. y1: number,
  10716. /** 第二个控制点的 x 轴坐标 */
  10717. x2: number,
  10718. /** 第二个控制点的 y 轴坐标 */
  10719. y2: number,
  10720. /** 圆弧的半径 */
  10721. radius: number
  10722. ): void
  10723. /** [CanvasContext.beginPath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html)
  10724. *
  10725. * 在插件中使用:支持
  10726. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10727. *
  10728. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10729. *
  10730. * 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边
  10731. *
  10732. * - 在最开始的时候相当于调用了一次 `beginPath`。
  10733. * - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
  10734. *
  10735. * **示例代码**
  10736. *
  10737. * ```javascript
  10738. const ctx = wx.createCanvasContext('myCanvas')
  10739. // begin path
  10740. ctx.rect(10, 10, 100, 30)
  10741. ctx.setFillStyle('yellow')
  10742. ctx.fill()
  10743. // begin another path
  10744. ctx.beginPath()
  10745. ctx.rect(10, 40, 100, 30)
  10746. // only fill this rect, not in current path
  10747. ctx.setFillStyle('blue')
  10748. ctx.fillRect(10, 70, 100, 30)
  10749. ctx.rect(10, 100, 100, 30)
  10750. // it will fill current path
  10751. ctx.setFillStyle('red')
  10752. ctx.fill()
  10753. ctx.draw()
  10754. ```
  10755. *
  10756. * ![](@program/dev/image/canvas/fill-path.png) */
  10757. beginPath(): void
  10758. /** [CanvasContext.bezierCurveTo(number cp1x, number cp1y, number cp2x, number cp2y, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.bezierCurveTo.html)
  10759. *
  10760. * 在插件中使用:支持
  10761. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10762. *
  10763. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10764. *
  10765. * 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。
  10766. *
  10767. * **示例代码**
  10768. *
  10769. * ```javascript
  10770. const ctx = wx.createCanvasContext('myCanvas')
  10771. // Draw points
  10772. ctx.beginPath()
  10773. ctx.arc(20, 20, 2, 0, 2 * Math.PI)
  10774. ctx.setFillStyle('red')
  10775. ctx.fill()
  10776. ctx.beginPath()
  10777. ctx.arc(200, 20, 2, 0, 2 * Math.PI)
  10778. ctx.setFillStyle('lightgreen')
  10779. ctx.fill()
  10780. ctx.beginPath()
  10781. ctx.arc(20, 100, 2, 0, 2 * Math.PI)
  10782. ctx.arc(200, 100, 2, 0, 2 * Math.PI)
  10783. ctx.setFillStyle('blue')
  10784. ctx.fill()
  10785. ctx.setFillStyle('black')
  10786. ctx.setFontSize(12)
  10787. // Draw guides
  10788. ctx.beginPath()
  10789. ctx.moveTo(20, 20)
  10790. ctx.lineTo(20, 100)
  10791. ctx.lineTo(150, 75)
  10792. ctx.moveTo(200, 20)
  10793. ctx.lineTo(200, 100)
  10794. ctx.lineTo(70, 75)
  10795. ctx.setStrokeStyle('#AAAAAA')
  10796. ctx.stroke()
  10797. // Draw quadratic curve
  10798. ctx.beginPath()
  10799. ctx.moveTo(20, 20)
  10800. ctx.bezierCurveTo(20, 100, 200, 100, 200, 20)
  10801. ctx.setStrokeStyle('black')
  10802. ctx.stroke()
  10803. ctx.draw()
  10804. ```
  10805. *
  10806. * ![](@program/dev/image/canvas/bezier-curve.png)
  10807. *
  10808. * 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下:
  10809. *
  10810. * - 红色:起始点(20, 20)
  10811. * - 蓝色:两个控制点(20, 100) (200, 100)
  10812. * - 绿色:终止点(200, 20) */
  10813. bezierCurveTo(
  10814. /** 第一个贝塞尔控制点的 x 坐标 */
  10815. cp1x: number,
  10816. /** 第一个贝塞尔控制点的 y 坐标 */
  10817. cp1y: number,
  10818. /** 第二个贝塞尔控制点的 x 坐标 */
  10819. cp2x: number,
  10820. /** 第二个贝塞尔控制点的 y 坐标 */
  10821. cp2y: number,
  10822. /** 结束点的 x 坐标 */
  10823. x: number,
  10824. /** 结束点的 y 坐标 */
  10825. y: number
  10826. ): void
  10827. /** [CanvasContext.clearRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html)
  10828. *
  10829. * 在插件中使用:支持
  10830. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10831. *
  10832. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10833. *
  10834. * 清除画布上在该矩形区域内的内容
  10835. *
  10836. * **示例代码**
  10837. *
  10838. * clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
  10839. * ```html
  10840. * <canvas canvas-id="myCanvas" style="border: 1px solid; background: #123456;"/>
  10841. * ```
  10842. * ```javascript
  10843. const ctx = wx.createCanvasContext('myCanvas')
  10844. ctx.setFillStyle('red')
  10845. ctx.fillRect(0, 0, 150, 200)
  10846. ctx.setFillStyle('blue')
  10847. ctx.fillRect(150, 0, 150, 200)
  10848. ctx.clearRect(10, 10, 150, 75)
  10849. ctx.draw()
  10850. ```
  10851. * ![](@program/dev/image/canvas/clear-rect.png) */
  10852. clearRect(
  10853. /** 矩形路径左上角的横坐标 */
  10854. x: number,
  10855. /** 矩形路径左上角的纵坐标 */
  10856. y: number,
  10857. /** 矩形路径的宽度 */
  10858. width: number,
  10859. /** 矩形路径的高度 */
  10860. height: number
  10861. ): void
  10862. /** [CanvasContext.clip()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html)
  10863. *
  10864. * 需要基础库: `1.6.0`
  10865. *
  10866. * 在插件中使用:支持
  10867. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10868. *
  10869. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10870. *
  10871. * 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
  10872. *
  10873. * **示例代码**
  10874. *
  10875. * ```javascript
  10876. const ctx = wx.createCanvasContext('myCanvas')
  10877. wx.downloadFile({
  10878. url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg',
  10879. success: function(res) {
  10880. ctx.save()
  10881. ctx.beginPath()
  10882. ctx.arc(50, 50, 25, 0, 2*Math.PI)
  10883. ctx.clip()
  10884. ctx.drawImage(res.tempFilePath, 25, 25)
  10885. ctx.restore()
  10886. ctx.draw()
  10887. }
  10888. })
  10889. ```
  10890. * ![](@program/dev/image/canvas/clip.png) */
  10891. clip(): void
  10892. /** [CanvasContext.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html)
  10893. *
  10894. * 在插件中使用:支持
  10895. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10896. *
  10897. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10898. *
  10899. * 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
  10900. *
  10901. * **示例代码**
  10902. *
  10903. * ```javascript
  10904. const ctx = wx.createCanvasContext('myCanvas')
  10905. ctx.moveTo(10, 10)
  10906. ctx.lineTo(100, 10)
  10907. ctx.lineTo(100, 100)
  10908. ctx.closePath()
  10909. ctx.stroke()
  10910. ctx.draw()
  10911. ```
  10912. * ![](@program/dev/image/canvas/close-line.png)
  10913. *
  10914. * ```javascript
  10915. const ctx = wx.createCanvasContext('myCanvas')
  10916. // begin path
  10917. ctx.rect(10, 10, 100, 30)
  10918. ctx.closePath()
  10919. // begin another path
  10920. ctx.beginPath()
  10921. ctx.rect(10, 40, 100, 30)
  10922. // only fill this rect, not in current path
  10923. ctx.setFillStyle('blue')
  10924. ctx.fillRect(10, 70, 100, 30)
  10925. ctx.rect(10, 100, 100, 30)
  10926. // it will fill current path
  10927. ctx.setFillStyle('red')
  10928. ctx.fill()
  10929. ctx.draw()
  10930. ```
  10931. *
  10932. * ![](@program/dev/image/canvas/close-path.png) */
  10933. closePath(): void
  10934. /** [CanvasContext.createPattern(string image, string repetition)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html)
  10935. *
  10936. * 需要基础库: `1.9.90`
  10937. *
  10938. * 在插件中使用:支持
  10939. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10940. *
  10941. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10942. *
  10943. * 对指定的图像创建模式的方法,可在指定的方向上重复元图像 */
  10944. createPattern(
  10945. /** 重复的图像源,支持代码包路径和本地临时路径 (本地路径) */
  10946. image: string,
  10947. /** 如何重复图像
  10948. *
  10949. * 参数 repetition 可选值:
  10950. * - 'repeat': 水平竖直方向都重复;
  10951. * - 'repeat-x': 水平方向重复;
  10952. * - 'repeat-y': 竖直方向重复;
  10953. * - 'no-repeat': 不重复; */
  10954. repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'
  10955. ): void
  10956. /** [CanvasContext.draw(boolean reserve, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html)
  10957. *
  10958. * 在插件中使用:支持
  10959. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  10960. *
  10961. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  10962. *
  10963. * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
  10964. *
  10965. * **示例代码**
  10966. *
  10967. * 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
  10968. *
  10969. * ```javascript
  10970. const ctx = wx.createCanvasContext('myCanvas')
  10971. ctx.setFillStyle('red')
  10972. ctx.fillRect(10, 10, 150, 100)
  10973. ctx.draw()
  10974. ctx.fillRect(50, 50, 150, 100)
  10975. ctx.draw(true)
  10976. ```
  10977. * ![](@program/dev/image/canvas/reserve.png)
  10978. *
  10979. * **示例代码**
  10980. *
  10981. * 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
  10982. *
  10983. * ```javascript
  10984. const ctx = wx.createCanvasContext('myCanvas')
  10985. ctx.setFillStyle('red')
  10986. ctx.fillRect(10, 10, 150, 100)
  10987. ctx.draw()
  10988. ctx.fillRect(50, 50, 150, 100)
  10989. ctx.draw()
  10990. ```
  10991. * ![](@program/dev/image/canvas/un-reserve.png) */
  10992. draw(
  10993. /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */
  10994. reserve?: boolean,
  10995. /** 绘制完成后执行的回调函数 */
  10996. callback?: (...args: any[]) => any
  10997. ): void
  10998. /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
  10999. *
  11000. * 在插件中使用:支持
  11001. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11002. *
  11003. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11004. *
  11005. * 绘制图像到画布
  11006. *
  11007. * **示例代码**
  11008. *
  11009. * 有三个版本的写法:
  11010. *
  11011. * - drawImage(imageResource, dx, dy)
  11012. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  11013. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  11014. *
  11015. * ```javascript
  11016. const ctx = wx.createCanvasContext('myCanvas')
  11017. wx.chooseImage({
  11018. success: function(res){
  11019. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  11020. ctx.draw()
  11021. }
  11022. })
  11023. ```
  11024. * ![](@program/dev/image/canvas/draw-image.png) */
  11025. drawImage(
  11026. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  11027. imageResource: string,
  11028. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  11029. dx: number,
  11030. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  11031. dy: number
  11032. ): void
  11033. /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
  11034. *
  11035. * 在插件中使用:支持
  11036. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11037. *
  11038. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11039. *
  11040. * 绘制图像到画布
  11041. *
  11042. * **示例代码**
  11043. *
  11044. * 有三个版本的写法:
  11045. *
  11046. * - drawImage(imageResource, dx, dy)
  11047. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  11048. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  11049. *
  11050. * ```javascript
  11051. const ctx = wx.createCanvasContext('myCanvas')
  11052. wx.chooseImage({
  11053. success: function(res){
  11054. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  11055. ctx.draw()
  11056. }
  11057. })
  11058. ```
  11059. * ![](@program/dev/image/canvas/draw-image.png) */
  11060. drawImage(
  11061. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  11062. imageResource: string,
  11063. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  11064. dx: number,
  11065. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  11066. dy: number,
  11067. /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
  11068. dWidth: number,
  11069. /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
  11070. dHeight: number
  11071. ): void
  11072. /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
  11073. *
  11074. * 在插件中使用:支持
  11075. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11076. *
  11077. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11078. *
  11079. * 绘制图像到画布
  11080. *
  11081. * **示例代码**
  11082. *
  11083. * 有三个版本的写法:
  11084. *
  11085. * - drawImage(imageResource, dx, dy)
  11086. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  11087. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  11088. *
  11089. * ```javascript
  11090. const ctx = wx.createCanvasContext('myCanvas')
  11091. wx.chooseImage({
  11092. success: function(res){
  11093. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  11094. ctx.draw()
  11095. }
  11096. })
  11097. ```
  11098. * ![](@program/dev/image/canvas/draw-image.png) */
  11099. drawImage(
  11100. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  11101. imageResource: string,
  11102. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 */
  11103. sx: number,
  11104. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 */
  11105. sy: number,
  11106. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 */
  11107. sWidth: number,
  11108. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 */
  11109. sHeight: number,
  11110. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  11111. dx: number,
  11112. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  11113. dy: number,
  11114. /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
  11115. dWidth: number,
  11116. /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
  11117. dHeight: number
  11118. ): void
  11119. /** [CanvasContext.fill()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html)
  11120. *
  11121. * 在插件中使用:支持
  11122. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11123. *
  11124. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11125. *
  11126. * 对当前路径中的内容进行填充。默认的填充色为黑色。
  11127. *
  11128. * **示例代码**
  11129. *
  11130. * 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
  11131. *
  11132. * ```javascript
  11133. const ctx = wx.createCanvasContext('myCanvas')
  11134. ctx.moveTo(10, 10)
  11135. ctx.lineTo(100, 10)
  11136. ctx.lineTo(100, 100)
  11137. ctx.fill()
  11138. ctx.draw()
  11139. ```
  11140. *
  11141. * fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。
  11142. *
  11143. * ![](@program/dev/image/canvas/fill-line.png)
  11144. *
  11145. * ```javascript
  11146. const ctx = wx.createCanvasContext('myCanvas')
  11147. // begin path
  11148. ctx.rect(10, 10, 100, 30)
  11149. ctx.setFillStyle('yellow')
  11150. ctx.fill()
  11151. // begin another path
  11152. ctx.beginPath()
  11153. ctx.rect(10, 40, 100, 30)
  11154. // only fill this rect, not in current path
  11155. ctx.setFillStyle('blue')
  11156. ctx.fillRect(10, 70, 100, 30)
  11157. ctx.rect(10, 100, 100, 30)
  11158. // it will fill current path
  11159. ctx.setFillStyle('red')
  11160. ctx.fill()
  11161. ctx.draw()
  11162. ```
  11163. *
  11164. * ![](@program/dev/image/canvas/fill-path.png) */
  11165. fill(): void
  11166. /** [CanvasContext.fillRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillRect.html)
  11167. *
  11168. * 在插件中使用:支持
  11169. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11170. *
  11171. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11172. *
  11173. * 填充一个矩形。用 [`setFillStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) 设置矩形的填充色,如果没设置默认是黑色。
  11174. *
  11175. * **示例代码**
  11176. *
  11177. * ```javascript
  11178. const ctx = wx.createCanvasContext('myCanvas')
  11179. ctx.setFillStyle('red')
  11180. ctx.fillRect(10, 10, 150, 75)
  11181. ctx.draw()
  11182. ```
  11183. * ![](@program/dev/image/canvas/fill-rect.png) */
  11184. fillRect(
  11185. /** 矩形路径左上角的横坐标 */
  11186. x: number,
  11187. /** 矩形路径左上角的纵坐标 */
  11188. y: number,
  11189. /** 矩形路径的宽度 */
  11190. width: number,
  11191. /** 矩形路径的高度 */
  11192. height: number
  11193. ): void
  11194. /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html)
  11195. *
  11196. * 在插件中使用:支持
  11197. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11198. *
  11199. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11200. *
  11201. * 在画布上绘制被填充的文本
  11202. *
  11203. * **示例代码**
  11204. *
  11205. * ```javascript
  11206. const ctx = wx.createCanvasContext('myCanvas')
  11207. ctx.setFontSize(20)
  11208. ctx.fillText('Hello', 20, 20)
  11209. ctx.fillText('MINA', 100, 100)
  11210. ctx.draw()
  11211. ```
  11212. * ![](@program/dev/image/canvas/text.png) */
  11213. fillText(
  11214. /** 在画布上输出的文本 */
  11215. text: string,
  11216. /** 绘制文本的左上角 x 坐标位置 */
  11217. x: number,
  11218. /** 绘制文本的左上角 y 坐标位置 */
  11219. y: number,
  11220. /** 需要绘制的最大宽度,可选 */
  11221. maxWidth?: number
  11222. ): void
  11223. /** [CanvasContext.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html)
  11224. *
  11225. * 在插件中使用:支持
  11226. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11227. *
  11228. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11229. *
  11230. * 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
  11231. *
  11232. * **示例代码**
  11233. *
  11234. * ```javascript
  11235. const ctx = wx.createCanvasContext('myCanvas')
  11236. ctx.moveTo(10, 10)
  11237. ctx.rect(10, 10, 100, 50)
  11238. ctx.lineTo(110, 60)
  11239. ctx.stroke()
  11240. ctx.draw()
  11241. ```
  11242. * ![](@program/dev/image/canvas/line-to.png) */
  11243. lineTo(
  11244. /** 目标位置的 x 坐标 */
  11245. x: number,
  11246. /** 目标位置的 y 坐标 */
  11247. y: number
  11248. ): void
  11249. /** [CanvasContext.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html)
  11250. *
  11251. * 在插件中使用:支持
  11252. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11253. *
  11254. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11255. *
  11256. * 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
  11257. *
  11258. * **示例代码**
  11259. *
  11260. * ```javascript
  11261. const ctx = wx.createCanvasContext('myCanvas')
  11262. ctx.moveTo(10, 10)
  11263. ctx.lineTo(100, 10)
  11264. ctx.moveTo(10, 50)
  11265. ctx.lineTo(100, 50)
  11266. ctx.stroke()
  11267. ctx.draw()
  11268. ```
  11269. * ![](@program/dev/image/canvas/move-to.png) */
  11270. moveTo(
  11271. /** 目标位置的 x 坐标 */
  11272. x: number,
  11273. /** 目标位置的 y 坐标 */
  11274. y: number
  11275. ): void
  11276. /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html)
  11277. *
  11278. * 在插件中使用:支持
  11279. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11280. *
  11281. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11282. *
  11283. * 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。
  11284. *
  11285. * **示例代码**
  11286. *
  11287. * ```javascript
  11288. const ctx = wx.createCanvasContext('myCanvas')
  11289. // Draw points
  11290. ctx.beginPath()
  11291. ctx.arc(20, 20, 2, 0, 2 * Math.PI)
  11292. ctx.setFillStyle('red')
  11293. ctx.fill()
  11294. ctx.beginPath()
  11295. ctx.arc(200, 20, 2, 0, 2 * Math.PI)
  11296. ctx.setFillStyle('lightgreen')
  11297. ctx.fill()
  11298. ctx.beginPath()
  11299. ctx.arc(20, 100, 2, 0, 2 * Math.PI)
  11300. ctx.setFillStyle('blue')
  11301. ctx.fill()
  11302. ctx.setFillStyle('black')
  11303. ctx.setFontSize(12)
  11304. // Draw guides
  11305. ctx.beginPath()
  11306. ctx.moveTo(20, 20)
  11307. ctx.lineTo(20, 100)
  11308. ctx.lineTo(200, 20)
  11309. ctx.setStrokeStyle('#AAAAAA')
  11310. ctx.stroke()
  11311. // Draw quadratic curve
  11312. ctx.beginPath()
  11313. ctx.moveTo(20, 20)
  11314. ctx.quadraticCurveTo(20, 100, 200, 20)
  11315. ctx.setStrokeStyle('black')
  11316. ctx.stroke()
  11317. ctx.draw()
  11318. ```
  11319. *
  11320. * ![](@program/dev/image/canvas/quadratic-curve-to.png)
  11321. *
  11322. * 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下:
  11323. *
  11324. * - 红色:起始点(20, 20)
  11325. * - 蓝色:控制点(20, 100)
  11326. * - 绿色:终止点(200, 20) */
  11327. quadraticCurveTo(
  11328. /** 贝塞尔控制点的 x 坐标 */
  11329. cpx: number,
  11330. /** 贝塞尔控制点的 y 坐标 */
  11331. cpy: number,
  11332. /** 结束点的 x 坐标 */
  11333. x: number,
  11334. /** 结束点的 y 坐标 */
  11335. y: number
  11336. ): void
  11337. /** [CanvasContext.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html)
  11338. *
  11339. * 在插件中使用:支持
  11340. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11341. *
  11342. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11343. *
  11344. * 创建一个矩形路径。需要用 [`fill`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) 或者 [`stroke`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) 方法将矩形真正的画到 `canvas` 中
  11345. *
  11346. * **示例代码**
  11347. *
  11348. * ```javascript
  11349. const ctx = wx.createCanvasContext('myCanvas')
  11350. ctx.rect(10, 10, 150, 75)
  11351. ctx.setFillStyle('red')
  11352. ctx.fill()
  11353. ctx.draw()
  11354. ```
  11355. * ![](@program/dev/image/canvas/fill-rect.png) */
  11356. rect(
  11357. /** 矩形路径左上角的横坐标 */
  11358. x: number,
  11359. /** 矩形路径左上角的纵坐标 */
  11360. y: number,
  11361. /** 矩形路径的宽度 */
  11362. width: number,
  11363. /** 矩形路径的高度 */
  11364. height: number
  11365. ): void
  11366. /** [CanvasContext.restore()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html)
  11367. *
  11368. * 在插件中使用:支持
  11369. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11370. *
  11371. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11372. *
  11373. * 恢复之前保存的绘图上下文。
  11374. *
  11375. * **示例代码**
  11376. *
  11377. * ```javascript
  11378. const ctx = wx.createCanvasContext('myCanvas')
  11379. // save the default fill style
  11380. ctx.save()
  11381. ctx.setFillStyle('red')
  11382. ctx.fillRect(10, 10, 150, 100)
  11383. // restore to the previous saved state
  11384. ctx.restore()
  11385. ctx.fillRect(50, 50, 150, 100)
  11386. ctx.draw()
  11387. ```
  11388. * ![](@program/dev/image/canvas/save-restore.png) */
  11389. restore(): void
  11390. /** [CanvasContext.rotate(number rotate)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rotate.html)
  11391. *
  11392. * 在插件中使用:支持
  11393. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11394. *
  11395. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11396. *
  11397. * 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
  11398. *
  11399. * **示例代码**
  11400. *
  11401. * ```javascript
  11402. const ctx = wx.createCanvasContext('myCanvas')
  11403. ctx.strokeRect(100, 10, 150, 100)
  11404. ctx.rotate(20 * Math.PI / 180)
  11405. ctx.strokeRect(100, 10, 150, 100)
  11406. ctx.rotate(20 * Math.PI / 180)
  11407. ctx.strokeRect(100, 10, 150, 100)
  11408. ctx.draw()
  11409. ```
  11410. * ![](@program/dev/image/canvas/rotate.png) */
  11411. rotate(
  11412. /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */
  11413. rotate: number
  11414. ): void
  11415. /** [CanvasContext.save()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html)
  11416. *
  11417. * 在插件中使用:支持
  11418. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11419. *
  11420. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11421. *
  11422. * 保存绘图上下文。
  11423. *
  11424. * **示例代码**
  11425. *
  11426. * ```javascript
  11427. const ctx = wx.createCanvasContext('myCanvas')
  11428. // save the default fill style
  11429. ctx.save()
  11430. ctx.setFillStyle('red')
  11431. ctx.fillRect(10, 10, 150, 100)
  11432. // restore to the previous saved state
  11433. ctx.restore()
  11434. ctx.fillRect(50, 50, 150, 100)
  11435. ctx.draw()
  11436. ```
  11437. * ![](@program/dev/image/canvas/save-restore.png) */
  11438. save(): void
  11439. /** [CanvasContext.scale(number scaleWidth, number scaleHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.scale.html)
  11440. *
  11441. * 在插件中使用:支持
  11442. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11443. *
  11444. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11445. *
  11446. * 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
  11447. *
  11448. * **示例代码**
  11449. *
  11450. * ```javascript
  11451. const ctx = wx.createCanvasContext('myCanvas')
  11452. ctx.strokeRect(10, 10, 25, 15)
  11453. ctx.scale(2, 2)
  11454. ctx.strokeRect(10, 10, 25, 15)
  11455. ctx.scale(2, 2)
  11456. ctx.strokeRect(10, 10, 25, 15)
  11457. ctx.draw()
  11458. ```
  11459. * ![](@program/dev/image/canvas/scale.png) */
  11460. scale(
  11461. /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
  11462. scaleWidth: number,
  11463. /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
  11464. scaleHeight: number
  11465. ): void
  11466. /** [CanvasContext.setFillStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)
  11467. *
  11468. * 在插件中使用:支持
  11469. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.fillStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11470. *
  11471. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11472. *
  11473. * 设置填充色。
  11474. *
  11475. * **代码示例**
  11476. *
  11477. * ```js
  11478. const ctx = wx.createCanvasContext('myCanvas')
  11479. ctx.setFillStyle('red')
  11480. ctx.fillRect(10, 10, 150, 75)
  11481. ctx.draw()
  11482. ```
  11483. * ![](@program/dev/image/canvas/fill-rect.png) */
  11484. setFillStyle(
  11485. /** 填充的颜色,默认颜色为 black。 */
  11486. color: string | CanvasGradient
  11487. ): void
  11488. /** [CanvasContext.setFontSize(number fontSize)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html)
  11489. *
  11490. * 在插件中使用:支持
  11491. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.font](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11492. *
  11493. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11494. *
  11495. * 设置字体的字号
  11496. *
  11497. * **示例代码**
  11498. *
  11499. * ```javascript
  11500. const ctx = wx.createCanvasContext('myCanvas')
  11501. ctx.setFontSize(20)
  11502. ctx.fillText('20', 20, 20)
  11503. ctx.setFontSize(30)
  11504. ctx.fillText('30', 40, 40)
  11505. ctx.setFontSize(40)
  11506. ctx.fillText('40', 60, 60)
  11507. ctx.setFontSize(50)
  11508. ctx.fillText('50', 90, 90)
  11509. ctx.draw()
  11510. ```
  11511. * ![](@program/dev/image/canvas/font-size.png) */
  11512. setFontSize(
  11513. /** 字体的字号 */
  11514. fontSize: number
  11515. ): void
  11516. /** [CanvasContext.setGlobalAlpha(number alpha)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html)
  11517. *
  11518. * 在插件中使用:支持
  11519. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.globalAlpha](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11520. *
  11521. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11522. *
  11523. * 设置全局画笔透明度。
  11524. *
  11525. * **示例代码**
  11526. *
  11527. * ```javascript
  11528. const ctx = wx.createCanvasContext('myCanvas')
  11529. ctx.setFillStyle('red')
  11530. ctx.fillRect(10, 10, 150, 100)
  11531. ctx.setGlobalAlpha(0.2)
  11532. ctx.setFillStyle('blue')
  11533. ctx.fillRect(50, 50, 150, 100)
  11534. ctx.setFillStyle('yellow')
  11535. ctx.fillRect(100, 100, 150, 100)
  11536. ctx.draw()
  11537. ```
  11538. * ![](@program/dev/image/canvas/global-alpha.png) */
  11539. setGlobalAlpha(
  11540. /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
  11541. alpha: number
  11542. ): void
  11543. /** [CanvasContext.setLineCap(string lineCap)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)
  11544. *
  11545. * 在插件中使用:支持
  11546. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineCap](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11547. *
  11548. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11549. *
  11550. * 设置线条的端点样式
  11551. *
  11552. * **示例代码**
  11553. *
  11554. * ```javascript
  11555. const ctx = wx.createCanvasContext('myCanvas')
  11556. ctx.beginPath()
  11557. ctx.moveTo(10, 10)
  11558. ctx.lineTo(150, 10)
  11559. ctx.stroke()
  11560. ctx.beginPath()
  11561. ctx.setLineCap('butt')
  11562. ctx.setLineWidth(10)
  11563. ctx.moveTo(10, 30)
  11564. ctx.lineTo(150, 30)
  11565. ctx.stroke()
  11566. ctx.beginPath()
  11567. ctx.setLineCap('round')
  11568. ctx.setLineWidth(10)
  11569. ctx.moveTo(10, 50)
  11570. ctx.lineTo(150, 50)
  11571. ctx.stroke()
  11572. ctx.beginPath()
  11573. ctx.setLineCap('square')
  11574. ctx.setLineWidth(10)
  11575. ctx.moveTo(10, 70)
  11576. ctx.lineTo(150, 70)
  11577. ctx.stroke()
  11578. ctx.draw()
  11579. ```
  11580. * ![](@program/dev/image/canvas/line-cap.png) */
  11581. setLineCap(
  11582. /** 线条的结束端点样式
  11583. *
  11584. * 参数 lineCap 可选值:
  11585. * - 'butt': 向线条的每个末端添加平直的边缘。;
  11586. * - 'round': 向线条的每个末端添加圆形线帽。;
  11587. * - 'square': 向线条的每个末端添加正方形线帽。; */
  11588. lineCap: 'butt' | 'round' | 'square'
  11589. ): void
  11590. /** [CanvasContext.setLineDash(Array.&lt;number&gt; pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html)
  11591. *
  11592. * 需要基础库: `1.6.0`
  11593. *
  11594. * 在插件中使用:支持
  11595. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineDashOffset](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11596. *
  11597. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11598. *
  11599. * 设置虚线样式。
  11600. *
  11601. * **示例代码**
  11602. *
  11603. * ```javascript
  11604. const ctx = wx.createCanvasContext('myCanvas')
  11605. ctx.setLineDash([10, 20], 5);
  11606. ctx.beginPath();
  11607. ctx.moveTo(0,100);
  11608. ctx.lineTo(400, 100);
  11609. ctx.stroke();
  11610. ctx.draw()
  11611. ```
  11612. * ![](@program/dev/image/canvas/set-line-dash.png) */
  11613. setLineDash(
  11614. /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */
  11615. pattern: number[],
  11616. /** 虚线偏移量 */
  11617. offset: number
  11618. ): void
  11619. /** [CanvasContext.setLineJoin(string lineJoin)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)
  11620. *
  11621. * 在插件中使用:支持
  11622. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineJoin](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11623. *
  11624. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11625. *
  11626. * 设置线条的交点样式
  11627. *
  11628. * **示例代码**
  11629. *
  11630. * ```javascript
  11631. const ctx = wx.createCanvasContext('myCanvas')
  11632. ctx.beginPath()
  11633. ctx.moveTo(10, 10)
  11634. ctx.lineTo(100, 50)
  11635. ctx.lineTo(10, 90)
  11636. ctx.stroke()
  11637. ctx.beginPath()
  11638. ctx.setLineJoin('bevel')
  11639. ctx.setLineWidth(10)
  11640. ctx.moveTo(50, 10)
  11641. ctx.lineTo(140, 50)
  11642. ctx.lineTo(50, 90)
  11643. ctx.stroke()
  11644. ctx.beginPath()
  11645. ctx.setLineJoin('round')
  11646. ctx.setLineWidth(10)
  11647. ctx.moveTo(90, 10)
  11648. ctx.lineTo(180, 50)
  11649. ctx.lineTo(90, 90)
  11650. ctx.stroke()
  11651. ctx.beginPath()
  11652. ctx.setLineJoin('miter')
  11653. ctx.setLineWidth(10)
  11654. ctx.moveTo(130, 10)
  11655. ctx.lineTo(220, 50)
  11656. ctx.lineTo(130, 90)
  11657. ctx.stroke()
  11658. ctx.draw()
  11659. ```
  11660. * ![](@program/dev/image/canvas/line-join.png) */
  11661. setLineJoin(
  11662. /** 线条的结束交点样式
  11663. *
  11664. * 参数 lineJoin 可选值:
  11665. * - 'bevel': 斜角;
  11666. * - 'round': 圆角;
  11667. * - 'miter': 尖角; */
  11668. lineJoin: 'bevel' | 'round' | 'miter'
  11669. ): void
  11670. /** [CanvasContext.setLineWidth(number lineWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)
  11671. *
  11672. * 在插件中使用:支持
  11673. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineWidth](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11674. *
  11675. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11676. *
  11677. * 设置线条的宽度
  11678. *
  11679. * **示例代码**
  11680. *
  11681. * ```javascript
  11682. const ctx = wx.createCanvasContext('myCanvas')
  11683. ctx.beginPath()
  11684. ctx.moveTo(10, 10)
  11685. ctx.lineTo(150, 10)
  11686. ctx.stroke()
  11687. ctx.beginPath()
  11688. ctx.setLineWidth(5)
  11689. ctx.moveTo(10, 30)
  11690. ctx.lineTo(150, 30)
  11691. ctx.stroke()
  11692. ctx.beginPath()
  11693. ctx.setLineWidth(10)
  11694. ctx.moveTo(10, 50)
  11695. ctx.lineTo(150, 50)
  11696. ctx.stroke()
  11697. ctx.beginPath()
  11698. ctx.setLineWidth(15)
  11699. ctx.moveTo(10, 70)
  11700. ctx.lineTo(150, 70)
  11701. ctx.stroke()
  11702. ctx.draw()
  11703. ```
  11704. *
  11705. * ![](@program/dev/image/canvas/line-width.png) */
  11706. setLineWidth(
  11707. /** 线条的宽度,单位px */
  11708. lineWidth: number
  11709. ): void
  11710. /** [CanvasContext.setMiterLimit(number miterLimit)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)
  11711. *
  11712. * 在插件中使用:支持
  11713. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.miterLimit](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11714. *
  11715. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11716. *
  11717. * 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
  11718. *
  11719. * **示例代码**
  11720. *
  11721. * ```javascript
  11722. const ctx = wx.createCanvasContext('myCanvas')
  11723. ctx.beginPath()
  11724. ctx.setLineWidth(10)
  11725. ctx.setLineJoin('miter')
  11726. ctx.setMiterLimit(1)
  11727. ctx.moveTo(10, 10)
  11728. ctx.lineTo(100, 50)
  11729. ctx.lineTo(10, 90)
  11730. ctx.stroke()
  11731. ctx.beginPath()
  11732. ctx.setLineWidth(10)
  11733. ctx.setLineJoin('miter')
  11734. ctx.setMiterLimit(2)
  11735. ctx.moveTo(50, 10)
  11736. ctx.lineTo(140, 50)
  11737. ctx.lineTo(50, 90)
  11738. ctx.stroke()
  11739. ctx.beginPath()
  11740. ctx.setLineWidth(10)
  11741. ctx.setLineJoin('miter')
  11742. ctx.setMiterLimit(3)
  11743. ctx.moveTo(90, 10)
  11744. ctx.lineTo(180, 50)
  11745. ctx.lineTo(90, 90)
  11746. ctx.stroke()
  11747. ctx.beginPath()
  11748. ctx.setLineWidth(10)
  11749. ctx.setLineJoin('miter')
  11750. ctx.setMiterLimit(4)
  11751. ctx.moveTo(130, 10)
  11752. ctx.lineTo(220, 50)
  11753. ctx.lineTo(130, 90)
  11754. ctx.stroke()
  11755. ctx.draw()
  11756. ```
  11757. * ![](@program/dev/image/canvas/miter-limit.png) */
  11758. setMiterLimit(
  11759. /** 最大斜接长度 */
  11760. miterLimit: number
  11761. ): void
  11762. /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html)
  11763. *
  11764. * 在插件中使用:支持
  11765. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.shadowOffsetX|CanvasContext.shadowOffsetY|CanvasContext.shadowColor|CanvasContext.shadowBlur](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11766. *
  11767. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11768. *
  11769. * 设定阴影样式。
  11770. *
  11771. * **示例代码**
  11772. *
  11773. * ```javascript
  11774. const ctx = wx.createCanvasContext('myCanvas')
  11775. ctx.setFillStyle('red')
  11776. ctx.setShadow(10, 50, 50, 'blue')
  11777. ctx.fillRect(10, 10, 150, 75)
  11778. ctx.draw()
  11779. ```
  11780. * ![](@program/dev/image/canvas/shadow.png) */
  11781. setShadow(
  11782. /** 阴影相对于形状在水平方向的偏移,默认值为 0。 */
  11783. offsetX: number,
  11784. /** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */
  11785. offsetY: number,
  11786. /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */
  11787. blur: number,
  11788. /** 阴影的颜色。默认值为 black。 */
  11789. color: string
  11790. ): void
  11791. /** [CanvasContext.setStrokeStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)
  11792. *
  11793. * 在插件中使用:支持
  11794. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.strokeStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  11795. *
  11796. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11797. *
  11798. * 设置描边颜色。
  11799. *
  11800. * **代码示例**
  11801. *
  11802. * ```js
  11803. const ctx = wx.createCanvasContext('myCanvas')
  11804. ctx.setStrokeStyle('red')
  11805. ctx.strokeRect(10, 10, 150, 75)
  11806. ctx.draw()
  11807. ```
  11808. * ![](@program/dev/image/canvas/stroke-rect.png) */
  11809. setStrokeStyle(
  11810. /** 描边的颜色,默认颜色为 black。 */
  11811. color: string | CanvasGradient
  11812. ): void
  11813. /** [CanvasContext.setTextAlign(string align)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html)
  11814. *
  11815. * 需要基础库: `1.1.0`
  11816. *
  11817. * 在插件中使用:支持
  11818. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11819. *
  11820. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11821. *
  11822. * 设置文字的对齐
  11823. *
  11824. * **示例代码**
  11825. *
  11826. * ```javascript
  11827. const ctx = wx.createCanvasContext('myCanvas')
  11828. ctx.setStrokeStyle('red')
  11829. ctx.moveTo(150, 20)
  11830. ctx.lineTo(150, 170)
  11831. ctx.stroke()
  11832. ctx.setFontSize(15)
  11833. ctx.setTextAlign('left')
  11834. ctx.fillText('textAlign=left', 150, 60)
  11835. ctx.setTextAlign('center')
  11836. ctx.fillText('textAlign=center', 150, 80)
  11837. ctx.setTextAlign('right')
  11838. ctx.fillText('textAlign=right', 150, 100)
  11839. ctx.draw()
  11840. ```
  11841. *
  11842. * ![](@program/dev/image/canvas/set-text-align.png) */
  11843. setTextAlign(
  11844. /** 文字的对齐方式
  11845. *
  11846. * 参数 align 可选值:
  11847. * - 'left': 左对齐;
  11848. * - 'center': 居中对齐;
  11849. * - 'right': 右对齐; */
  11850. align: 'left' | 'center' | 'right'
  11851. ): void
  11852. /** [CanvasContext.setTextBaseline(string textBaseline)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html)
  11853. *
  11854. * 需要基础库: `1.4.0`
  11855. *
  11856. * 在插件中使用:支持
  11857. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11858. *
  11859. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11860. *
  11861. * 设置文字的竖直对齐
  11862. *
  11863. * **示例代码**
  11864. *
  11865. * ```javascript
  11866. const ctx = wx.createCanvasContext('myCanvas')
  11867. ctx.setStrokeStyle('red')
  11868. ctx.moveTo(5, 75)
  11869. ctx.lineTo(295, 75)
  11870. ctx.stroke()
  11871. ctx.setFontSize(20)
  11872. ctx.setTextBaseline('top')
  11873. ctx.fillText('top', 5, 75)
  11874. ctx.setTextBaseline('middle')
  11875. ctx.fillText('middle', 50, 75)
  11876. ctx.setTextBaseline('bottom')
  11877. ctx.fillText('bottom', 120, 75)
  11878. ctx.setTextBaseline('normal')
  11879. ctx.fillText('normal', 200, 75)
  11880. ctx.draw()
  11881. ```
  11882. * ![](@program/dev/image/canvas/set-text-baseline.png) */
  11883. setTextBaseline(
  11884. /** 文字的竖直对齐方式
  11885. *
  11886. * 参数 textBaseline 可选值:
  11887. * - 'top': 顶部对齐;
  11888. * - 'bottom': 底部对齐;
  11889. * - 'middle': 居中对齐;
  11890. * - 'normal': ; */
  11891. textBaseline: 'top' | 'bottom' | 'middle' | 'normal'
  11892. ): void
  11893. /** [CanvasContext.setTransform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html)
  11894. *
  11895. * 需要基础库: `1.9.90`
  11896. *
  11897. * 在插件中使用:支持
  11898. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11899. *
  11900. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11901. *
  11902. * 使用矩阵重新设置(覆盖)当前变换的方法 */
  11903. setTransform(
  11904. /** 水平缩放 */
  11905. scaleX: number,
  11906. /** 水平倾斜 */
  11907. skewX: number,
  11908. /** 垂直倾斜 */
  11909. skewY: number,
  11910. /** 垂直缩放 */
  11911. scaleY: number,
  11912. /** 水平移动 */
  11913. translateX: number,
  11914. /** 垂直移动 */
  11915. translateY: number
  11916. ): void
  11917. /** [CanvasContext.stroke()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html)
  11918. *
  11919. * 在插件中使用:支持
  11920. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11921. *
  11922. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11923. *
  11924. * 画出当前路径的边框。默认颜色色为黑色。
  11925. *
  11926. * **示例代码**
  11927. *
  11928. * ```javascript
  11929. const ctx = wx.createCanvasContext('myCanvas')
  11930. ctx.moveTo(10, 10)
  11931. ctx.lineTo(100, 10)
  11932. ctx.lineTo(100, 100)
  11933. ctx.stroke()
  11934. ctx.draw()
  11935. ```
  11936. * ![](@program/dev/image/canvas/stroke-line.png)
  11937. *
  11938. * stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。
  11939. *
  11940. * ```javascript
  11941. const ctx = wx.createCanvasContext('myCanvas')
  11942. // begin path
  11943. ctx.rect(10, 10, 100, 30)
  11944. ctx.setStrokeStyle('yellow')
  11945. ctx.stroke()
  11946. // begin another path
  11947. ctx.beginPath()
  11948. ctx.rect(10, 40, 100, 30)
  11949. // only stoke this rect, not in current path
  11950. ctx.setStrokeStyle('blue')
  11951. ctx.strokeRect(10, 70, 100, 30)
  11952. ctx.rect(10, 100, 100, 30)
  11953. // it will stroke current path
  11954. ctx.setStrokeStyle('red')
  11955. ctx.stroke()
  11956. ctx.draw()
  11957. ```
  11958. *
  11959. * ![](@program/dev/image/canvas/stroke-path.png) */
  11960. stroke(): void
  11961. /** [CanvasContext.strokeRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeRect.html)
  11962. *
  11963. * 在插件中使用:支持
  11964. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11965. *
  11966. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11967. *
  11968. * 画一个矩形(非填充)。 用 [`setStrokeStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) 设置矩形线条的颜色,如果没设置默认是黑色。
  11969. *
  11970. * **示例代码**
  11971. *
  11972. * ```javascript
  11973. const ctx = wx.createCanvasContext('myCanvas')
  11974. ctx.setStrokeStyle('red')
  11975. ctx.strokeRect(10, 10, 150, 75)
  11976. ctx.draw()
  11977. ```
  11978. * ![](@program/dev/image/canvas/stroke-rect.png) */
  11979. strokeRect(
  11980. /** 矩形路径左上角的横坐标 */
  11981. x: number,
  11982. /** 矩形路径左上角的纵坐标 */
  11983. y: number,
  11984. /** 矩形路径的宽度 */
  11985. width: number,
  11986. /** 矩形路径的高度 */
  11987. height: number
  11988. ): void
  11989. /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html)
  11990. *
  11991. * 需要基础库: `1.9.90`
  11992. *
  11993. * 在插件中使用:支持
  11994. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  11995. *
  11996. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  11997. *
  11998. * 给定的 (x, y) 位置绘制文本描边的方法 */
  11999. strokeText(
  12000. /** 要绘制的文本 */
  12001. text: string,
  12002. /** 文本起始点的 x 轴坐标 */
  12003. x: number,
  12004. /** 文本起始点的 y 轴坐标 */
  12005. y: number,
  12006. /** 需要绘制的最大宽度,可选 */
  12007. maxWidth?: number
  12008. ): void
  12009. /** [CanvasContext.transform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html)
  12010. *
  12011. * 需要基础库: `1.9.90`
  12012. *
  12013. * 在插件中使用:支持
  12014. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  12015. *
  12016. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  12017. *
  12018. * 使用矩阵多次叠加当前变换的方法 */
  12019. transform(
  12020. /** 水平缩放 */
  12021. scaleX: number,
  12022. /** 水平倾斜 */
  12023. skewX: number,
  12024. /** 垂直倾斜 */
  12025. skewY: number,
  12026. /** 垂直缩放 */
  12027. scaleY: number,
  12028. /** 水平移动 */
  12029. translateX: number,
  12030. /** 垂直移动 */
  12031. translateY: number
  12032. ): void
  12033. /** [CanvasContext.translate(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html)
  12034. *
  12035. * 在插件中使用:支持
  12036. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  12037. *
  12038. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  12039. *
  12040. * 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
  12041. *
  12042. * **示例代码**
  12043. *
  12044. * ```javascript
  12045. const ctx = wx.createCanvasContext('myCanvas')
  12046. ctx.strokeRect(10, 10, 150, 100)
  12047. ctx.translate(20, 20)
  12048. ctx.strokeRect(10, 10, 150, 100)
  12049. ctx.translate(20, 20)
  12050. ctx.strokeRect(10, 10, 150, 100)
  12051. ctx.draw()
  12052. ```
  12053. *
  12054. * ![](@program/dev/image/canvas/translate.png) */
  12055. translate(
  12056. /** 水平坐标平移量 */
  12057. x: number,
  12058. /** 竖直坐标平移量 */
  12059. y: number
  12060. ): void
  12061. /** [Object CanvasContext.measureText(string text)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html)
  12062. *
  12063. * 需要基础库: `1.9.90`
  12064. *
  12065. * 在插件中使用:支持
  12066. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  12067. *
  12068. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  12069. *
  12070. * 测量文本尺寸信息。目前仅返回文本宽度。同步接口。 */
  12071. measureText(
  12072. /** 要测量的文本 */
  12073. text: string
  12074. ): TextMetrics
  12075. /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createCircularGradient(number x, number y, number r)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html)
  12076. *
  12077. * 在插件中使用:支持
  12078. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  12079. *
  12080. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  12081. *
  12082. * 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
  12083. *
  12084. * **示例代码**
  12085. *
  12086. * ```javascript
  12087. const ctx = wx.createCanvasContext('myCanvas')
  12088. // Create circular gradient
  12089. const grd = ctx.createCircularGradient(75, 50, 50)
  12090. grd.addColorStop(0, 'red')
  12091. grd.addColorStop(1, 'white')
  12092. // Fill with gradient
  12093. ctx.setFillStyle(grd)
  12094. ctx.fillRect(10, 10, 150, 80)
  12095. ctx.draw()
  12096. ```
  12097. * ![](@program/dev/image/canvas/circular-gradient.png) */
  12098. createCircularGradient(
  12099. /** 圆心的 x 坐标 */
  12100. x: number,
  12101. /** 圆心的 y 坐标 */
  12102. y: number,
  12103. /** 圆的半径 */
  12104. r: number
  12105. ): CanvasGradient
  12106. /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createLinearGradient(number x0, number y0, number x1, number y1)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html)
  12107. *
  12108. * 在插件中使用:支持
  12109. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  12110. *
  12111. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  12112. *
  12113. * 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
  12114. *
  12115. * **示例代码**
  12116. *
  12117. * ```javascript
  12118. const ctx = wx.createCanvasContext('myCanvas')
  12119. // Create linear gradient
  12120. const grd = ctx.createLinearGradient(0, 0, 200, 0)
  12121. grd.addColorStop(0, 'red')
  12122. grd.addColorStop(1, 'white')
  12123. // Fill with gradient
  12124. ctx.setFillStyle(grd)
  12125. ctx.fillRect(10, 10, 150, 80)
  12126. ctx.draw()
  12127. ```
  12128. * ![](@program/dev/image/canvas/linear-gradient.png) */
  12129. createLinearGradient(
  12130. /** 起点的 x 坐标 */
  12131. x0: number,
  12132. /** 起点的 y 坐标 */
  12133. y0: number,
  12134. /** 终点的 x 坐标 */
  12135. x1: number,
  12136. /** 终点的 y 坐标 */
  12137. y1: number
  12138. ): CanvasGradient
  12139. }
  12140. interface CanvasGradient {
  12141. /** [CanvasGradient.addColorStop(number stop, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html)
  12142. *
  12143. * 在插件中使用:不支持
  12144. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  12145. *
  12146. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  12147. *
  12148. * 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染
  12149. *
  12150. * **示例代码**
  12151. *
  12152. * ```js
  12153. const ctx = wx.createCanvasContext('myCanvas')
  12154. // Create circular gradient
  12155. const grd = ctx.createLinearGradient(30, 10, 120, 10)
  12156. grd.addColorStop(0, 'red')
  12157. grd.addColorStop(0.16, 'orange')
  12158. grd.addColorStop(0.33, 'yellow')
  12159. grd.addColorStop(0.5, 'green')
  12160. grd.addColorStop(0.66, 'cyan')
  12161. grd.addColorStop(0.83, 'blue')
  12162. grd.addColorStop(1, 'purple')
  12163. // Fill with gradient
  12164. ctx.setFillStyle(grd)
  12165. ctx.fillRect(10, 10, 150, 80)
  12166. ctx.draw()
  12167. ```
  12168. * ![](@program/dev/image/canvas/color-stop.png) */
  12169. addColorStop(
  12170. /** 表示渐变中开始与结束之间的位置,范围 0-1。 */
  12171. stop: number,
  12172. /** 渐变点的颜色。 */
  12173. color: string
  12174. ): void
  12175. }
  12176. interface CloseSyncError {
  12177. /** 错误信息
  12178. *
  12179. * | 错误信息 | 说明 |
  12180. * | - | - |
  12181. * | bad file descriptor | 无效的文件描述符 | */ errMsg: string
  12182. /** 错误码
  12183. *
  12184. * | 错误信息 | 说明 |
  12185. * | - | - |
  12186. * | bad file descriptor | 无效的文件描述符 | */ errCode: number
  12187. }
  12188. interface Console {
  12189. /** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html)
  12190. *
  12191. * 在插件中使用:不支持
  12192. *
  12193. * 向调试面板中打印 debug 日志 */
  12194. debug(
  12195. /** 日志内容,可以有任意多个。 */
  12196. ...args: any[]
  12197. ): void
  12198. /** [console.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html)
  12199. *
  12200. * 在插件中使用:不支持
  12201. *
  12202. * 向调试面板中打印 error 日志 */
  12203. error(
  12204. /** 日志内容,可以有任意多个。 */
  12205. ...args: any[]
  12206. ): void
  12207. /** [console.group(string label)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html)
  12208. *
  12209. * 在插件中使用:不支持
  12210. *
  12211. * 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)之后分组结束。
  12212. *
  12213. * **注意**
  12214. *
  12215. * 仅在工具中有效,在 vConsole 中为空函数实现。 */
  12216. group(
  12217. /** 分组标记,可选。 */
  12218. label?: string
  12219. ): void
  12220. /** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)
  12221. *
  12222. * 在插件中使用:不支持
  12223. *
  12224. * 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) 创建的分组
  12225. *
  12226. * **注意**
  12227. *
  12228. * 仅在工具中有效,在 vConsole 中为空函数实现。 */
  12229. groupEnd(): void
  12230. /** [console.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html)
  12231. *
  12232. * 在插件中使用:不支持
  12233. *
  12234. * 向调试面板中打印 info 日志 */
  12235. info(
  12236. /** 日志内容,可以有任意多个。 */
  12237. ...args: any[]
  12238. ): void
  12239. /** [console.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html)
  12240. *
  12241. * 在插件中使用:不支持
  12242. *
  12243. * 向调试面板中打印 log 日志 */
  12244. log(
  12245. /** 日志内容,可以有任意多个。 */
  12246. ...args: any[]
  12247. ): void
  12248. /** [console.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html)
  12249. *
  12250. * 在插件中使用:不支持
  12251. *
  12252. * 向调试面板中打印 warn 日志 */
  12253. warn(
  12254. /** 日志内容,可以有任意多个。 */
  12255. ...args: any[]
  12256. ): void
  12257. }
  12258. interface DownloadTask {
  12259. /** [DownloadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html)
  12260. *
  12261. * 需要基础库: `1.4.0`
  12262. *
  12263. * 在插件中使用:支持
  12264. *
  12265. * 中断下载任务 */
  12266. abort(): void
  12267. /** [DownloadTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html)
  12268. *
  12269. * 需要基础库: `2.1.0`
  12270. *
  12271. * 在插件中使用:支持
  12272. *
  12273. * 移除 HTTP Response Header 事件的监听函数
  12274. *
  12275. * **示例代码**
  12276. *
  12277. * ```js
  12278. const listener = function (res) { console.log(res) }
  12279. DownloadTask.onHeadersReceived(listener)
  12280. DownloadTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
  12281. ``` */
  12282. offHeadersReceived(
  12283. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  12284. listener?: OffHeadersReceivedCallback
  12285. ): void
  12286. /** [DownloadTask.offProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html)
  12287. *
  12288. * 需要基础库: `2.1.0`
  12289. *
  12290. * 在插件中使用:支持
  12291. *
  12292. * 移除下载进度变化事件的监听函数
  12293. *
  12294. * **示例代码**
  12295. *
  12296. * ```js
  12297. const listener = function (res) { console.log(res) }
  12298. DownloadTask.onProgressUpdate(listener)
  12299. DownloadTask.offProgressUpdate(listener) // 需传入与监听时同一个的函数对象
  12300. ``` */
  12301. offProgressUpdate(
  12302. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  12303. listener?: DownloadTaskOffProgressUpdateCallback
  12304. ): void
  12305. /** [DownloadTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html)
  12306. *
  12307. * 需要基础库: `2.1.0`
  12308. *
  12309. * 在插件中使用:支持
  12310. *
  12311. * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
  12312. onHeadersReceived(
  12313. /** HTTP Response Header 事件的监听函数 */
  12314. listener: OnHeadersReceivedCallback
  12315. ): void
  12316. /** [DownloadTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html)
  12317. *
  12318. * 需要基础库: `1.4.0`
  12319. *
  12320. * 在插件中使用:支持
  12321. *
  12322. * 监听下载进度变化事件 */
  12323. onProgressUpdate(
  12324. /** 下载进度变化事件的监听函数 */
  12325. listener: DownloadTaskOnProgressUpdateCallback
  12326. ): void
  12327. }
  12328. interface EditorContext {
  12329. /** [EditorContext.blur(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.blur.html)
  12330. *
  12331. * 需要基础库: `2.8.3`
  12332. *
  12333. * 在插件中使用:支持
  12334. *
  12335. * 编辑器失焦,同时收起键盘。 */
  12336. blur(option?: BlurOption): void
  12337. /** [EditorContext.clear(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.clear.html)
  12338. *
  12339. * 需要基础库: `2.7.0`
  12340. *
  12341. * 在插件中使用:支持
  12342. *
  12343. * 清空编辑器内容 */
  12344. clear(option?: ClearOption): void
  12345. /** [EditorContext.format(string name, string value)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.format.html)
  12346. *
  12347. * 需要基础库: `2.7.0`
  12348. *
  12349. * 在插件中使用:支持
  12350. *
  12351. * 修改样式
  12352. *
  12353. * ****
  12354. *
  12355. * ## 支持设置的样式列表
  12356. * | name | value | verson |
  12357. * | --------------------------------------------------------- | ------------------------------- | ------ |
  12358. * | bold | | 2.7.0 |
  12359. * | italic | | 2.7.0 |
  12360. * | underline | | 2.7.0 |
  12361. * | strike | | 2.7.0 |
  12362. * | ins | | 2.7.0 |
  12363. * | script | sub / super | 2.7.0 |
  12364. * | header | H1 / H2 / h3 / H4 / h5 / H6 | 2.7.0 |
  12365. * | align | left / center / right / justify | 2.7.0 |
  12366. * | direction | rtl | 2.7.0 |
  12367. * | indent | -1 / +1 | 2.7.0 |
  12368. * | list | ordered / bullet / check | 2.7.0 |
  12369. * | color | hex color | 2.7.0 |
  12370. * | backgroundColor | hex color | 2.7.0 |
  12371. * | margin/marginTop/marginBottom/marginLeft/marginRight | css style | 2.7.0 |
  12372. * | padding/paddingTop/paddingBottom/paddingLeft/paddingRight | css style | 2.7.0 |
  12373. * | font/fontSize/fontStyle/fontVariant/fontWeight/fontFamily | css style | 2.7.0 |
  12374. * | lineHeight | css style | 2.7.0 |
  12375. * | letterSpacing | css style | 2.7.0 |
  12376. * | textDecoration | css style | 2.7.0 |
  12377. * | textIndent | css style | 2.8.0 |
  12378. * | wordWrap | css style | 2.10.2 |
  12379. * | wordBreak | css style | 2.10.2 |
  12380. * | whiteSpace | css style | 2.10.2 |
  12381. *
  12382. * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。 */
  12383. format(
  12384. /** 属性 */
  12385. name: string,
  12386. /** 值 */
  12387. value?: string
  12388. ): void
  12389. /** [EditorContext.getContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html)
  12390. *
  12391. * 需要基础库: `2.7.0`
  12392. *
  12393. * 在插件中使用:支持
  12394. *
  12395. * 获取编辑器内容 */
  12396. getContents(option?: GetContentsOption): void
  12397. /** [EditorContext.getSelectionText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html)
  12398. *
  12399. * 需要基础库: `2.10.2`
  12400. *
  12401. * 在插件中使用:支持
  12402. *
  12403. * 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。 */
  12404. getSelectionText(option?: GetSelectionTextOption): void
  12405. /** [EditorContext.insertDivider(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html)
  12406. *
  12407. * 需要基础库: `2.7.0`
  12408. *
  12409. * 在插件中使用:支持
  12410. *
  12411. * 插入分割线 */
  12412. insertDivider(option?: InsertDividerOption): void
  12413. /** [EditorContext.insertImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertImage.html)
  12414. *
  12415. * 需要基础库: `2.7.0`
  12416. *
  12417. * 在插件中使用:支持
  12418. *
  12419. * 插入图片。
  12420. *
  12421. * 地址为临时文件时,获取的编辑器html格式内容中 <img> 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
  12422. *
  12423. * 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉 <img> 的 src 值,对于 delta 内容应替换掉 `insert { image: abc }` 值。
  12424. *
  12425. * **示例代码**
  12426. *
  12427. * ```javascript
  12428. this.editorCtx.insertImage({
  12429. src: 'xx',
  12430. width: '100px',
  12431. height: '50px',
  12432. extClass: className
  12433. })
  12434. ``` */
  12435. insertImage(option: InsertImageOption): void
  12436. /** [EditorContext.insertText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertText.html)
  12437. *
  12438. * 需要基础库: `2.7.0`
  12439. *
  12440. * 在插件中使用:支持
  12441. *
  12442. * 覆盖当前选区,设置一段文本 */
  12443. insertText(option: InsertTextOption): void
  12444. /** [EditorContext.redo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.redo.html)
  12445. *
  12446. * 需要基础库: `2.7.0`
  12447. *
  12448. * 在插件中使用:支持
  12449. *
  12450. * 恢复 */
  12451. redo(option?: RedoOption): void
  12452. /** [EditorContext.removeFormat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.removeFormat.html)
  12453. *
  12454. * 需要基础库: `2.7.0`
  12455. *
  12456. * 在插件中使用:支持
  12457. *
  12458. * 清除当前选区的样式 */
  12459. removeFormat(option?: RemoveFormatOption): void
  12460. /** [EditorContext.scrollIntoView()](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.scrollIntoView.html)
  12461. *
  12462. * 需要基础库: `2.8.3`
  12463. *
  12464. * 在插件中使用:支持
  12465. *
  12466. * 使得编辑器光标处滚动到窗口可视区域内。 */
  12467. scrollIntoView(): void
  12468. /** [EditorContext.setContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setContents.html)
  12469. *
  12470. * 需要基础库: `2.7.0`
  12471. *
  12472. * 在插件中使用:支持
  12473. *
  12474. * 初始化编辑器内容,html和delta同时存在时仅delta生效 */
  12475. setContents(option: SetContentsOption): void
  12476. /** [EditorContext.undo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.undo.html)
  12477. *
  12478. * 需要基础库: `2.7.0`
  12479. *
  12480. * 在插件中使用:支持
  12481. *
  12482. * 撤销 */
  12483. undo(option?: UndoOption): void
  12484. }
  12485. interface EntryList {
  12486. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntries.html)
  12487. *
  12488. * 需要基础库: `2.11.0`
  12489. *
  12490. * 在插件中使用:不支持
  12491. *
  12492. * 该方法返回当前列表中的所有性能数据 */
  12493. getEntries(): PerformanceEntry[]
  12494. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByName.html)
  12495. *
  12496. * 需要基础库: `2.11.0`
  12497. *
  12498. * 在插件中使用:不支持
  12499. *
  12500. * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据 */
  12501. getEntriesByName(
  12502. name: string,
  12503. entryType?: string
  12504. ): PerformanceEntry[]
  12505. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByType.html)
  12506. *
  12507. * 需要基础库: `2.11.0`
  12508. *
  12509. * 在插件中使用:不支持
  12510. *
  12511. * 获取当前列表中所有类型为 [entryType] 的性能数据 */
  12512. getEntriesByType(entryType: string): PerformanceEntry[]
  12513. }
  12514. interface EventChannel {
  12515. /** [EventChannel.emit(string eventName, any args)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.emit.html)
  12516. *
  12517. * 需要基础库: `2.7.3`
  12518. *
  12519. * 在插件中使用:支持
  12520. *
  12521. * 触发一个事件 */
  12522. emit(
  12523. /** 事件名称 */
  12524. eventName: string,
  12525. /** 事件参数 */
  12526. ...args: any
  12527. ): void
  12528. /** [EventChannel.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html)
  12529. *
  12530. * 需要基础库: `2.7.3`
  12531. *
  12532. * 在插件中使用:支持
  12533. *
  12534. * 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数 */
  12535. off(
  12536. /** 事件名称 */
  12537. eventName: string,
  12538. /** 事件监听函数 */
  12539. fn: EventCallback
  12540. ): void
  12541. /** [EventChannel.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html)
  12542. *
  12543. * 需要基础库: `2.7.3`
  12544. *
  12545. * 在插件中使用:支持
  12546. *
  12547. * 持续监听一个事件 */
  12548. on(
  12549. /** 事件名称 */
  12550. eventName: string,
  12551. /** 事件监听函数 */
  12552. fn: EventCallback
  12553. ): void
  12554. /** [EventChannel.once(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html)
  12555. *
  12556. * 需要基础库: `2.7.3`
  12557. *
  12558. * 在插件中使用:支持
  12559. *
  12560. * 监听一个事件一次,触发后失效 */
  12561. once(
  12562. /** 事件名称 */
  12563. eventName: string,
  12564. /** 事件监听函数 */
  12565. fn: EventCallback
  12566. ): void
  12567. }
  12568. interface FileSystemManager {
  12569. /** [Array.&lt;string&gt; FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html)
  12570. *
  12571. * 在插件中使用:需要基础库 `2.19.2`
  12572. *
  12573. * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本
  12574. *
  12575. * **注意事项</title>
  12576. * - readdir接口无法访问文件系统根路径(wxfile://)。
  12577. * <title>示例代码**
  12578. *
  12579. * ```js
  12580. const fs = wx.getFileSystemManager()
  12581. fs.readdir({
  12582. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  12583. success(res) {
  12584. console.log(res.files)
  12585. },
  12586. fail(res) {
  12587. console.error(res)
  12588. }
  12589. })
  12590. // 同步接口
  12591. try {
  12592. const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`)
  12593. console.log(res)
  12594. } catch(e) {
  12595. console.error(e)
  12596. }
  12597. ``` */
  12598. readdirSync(
  12599. /** 要读取的目录路径 (本地路径) */
  12600. dirPath: string
  12601. ): string[]
  12602. /** [ArrayBuffer FileSystemManager.readCompressedFileSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readCompressedFileSync.html)
  12603. *
  12604. * 需要基础库: `2.21.1`
  12605. *
  12606. * 在插件中使用:不支持
  12607. *
  12608. * 同步读取指定压缩类型的本地文件内容
  12609. *
  12610. * **示例代码**
  12611. *
  12612. * ```js
  12613. const fs = wx.getFileSystemManager()
  12614. // 异步接口
  12615. fs.readCompressedFile({
  12616. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  12617. compressionAlgorithm: 'br',
  12618. success(res) {
  12619. console.log(res.data)
  12620. },
  12621. fail(res) {
  12622. console.log('readCompressedFile fail', res)
  12623. }
  12624. })
  12625. // 同步接口
  12626. try {
  12627. const data = fs.readCompressedFileSync({
  12628. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  12629. compressionAlgorithm: 'br',
  12630. })
  12631. console.log(data)
  12632. } catch (err) {
  12633. console.log(err)
  12634. }
  12635. ``` */
  12636. readCompressedFileSync(
  12637. option: ReadCompressedFileSyncOption
  12638. ): ArrayBuffer
  12639. /** [FileSystemManager.access(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html)
  12640. *
  12641. * 在插件中使用:需要基础库 `2.19.2`
  12642. *
  12643. * 判断文件/目录是否存在
  12644. *
  12645. * **示例代码**
  12646. *
  12647. * ```js
  12648. const fs = wx.getFileSystemManager()
  12649. // 判断文件/目录是否存在
  12650. fs.access({
  12651. path: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12652. success(res) {
  12653. // 文件存在
  12654. console.log(res)
  12655. },
  12656. fail(res) {
  12657. // 文件不存在或其他错误
  12658. console.error(res)
  12659. }
  12660. })
  12661. // 同步接口
  12662. try {
  12663. fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  12664. } catch(e) {
  12665. console.error(e)
  12666. }
  12667. ``` */
  12668. access(option: AccessOption): void
  12669. /** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html)
  12670. *
  12671. * 在插件中使用:需要基础库 `2.19.2`
  12672. *
  12673. * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本
  12674. *
  12675. * **示例代码**
  12676. *
  12677. * ```js
  12678. const fs = wx.getFileSystemManager()
  12679. // 判断文件/目录是否存在
  12680. fs.access({
  12681. path: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12682. success(res) {
  12683. // 文件存在
  12684. console.log(res)
  12685. },
  12686. fail(res) {
  12687. // 文件不存在或其他错误
  12688. console.error(res)
  12689. }
  12690. })
  12691. // 同步接口
  12692. try {
  12693. fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  12694. } catch(e) {
  12695. console.error(e)
  12696. }
  12697. ``` */
  12698. accessSync(
  12699. /** 要判断是否存在的文件/目录路径 (本地路径) */
  12700. path: string
  12701. ): void
  12702. /** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html)
  12703. *
  12704. * 需要基础库: `2.1.0`
  12705. *
  12706. * 在插件中使用:需要基础库 `2.19.2`
  12707. *
  12708. * 在文件结尾追加内容
  12709. *
  12710. * **示例代码**
  12711. *
  12712. * ```js
  12713. const fs = wx.getFileSystemManager()
  12714. fs.appendFile({
  12715. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12716. data: 'some text',
  12717. encoding: 'utf8',
  12718. success(res) {
  12719. console.log(res)
  12720. },
  12721. fail(res) {
  12722. console.error(res)
  12723. }
  12724. })
  12725. // 同步接口
  12726. try {
  12727. fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8')
  12728. } catch(e) {
  12729. console.error(e)
  12730. }
  12731. ``` */
  12732. appendFile(option: AppendFileOption): void
  12733. /** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html)
  12734. *
  12735. * 需要基础库: `2.1.0`
  12736. *
  12737. * 在插件中使用:需要基础库 `2.19.2`
  12738. *
  12739. * [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本
  12740. *
  12741. * **示例代码**
  12742. *
  12743. * ```js
  12744. const fs = wx.getFileSystemManager()
  12745. fs.appendFile({
  12746. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12747. data: 'some text',
  12748. encoding: 'utf8',
  12749. success(res) {
  12750. console.log(res)
  12751. },
  12752. fail(res) {
  12753. console.error(res)
  12754. }
  12755. })
  12756. // 同步接口
  12757. try {
  12758. fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8')
  12759. } catch(e) {
  12760. console.error(e)
  12761. }
  12762. ``` */
  12763. appendFileSync(
  12764. /** 要追加内容的文件路径 (本地路径) */
  12765. filePath: string,
  12766. /** 要追加的文本或二进制数据 */
  12767. data: string | ArrayBuffer,
  12768. /** 指定写入文件的字符编码
  12769. *
  12770. * 参数 encoding 可选值:
  12771. * - 'ascii': ;
  12772. * - 'base64': ;
  12773. * - 'binary': ;
  12774. * - 'hex': ;
  12775. * - 'ucs2': 以小端序读取;
  12776. * - 'ucs-2': 以小端序读取;
  12777. * - 'utf16le': 以小端序读取;
  12778. * - 'utf-16le': 以小端序读取;
  12779. * - 'utf-8': ;
  12780. * - 'utf8': ;
  12781. * - 'latin1': ; */
  12782. encoding?:
  12783. | 'ascii'
  12784. | 'base64'
  12785. | 'binary'
  12786. | 'hex'
  12787. | 'ucs2'
  12788. | 'ucs-2'
  12789. | 'utf16le'
  12790. | 'utf-16le'
  12791. | 'utf-8'
  12792. | 'utf8'
  12793. | 'latin1'
  12794. ): void
  12795. /** [FileSystemManager.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.close.html)
  12796. *
  12797. * 需要基础库: `2.16.1`
  12798. *
  12799. * 在插件中使用:需要基础库 `2.19.2`
  12800. *
  12801. * 关闭文件
  12802. *
  12803. * **示例代码**
  12804. *
  12805. * ```js
  12806. const fs = wx.getFileSystemManager()
  12807. // 打开文件
  12808. fs.open({
  12809. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12810. flag: 'a+',
  12811. success(res) {
  12812. // 关闭文件
  12813. fs.close({
  12814. fd: res.fd
  12815. })
  12816. }
  12817. })
  12818. ``` */
  12819. close(option: FileSystemManagerCloseOption): void
  12820. /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html)
  12821. *
  12822. * 在插件中使用:需要基础库 `2.19.2`
  12823. *
  12824. * 复制文件
  12825. *
  12826. * **示例代码**
  12827. *
  12828. * ```js
  12829. const fs = wx.getFileSystemManager()
  12830. fs.copyFile({
  12831. srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12832. destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  12833. success(res) {
  12834. console.log(res)
  12835. },
  12836. fail(res) {
  12837. console.error(res)
  12838. }
  12839. })
  12840. // 同步接口
  12841. try {
  12842. fs.copyFileSync(
  12843. `${wx.env.USER_DATA_PATH}/hello.txt`,
  12844. `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  12845. )
  12846. } catch(e) {
  12847. console.error(e)
  12848. }
  12849. ``` */
  12850. copyFile(option: CopyFileOption): void
  12851. /** [FileSystemManager.copyFileSync(string srcPath, string destPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html)
  12852. *
  12853. * 在插件中使用:需要基础库 `2.19.2`
  12854. *
  12855. * [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本
  12856. *
  12857. * **示例代码**
  12858. *
  12859. * ```js
  12860. const fs = wx.getFileSystemManager()
  12861. fs.copyFile({
  12862. srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12863. destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  12864. success(res) {
  12865. console.log(res)
  12866. },
  12867. fail(res) {
  12868. console.error(res)
  12869. }
  12870. })
  12871. // 同步接口
  12872. try {
  12873. fs.copyFileSync(
  12874. `${wx.env.USER_DATA_PATH}/hello.txt`,
  12875. `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  12876. )
  12877. } catch(e) {
  12878. console.error(e)
  12879. }
  12880. ``` */
  12881. copyFileSync(
  12882. /** 源文件路径,支持本地路径 */
  12883. srcPath: string,
  12884. /** 目标文件路径,支持本地路径 */
  12885. destPath: string
  12886. ): void
  12887. /** [FileSystemManager.fstat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstat.html)
  12888. *
  12889. * 需要基础库: `2.16.1`
  12890. *
  12891. * 在插件中使用:需要基础库 `2.19.2`
  12892. *
  12893. * 获取文件的状态信息
  12894. *
  12895. * **示例代码**
  12896. *
  12897. * ```js
  12898. const fs = wx.getFileSystemManager()
  12899. // 打开文件
  12900. fs.open({
  12901. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12902. flag: 'a+',
  12903. success(res) {
  12904. // 获取文件的状态信息
  12905. fs.fstat({
  12906. fd: res.fd,
  12907. success(res) {
  12908. console.log(res.stats)
  12909. }
  12910. })
  12911. }
  12912. })
  12913. ``` */
  12914. fstat(option: FstatOption): void
  12915. /** [FileSystemManager.ftruncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncate.html)
  12916. *
  12917. * 需要基础库: `2.16.1`
  12918. *
  12919. * 在插件中使用:需要基础库 `2.19.2`
  12920. *
  12921. * 对文件内容进行截断操作
  12922. *
  12923. * **示例代码**
  12924. *
  12925. * ```js
  12926. const fs = wx.getFileSystemManager()
  12927. // 打开文件
  12928. fs.open({
  12929. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  12930. flag: 'a+',
  12931. success(res) {
  12932. // 对文件内容进行截断操作
  12933. fs.ftruncate({
  12934. fd: res.fd,
  12935. length: 10, // 从第10个字节开始截断文件
  12936. success(res) {
  12937. console.log(res)
  12938. }
  12939. })
  12940. }
  12941. })
  12942. ``` */
  12943. ftruncate(option: FtruncateOption): void
  12944. /** [FileSystemManager.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html)
  12945. *
  12946. * 在插件中使用:不支持
  12947. *
  12948. * 获取该小程序下的 本地临时文件 或 本地缓存文件 信息 */
  12949. getFileInfo(option: GetFileInfoOption): void
  12950. /** [FileSystemManager.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getSavedFileList.html)
  12951. *
  12952. * 在插件中使用:不支持
  12953. *
  12954. * 获取该小程序下已保存的本地缓存文件列表 */
  12955. getSavedFileList(option?: GetSavedFileListOption): void
  12956. /** [FileSystemManager.mkdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html)
  12957. *
  12958. * 在插件中使用:需要基础库 `2.19.2`
  12959. *
  12960. * 创建目录
  12961. *
  12962. * **示例代码**
  12963. *
  12964. * ```js
  12965. const fs = wx.getFileSystemManager()
  12966. fs.mkdir({
  12967. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  12968. recursive: false
  12969. success(res) {
  12970. console.log(res)
  12971. },
  12972. fail(res) {
  12973. console.error(res)
  12974. }
  12975. })
  12976. // 同步接口
  12977. try {
  12978. fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  12979. } catch(e) {
  12980. console.error(e)
  12981. }
  12982. ``` */
  12983. mkdir(option: MkdirOption): void
  12984. /** [FileSystemManager.mkdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html)
  12985. *
  12986. * 在插件中使用:需要基础库 `2.19.2`
  12987. *
  12988. * [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本
  12989. *
  12990. * **示例代码**
  12991. *
  12992. * ```js
  12993. const fs = wx.getFileSystemManager()
  12994. fs.mkdir({
  12995. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  12996. recursive: false
  12997. success(res) {
  12998. console.log(res)
  12999. },
  13000. fail(res) {
  13001. console.error(res)
  13002. }
  13003. })
  13004. // 同步接口
  13005. try {
  13006. fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  13007. } catch(e) {
  13008. console.error(e)
  13009. }
  13010. ``` */
  13011. mkdirSync(
  13012. /** 创建的目录路径 (本地路径) */
  13013. dirPath: string,
  13014. /** 需要基础库: `2.3.0`
  13015. *
  13016. * 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
  13017. recursive?: boolean
  13018. ): void
  13019. /** [FileSystemManager.open(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html)
  13020. *
  13021. * 需要基础库: `2.16.1`
  13022. *
  13023. * 在插件中使用:需要基础库 `2.19.2`
  13024. *
  13025. * 打开文件,返回文件描述符
  13026. *
  13027. * **示例代码**
  13028. *
  13029. * ```js
  13030. const fs = wx.getFileSystemManager()
  13031. fs.open({
  13032. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13033. flag: 'a+',
  13034. success(res) {
  13035. console.log(res.fd)
  13036. }
  13037. })
  13038. ``` */
  13039. open(option: OpenOption): void
  13040. /** [FileSystemManager.read(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.read.html)
  13041. *
  13042. * 需要基础库: `2.16.1`
  13043. *
  13044. * 在插件中使用:需要基础库 `2.19.2`
  13045. *
  13046. * 读文件
  13047. *
  13048. * **示例代码**
  13049. *
  13050. * ```js
  13051. const fs = wx.getFileSystemManager()
  13052. const ab = new ArrayBuffer(1024)
  13053. // 打开文件
  13054. fs.open({
  13055. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13056. flag: 'a+',
  13057. success(res) {
  13058. // 读取文件到 ArrayBuffer 中
  13059. fs.read({
  13060. fd: res.fd,
  13061. arrayBuffer: ab,
  13062. length: 10,
  13063. success(res) {
  13064. console.log(res)
  13065. }
  13066. })
  13067. }
  13068. })
  13069. ``` */
  13070. read(option: ReadOption): void
  13071. /** [FileSystemManager.readCompressedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readCompressedFile.html)
  13072. *
  13073. * 需要基础库: `2.21.1`
  13074. *
  13075. * 在插件中使用:不支持
  13076. *
  13077. * 读取指定压缩类型的本地文件内容
  13078. *
  13079. * **示例代码**
  13080. *
  13081. * ```js
  13082. const fs = wx.getFileSystemManager()
  13083. // 异步接口
  13084. fs.readCompressedFile({
  13085. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  13086. compressionAlgorithm: 'br',
  13087. success(res) {
  13088. console.log(res.data)
  13089. },
  13090. fail(res) {
  13091. console.log('readCompressedFile fail', res)
  13092. }
  13093. })
  13094. // 同步接口
  13095. const data = fs.readCompressedFileSync({
  13096. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  13097. compressionAlgorithm: 'br',
  13098. })
  13099. console.log(data)
  13100. ``` */
  13101. readCompressedFile(option: ReadCompressedFileOption): void
  13102. /** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html)
  13103. *
  13104. * 在插件中使用:需要基础库 `2.19.2`
  13105. *
  13106. * 读取本地文件内容。单个文件大小上限为100M。
  13107. *
  13108. * **示例代码**
  13109. *
  13110. * ```js
  13111. const fs = wx.getFileSystemManager()
  13112. fs.readFile({
  13113. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13114. encoding: 'utf8',
  13115. position: 0,
  13116. success(res) {
  13117. console.log(res.data)
  13118. },
  13119. fail(res) {
  13120. console.error(res)
  13121. }
  13122. })
  13123. // 同步接口
  13124. try {
  13125. const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0)
  13126. console.log(res)
  13127. } catch(e) {
  13128. console.error(e)
  13129. }
  13130. ``` */
  13131. readFile(option: ReadFileOption): void
  13132. /** [FileSystemManager.readZipEntry(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readZipEntry.html)
  13133. *
  13134. * 需要基础库: `2.17.3`
  13135. *
  13136. * 在插件中使用:需要基础库 `2.19.2`
  13137. *
  13138. * 读取压缩包内的文件
  13139. *
  13140. * **示例代码**
  13141. *
  13142. * ```js
  13143. const fs = wx.getFileSystemManager()
  13144. // 读取zip内某个或多个文件
  13145. fs.readZipEntry({
  13146. filePath: 'wxfile://from/to.zip',
  13147. entries: [{
  13148. path: 'some_folder/my_file.txt', // zip内文件路径
  13149. encoding: 'utf-8', // 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  13150. position: 0, // 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte
  13151. length: 10000, // 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte
  13152. }, {
  13153. path: 'other_folder/orther_file.txt', // zip内文件路径
  13154. }],
  13155. success(res) {
  13156. console.log(res.entries)
  13157. // res.entries === {
  13158. // 'some_folder/my_file.txt': {
  13159. // errMsg: 'readZipEntry:ok',
  13160. // data: 'xxxxxx'
  13161. // },
  13162. // 'other_folder/orther_file.txt': {
  13163. // data: (ArrayBuffer)
  13164. // }
  13165. // }
  13166. },
  13167. fail(res) {
  13168. console.log(res.errMsg)
  13169. },
  13170. })
  13171. // 读取zip内所有文件。允许指定统一的encoding。position、length则不再允许指定,分别默认为0和文件长度
  13172. fs.readZipEntry({
  13173. filePath: 'wxfile://from/to.zip',
  13174. entries: 'all'
  13175. encoding: 'utf-8', // 统一指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  13176. success(res) {
  13177. console.log(res.entries)
  13178. // res.entries === {
  13179. // 'some_folder/my_file.txt': {
  13180. // errMsg: 'readZipEntry:ok',
  13181. // data: 'xxxxxx'
  13182. // },
  13183. // 'other_folder/orther_file.txt': {
  13184. // errMsg: 'readZipEntry:ok',
  13185. // data: 'xxxxxx'
  13186. // }
  13187. // }
  13188. },
  13189. fail(res) {
  13190. console.log(res.errMsg)
  13191. },
  13192. })
  13193. ``` */
  13194. readZipEntry(option: ReadZipEntryOption): void
  13195. /** [FileSystemManager.readdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html)
  13196. *
  13197. * 在插件中使用:需要基础库 `2.19.2`
  13198. *
  13199. * 读取目录内文件列表
  13200. *
  13201. * **注意事项</title>
  13202. * - readdir接口无法访问文件系统根路径(wxfile://)。
  13203. * <title>示例代码**
  13204. *
  13205. * ```js
  13206. const fs = wx.getFileSystemManager()
  13207. fs.readdir({
  13208. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  13209. success(res) {
  13210. console.log(res.files)
  13211. },
  13212. fail(res) {
  13213. console.error(res)
  13214. }
  13215. })
  13216. // 同步接口
  13217. try {
  13218. const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`)
  13219. console.log(res)
  13220. } catch(e) {
  13221. console.error(e)
  13222. }
  13223. ``` */
  13224. readdir(option: ReaddirOption): void
  13225. /** [FileSystemManager.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.removeSavedFile.html)
  13226. *
  13227. * 在插件中使用:不支持
  13228. *
  13229. * 删除该小程序下已保存的本地缓存文件 */
  13230. removeSavedFile(option: RemoveSavedFileOption): void
  13231. /** [FileSystemManager.rename(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html)
  13232. *
  13233. * 在插件中使用:需要基础库 `2.19.2`
  13234. *
  13235. * 重命名文件。可以把文件从 oldPath 移动到 newPath
  13236. *
  13237. * **示例代码**
  13238. *
  13239. * ```js
  13240. const fs = wx.getFileSystemManager()
  13241. fs.rename({
  13242. oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13243. newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`,
  13244. success(res) {
  13245. console.log(res)
  13246. },
  13247. fail(res) {
  13248. console.error(res)
  13249. }
  13250. })
  13251. // 同步接口
  13252. try {
  13253. const res = fs.renameSync(
  13254. `${wx.env.USER_DATA_PATH}/hello.txt`,
  13255. `${wx.env.USER_DATA_PATH}/hello_new.txt`
  13256. )
  13257. console.log(res)
  13258. } catch(e) {
  13259. console.error(e)
  13260. }
  13261. ``` */
  13262. rename(option: RenameOption): void
  13263. /** [FileSystemManager.renameSync(string oldPath, string newPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html)
  13264. *
  13265. * 在插件中使用:需要基础库 `2.19.2`
  13266. *
  13267. * [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本
  13268. *
  13269. * **示例代码**
  13270. *
  13271. * ```js
  13272. const fs = wx.getFileSystemManager()
  13273. fs.rename({
  13274. oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13275. newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`,
  13276. success(res) {
  13277. console.log(res)
  13278. },
  13279. fail(res) {
  13280. console.error(res)
  13281. }
  13282. })
  13283. // 同步接口
  13284. try {
  13285. const res = fs.renameSync(
  13286. `${wx.env.USER_DATA_PATH}/hello.txt`,
  13287. `${wx.env.USER_DATA_PATH}/hello_new.txt`
  13288. )
  13289. console.log(res)
  13290. } catch(e) {
  13291. console.error(e)
  13292. }
  13293. ``` */
  13294. renameSync(
  13295. /** 源文件路径,支持本地路径 */
  13296. oldPath: string,
  13297. /** 新文件路径,支持本地路径 */
  13298. newPath: string
  13299. ): void
  13300. /** [FileSystemManager.rmdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html)
  13301. *
  13302. * 在插件中使用:需要基础库 `2.19.2`
  13303. *
  13304. * 删除目录
  13305. *
  13306. * **示例代码**
  13307. *
  13308. * ```js
  13309. const fs = wx.getFileSystemManager()
  13310. fs.rmdir({
  13311. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  13312. recursive: false,
  13313. success(res) {
  13314. console.log(res)
  13315. },
  13316. fail(res) {
  13317. console.error(res)
  13318. }
  13319. })
  13320. // 同步接口
  13321. try {
  13322. const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  13323. console.log(res)
  13324. } catch(e) {
  13325. console.error(e)
  13326. }
  13327. ``` */
  13328. rmdir(option: RmdirOption): void
  13329. /** [FileSystemManager.rmdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdirSync.html)
  13330. *
  13331. * 在插件中使用:需要基础库 `2.19.2`
  13332. *
  13333. * [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本
  13334. *
  13335. * **示例代码**
  13336. *
  13337. * ```js
  13338. const fs = wx.getFileSystemManager()
  13339. fs.rmdir({
  13340. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  13341. recursive: false,
  13342. success(res) {
  13343. console.log(res)
  13344. },
  13345. fail(res) {
  13346. console.error(res)
  13347. }
  13348. })
  13349. // 同步接口
  13350. try {
  13351. const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  13352. console.log(res)
  13353. } catch(e) {
  13354. console.error(e)
  13355. }
  13356. ``` */
  13357. rmdirSync(
  13358. /** 要删除的目录路径 (本地路径) */
  13359. dirPath: string,
  13360. /** 需要基础库: `2.3.0`
  13361. *
  13362. * 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 */
  13363. recursive?: boolean
  13364. ): void
  13365. /** [FileSystemManager.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html)
  13366. *
  13367. * 在插件中使用:不支持
  13368. *
  13369. * 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。 */
  13370. saveFile(option: SaveFileOption): void
  13371. /** [FileSystemManager.stat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html)
  13372. *
  13373. * 在插件中使用:需要基础库 `2.19.2`
  13374. *
  13375. * 获取文件 Stats 对象 */
  13376. stat(option: StatOption): void
  13377. /** [FileSystemManager.truncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncate.html)
  13378. *
  13379. * 需要基础库: `2.16.1`
  13380. *
  13381. * 在插件中使用:需要基础库 `2.19.2`
  13382. *
  13383. * 对文件内容进行截断操作
  13384. *
  13385. * **示例代码**
  13386. *
  13387. * ```js
  13388. const fs = wx.getFileSystemManager()
  13389. fs.truncate({
  13390. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13391. length: 10, // 从第10个字节开始截断
  13392. success(res) {
  13393. console.log(res)
  13394. }
  13395. })
  13396. ``` */
  13397. truncate(option: TruncateOption): void
  13398. /** [FileSystemManager.unlink(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html)
  13399. *
  13400. * 在插件中使用:需要基础库 `2.19.2`
  13401. *
  13402. * 删除文件
  13403. *
  13404. * **示例代码**
  13405. *
  13406. * ```js
  13407. const fs = wx.getFileSystemManager()
  13408. fs.unlink({
  13409. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13410. success(res) {
  13411. console.log(res)
  13412. },
  13413. fail(res) {
  13414. console.error(res)
  13415. }
  13416. })
  13417. // 同步接口
  13418. try {
  13419. const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  13420. console.log(res)
  13421. } catch(e) {
  13422. console.error(e)
  13423. }
  13424. ``` */
  13425. unlink(option: UnlinkOption): void
  13426. /** [FileSystemManager.unlinkSync(string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html)
  13427. *
  13428. * 在插件中使用:需要基础库 `2.19.2`
  13429. *
  13430. * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本
  13431. *
  13432. * **示例代码**
  13433. *
  13434. * ```js
  13435. const fs = wx.getFileSystemManager()
  13436. fs.unlink({
  13437. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13438. success(res) {
  13439. console.log(res)
  13440. },
  13441. fail(res) {
  13442. console.error(res)
  13443. }
  13444. })
  13445. // 同步接口
  13446. try {
  13447. const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  13448. console.log(res)
  13449. } catch(e) {
  13450. console.error(e)
  13451. }
  13452. ``` */
  13453. unlinkSync(
  13454. /** 要删除的文件路径 (本地路径) */
  13455. filePath: string
  13456. ): void
  13457. /** [FileSystemManager.unzip(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html)
  13458. *
  13459. * 在插件中使用:需要基础库 `2.19.2`
  13460. *
  13461. * 解压文件
  13462. *
  13463. * **示例代码**
  13464. *
  13465. * ```js
  13466. const fs = wx.getFileSystemManager()
  13467. fs.unzip({
  13468. zipFilePath: `${wx.env.USER_DATA_PATH}/example.zip`,
  13469. targetPath: '${wx.env.USER_DATA_PATH}/example',
  13470. success(res) {
  13471. console.log(res)
  13472. },
  13473. fail(res) {
  13474. console.error(res)
  13475. }
  13476. })
  13477. ``` */
  13478. unzip(option: UnzipOption): void
  13479. /** [FileSystemManager.write(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.write.html)
  13480. *
  13481. * 需要基础库: `2.16.1`
  13482. *
  13483. * 在插件中使用:需要基础库 `2.19.2`
  13484. *
  13485. * 写入文件
  13486. *
  13487. * **示例代码**
  13488. *
  13489. * ```js
  13490. const fs = wx.getFileSystemManager()
  13491. // 打开文件
  13492. fs.open({
  13493. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13494. flag: 'a+',
  13495. success(res) {
  13496. // 写入文件
  13497. fs.write({
  13498. fd: res.fd,
  13499. data: 'some text',
  13500. success(res) {
  13501. console.log(res.bytesWritten)
  13502. }
  13503. })
  13504. }
  13505. })
  13506. ``` */
  13507. write(option: WriteOption): void
  13508. /** [FileSystemManager.writeFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html)
  13509. *
  13510. * 在插件中使用:需要基础库 `2.19.2`
  13511. *
  13512. * 写文件
  13513. *
  13514. * **示例代码**
  13515. *
  13516. * ```js
  13517. const fs = wx.getFileSystemManager()
  13518. fs.writeFile({
  13519. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13520. data: 'some text or arrayBuffer',
  13521. encoding: 'utf8',
  13522. success(res) {
  13523. console.log(res)
  13524. },
  13525. fail(res) {
  13526. console.error(res)
  13527. }
  13528. })
  13529. // 同步接口
  13530. try {
  13531. const res = fs.writeFileSync(
  13532. `${wx.env.USER_DATA_PATH}/hello.txt`,
  13533. 'some text or arrayBuffer',
  13534. 'utf8'
  13535. )
  13536. console.log(res)
  13537. } catch(e) {
  13538. console.error(e)
  13539. }
  13540. ``` */
  13541. writeFile(option: WriteFileOption): void
  13542. /** [FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html)
  13543. *
  13544. * 在插件中使用:需要基础库 `2.19.2`
  13545. *
  13546. * [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本
  13547. *
  13548. * **示例代码**
  13549. *
  13550. * ```js
  13551. const fs = wx.getFileSystemManager()
  13552. fs.writeFile({
  13553. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13554. data: 'some text or arrayBuffer',
  13555. encoding: 'utf8',
  13556. success(res) {
  13557. console.log(res)
  13558. },
  13559. fail(res) {
  13560. console.error(res)
  13561. }
  13562. })
  13563. // 同步接口
  13564. try {
  13565. const res = fs.writeFileSync(
  13566. `${wx.env.USER_DATA_PATH}/hello.txt`,
  13567. 'some text or arrayBuffer',
  13568. 'utf8'
  13569. )
  13570. console.log(res)
  13571. } catch(e) {
  13572. console.error(e)
  13573. }
  13574. ``` */
  13575. writeFileSync(
  13576. /** 要写入的文件路径 (本地路径) */
  13577. filePath: string,
  13578. /** 要写入的文本或二进制数据 */
  13579. data: string | ArrayBuffer,
  13580. /** 指定写入文件的字符编码
  13581. *
  13582. * 参数 encoding 可选值:
  13583. * - 'ascii': ;
  13584. * - 'base64': (注意,选择 base64 编码,data 只需要传 base64 内容本身,不要传 Data URI 前缀,否则会报 fail base64 encode error 错误。例如,传 aGVsbG8= 而不是传 data:image/png;base64,aGVsbG8= );
  13585. * - 'binary': ;
  13586. * - 'hex': ;
  13587. * - 'ucs2': 以小端序读取;
  13588. * - 'ucs-2': 以小端序读取;
  13589. * - 'utf16le': 以小端序读取;
  13590. * - 'utf-16le': 以小端序读取;
  13591. * - 'utf-8': ;
  13592. * - 'utf8': ;
  13593. * - 'latin1': ; */
  13594. encoding?:
  13595. | 'ascii'
  13596. | 'base64'
  13597. | 'binary'
  13598. | 'hex'
  13599. | 'ucs2'
  13600. | 'ucs-2'
  13601. | 'utf16le'
  13602. | 'utf-16le'
  13603. | 'utf-8'
  13604. | 'utf8'
  13605. | 'latin1'
  13606. ): void
  13607. /** [[ReadResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/ReadResult.html) FileSystemManager.readSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html)
  13608. *
  13609. * 需要基础库: `2.16.1`
  13610. *
  13611. * 在插件中使用:需要基础库 `2.19.2`
  13612. *
  13613. * 读文件
  13614. *
  13615. * **示例代码**
  13616. *
  13617. * ```js
  13618. const fs = wx.getFileSystemManager()
  13619. const ab = new ArrayBuffer(1024)
  13620. const fd = fs.openSync({
  13621. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13622. flag: 'a+'
  13623. })
  13624. const res = fs.readSync({
  13625. fd: fd,
  13626. arrayBuffer: ab,
  13627. length: 10
  13628. })
  13629. console.log(res)
  13630. ``` */
  13631. readSync(option: ReadSyncOption): ReadResult
  13632. /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html) FileSystemManager.fstatSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstatSync.html)
  13633. *
  13634. * 需要基础库: `2.16.1`
  13635. *
  13636. * 在插件中使用:需要基础库 `2.19.2`
  13637. *
  13638. * 同步获取文件的状态信息
  13639. *
  13640. * **示例代码**
  13641. *
  13642. * ```js
  13643. const fs = wx.getFileSystemManager()
  13644. const fd = fs.openSync({
  13645. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13646. flag: 'a+'
  13647. })
  13648. const stats = fs.fstatSync({fd: fd})
  13649. console.log(stats)
  13650. ``` */
  13651. fstatSync(option: FstatSyncOption): Stats
  13652. /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Array.&lt;[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)&gt; FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html)
  13653. *
  13654. * 在插件中使用:需要基础库 `2.19.2`
  13655. *
  13656. * [FileSystemManager.stat](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) 的同步版本 */
  13657. statSync(
  13658. /** 文件/目录路径 (本地路径) */
  13659. path: string,
  13660. /** 需要基础库: `2.3.0`
  13661. *
  13662. * 是否递归获取目录下的每个文件的 Stats 信息 */
  13663. recursive?: boolean
  13664. ): Stats | Stats[]
  13665. /** [[WriteResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/WriteResult.html) FileSystemManager.writeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html)
  13666. *
  13667. * 需要基础库: `2.16.1`
  13668. *
  13669. * 在插件中使用:需要基础库 `2.19.2`
  13670. *
  13671. * 同步写入文件
  13672. *
  13673. * **示例代码**
  13674. *
  13675. * ```js
  13676. const fs = wx.getFileSystemManager()
  13677. const fd = fs.openSync({
  13678. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13679. flag: 'a+'
  13680. })
  13681. const res = fs.writeSync({
  13682. fd: fd,
  13683. data: 'some text'
  13684. })
  13685. console.log(res.bytesWritten)
  13686. ``` */
  13687. writeSync(option: WriteSyncOption): WriteResult
  13688. /** [string FileSystemManager.openSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html)
  13689. *
  13690. * 需要基础库: `2.16.1`
  13691. *
  13692. * 在插件中使用:需要基础库 `2.19.2`
  13693. *
  13694. * 同步打开文件,返回文件描述符
  13695. *
  13696. * **示例代码**
  13697. *
  13698. * ```js
  13699. const fs = wx.getFileSystemManager()
  13700. const fd = fs.openSync({
  13701. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13702. flag: 'a+'
  13703. })
  13704. console.log(fd)
  13705. ``` */
  13706. openSync(option: OpenSyncOption): string
  13707. /** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html)
  13708. *
  13709. * 在插件中使用:不支持
  13710. *
  13711. * [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */
  13712. saveFileSync(
  13713. /** 临时存储文件路径 (本地路径) */
  13714. tempFilePath: string,
  13715. /** 要存储的文件路径 (本地路径) */
  13716. filePath?: string
  13717. ): string
  13718. /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, number position, number length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html)
  13719. *
  13720. * 在插件中使用:需要基础库 `2.19.2`
  13721. *
  13722. * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本
  13723. *
  13724. * **示例代码**
  13725. *
  13726. * ```js
  13727. const fs = wx.getFileSystemManager()
  13728. fs.readFile({
  13729. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13730. encoding: 'utf8',
  13731. position: 0,
  13732. success(res) {
  13733. console.log(res.data)
  13734. },
  13735. fail(res) {
  13736. console.error(res)
  13737. }
  13738. })
  13739. // 同步接口
  13740. try {
  13741. const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0)
  13742. console.log(res)
  13743. } catch(e) {
  13744. console.error(e)
  13745. }
  13746. ``` */
  13747. readFileSync(
  13748. /** 要读取的文件的路径 (本地路径) */
  13749. filePath: string,
  13750. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  13751. *
  13752. * 参数 encoding 可选值:
  13753. * - 'ascii': ;
  13754. * - 'base64': ;
  13755. * - 'binary': ;
  13756. * - 'hex': ;
  13757. * - 'ucs2': 以小端序读取;
  13758. * - 'ucs-2': 以小端序读取;
  13759. * - 'utf16le': 以小端序读取;
  13760. * - 'utf-16le': 以小端序读取;
  13761. * - 'utf-8': ;
  13762. * - 'utf8': ;
  13763. * - 'latin1': ; */
  13764. encoding?:
  13765. | 'ascii'
  13766. | 'base64'
  13767. | 'binary'
  13768. | 'hex'
  13769. | 'ucs2'
  13770. | 'ucs-2'
  13771. | 'utf16le'
  13772. | 'utf-16le'
  13773. | 'utf-8'
  13774. | 'utf8'
  13775. | 'latin1',
  13776. /** 需要基础库: `2.10.0`
  13777. *
  13778. * 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
  13779. position?: number,
  13780. /** 需要基础库: `2.10.0`
  13781. *
  13782. * 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
  13783. length?: number
  13784. ): string | ArrayBuffer
  13785. /** [undefined FileSystemManager.closeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.closeSync.html)
  13786. *
  13787. * 需要基础库: `2.16.1`
  13788. *
  13789. * 在插件中使用:需要基础库 `2.19.2`
  13790. *
  13791. * 同步关闭文件
  13792. *
  13793. * **示例代码**
  13794. *
  13795. * ```js
  13796. const fs = wx.getFileSystemManager()
  13797. const fd = fs.openSync({
  13798. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13799. flag: 'a+'
  13800. })
  13801. // 关闭文件
  13802. fs.closeSync({fd: fd})
  13803. ``` */
  13804. closeSync(option: CloseSyncOption): undefined
  13805. /** [undefined FileSystemManager.ftruncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncateSync.html)
  13806. *
  13807. * 需要基础库: `2.16.1`
  13808. *
  13809. * 在插件中使用:需要基础库 `2.19.2`
  13810. *
  13811. * 对文件内容进行截断操作
  13812. *
  13813. * **示例代码**
  13814. *
  13815. * ```js
  13816. const fs = wx.getFileSystemManager()
  13817. const fd = fs.openSync({
  13818. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13819. flag: 'a+'
  13820. })
  13821. fs.ftruncateSync({
  13822. fd: fd,
  13823. length: 10 // 从第10个字节开始截断文件
  13824. })
  13825. ``` */
  13826. ftruncateSync(option: FtruncateSyncOption): undefined
  13827. /** [undefined FileSystemManager.truncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncateSync.html)
  13828. *
  13829. * 需要基础库: `2.16.1`
  13830. *
  13831. * 在插件中使用:需要基础库 `2.19.2`
  13832. *
  13833. * 对文件内容进行截断操作 (truncate 的同步版本)
  13834. *
  13835. * **示例代码**
  13836. *
  13837. * ```js
  13838. const fs = wx.getFileSystemManager()
  13839. fs.truncateSync({
  13840. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  13841. length: 10, // 从第10个字节开始截断
  13842. })
  13843. ``` */
  13844. truncateSync(option: TruncateSyncOption): undefined
  13845. }
  13846. interface FstatSyncError {
  13847. /** 错误信息
  13848. *
  13849. * | 错误信息 | 说明 |
  13850. * | - | - |
  13851. * | bad file descriptor | 无效的文件描述符 |
  13852. * | fail permission denied | 指定的 fd 路径没有读权限 | */ errMsg: string
  13853. /** 错误码
  13854. *
  13855. * | 错误信息 | 说明 |
  13856. * | - | - |
  13857. * | bad file descriptor | 无效的文件描述符 |
  13858. * | fail permission denied | 指定的 fd 路径没有读权限 | */ errCode: number
  13859. }
  13860. interface FtruncateSyncError {
  13861. /** 错误信息
  13862. *
  13863. * | 错误信息 | 说明 |
  13864. * | - | - |
  13865. * | bad file descriptor | 无效的文件描述符 |
  13866. * | fail permission denied | 指定的 fd 没有写权限 |
  13867. * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 |
  13868. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errMsg: string
  13869. /** 错误码
  13870. *
  13871. * | 错误信息 | 说明 |
  13872. * | - | - |
  13873. * | bad file descriptor | 无效的文件描述符 |
  13874. * | fail permission denied | 指定的 fd 没有写权限 |
  13875. * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 |
  13876. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errCode: number
  13877. }
  13878. interface InnerAudioContext {
  13879. /** [InnerAudioContext.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.destroy.html)
  13880. *
  13881. * 在插件中使用:支持
  13882. *
  13883. * 销毁当前实例 */
  13884. destroy(): void
  13885. /** [InnerAudioContext.offCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offCanplay.html)
  13886. *
  13887. * 需要基础库: `1.9.0`
  13888. *
  13889. * 在插件中使用:支持
  13890. *
  13891. * 移除音频进入可以播放状态的事件的监听函数
  13892. *
  13893. * **示例代码**
  13894. *
  13895. * ```js
  13896. const listener = function (res) { console.log(res) }
  13897. InnerAudioContext.onCanplay(listener)
  13898. InnerAudioContext.offCanplay(listener) // 需传入与监听时同一个的函数对象
  13899. ``` */
  13900. offCanplay(
  13901. /** onCanplay 传入的监听函数。不传此参数则移除所有监听函数。 */
  13902. listener?: OffCanplayCallback
  13903. ): void
  13904. /** [InnerAudioContext.offEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html)
  13905. *
  13906. * 需要基础库: `1.9.0`
  13907. *
  13908. * 在插件中使用:支持
  13909. *
  13910. * 移除音频自然播放至结束的事件的监听函数
  13911. *
  13912. * **示例代码**
  13913. *
  13914. * ```js
  13915. const listener = function (res) { console.log(res) }
  13916. InnerAudioContext.onEnded(listener)
  13917. InnerAudioContext.offEnded(listener) // 需传入与监听时同一个的函数对象
  13918. ``` */
  13919. offEnded(
  13920. /** onEnded 传入的监听函数。不传此参数则移除所有监听函数。 */
  13921. listener?: OffEndedCallback
  13922. ): void
  13923. /** [InnerAudioContext.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html)
  13924. *
  13925. * 需要基础库: `1.9.0`
  13926. *
  13927. * 在插件中使用:支持
  13928. *
  13929. * 移除音频播放错误事件的监听函数
  13930. *
  13931. * **示例代码**
  13932. *
  13933. * ```js
  13934. const listener = function (res) { console.log(res) }
  13935. InnerAudioContext.onError(listener)
  13936. InnerAudioContext.offError(listener) // 需传入与监听时同一个的函数对象
  13937. ``` */
  13938. offError(
  13939. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  13940. listener?: InnerAudioContextOffErrorCallback
  13941. ): void
  13942. /** [InnerAudioContext.offPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html)
  13943. *
  13944. * 需要基础库: `1.9.0`
  13945. *
  13946. * 在插件中使用:支持
  13947. *
  13948. * 移除音频暂停事件的监听函数
  13949. *
  13950. * **示例代码**
  13951. *
  13952. * ```js
  13953. const listener = function (res) { console.log(res) }
  13954. InnerAudioContext.onPause(listener)
  13955. InnerAudioContext.offPause(listener) // 需传入与监听时同一个的函数对象
  13956. ``` */
  13957. offPause(
  13958. /** onPause 传入的监听函数。不传此参数则移除所有监听函数。 */
  13959. listener?: OffPauseCallback
  13960. ): void
  13961. /** [InnerAudioContext.offPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html)
  13962. *
  13963. * 需要基础库: `1.9.0`
  13964. *
  13965. * 在插件中使用:支持
  13966. *
  13967. * 移除音频播放事件的监听函数
  13968. *
  13969. * **示例代码**
  13970. *
  13971. * ```js
  13972. const listener = function (res) { console.log(res) }
  13973. InnerAudioContext.onPlay(listener)
  13974. InnerAudioContext.offPlay(listener) // 需传入与监听时同一个的函数对象
  13975. ``` */
  13976. offPlay(
  13977. /** onPlay 传入的监听函数。不传此参数则移除所有监听函数。 */
  13978. listener?: OffPlayCallback
  13979. ): void
  13980. /** [InnerAudioContext.offSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html)
  13981. *
  13982. * 需要基础库: `1.9.0`
  13983. *
  13984. * 在插件中使用:支持
  13985. *
  13986. * 移除音频完成跳转操作的事件的监听函数
  13987. *
  13988. * **示例代码**
  13989. *
  13990. * ```js
  13991. const listener = function (res) { console.log(res) }
  13992. InnerAudioContext.onSeeked(listener)
  13993. InnerAudioContext.offSeeked(listener) // 需传入与监听时同一个的函数对象
  13994. ``` */
  13995. offSeeked(
  13996. /** onSeeked 传入的监听函数。不传此参数则移除所有监听函数。 */
  13997. listener?: OffSeekedCallback
  13998. ): void
  13999. /** [InnerAudioContext.offSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html)
  14000. *
  14001. * 需要基础库: `1.9.0`
  14002. *
  14003. * 在插件中使用:支持
  14004. *
  14005. * 移除音频进行跳转操作的事件的监听函数
  14006. *
  14007. * **示例代码**
  14008. *
  14009. * ```js
  14010. const listener = function (res) { console.log(res) }
  14011. InnerAudioContext.onSeeking(listener)
  14012. InnerAudioContext.offSeeking(listener) // 需传入与监听时同一个的函数对象
  14013. ``` */
  14014. offSeeking(
  14015. /** onSeeking 传入的监听函数。不传此参数则移除所有监听函数。 */
  14016. listener?: OffSeekingCallback
  14017. ): void
  14018. /** [InnerAudioContext.offStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html)
  14019. *
  14020. * 需要基础库: `1.9.0`
  14021. *
  14022. * 在插件中使用:支持
  14023. *
  14024. * 移除音频停止事件的监听函数
  14025. *
  14026. * **示例代码**
  14027. *
  14028. * ```js
  14029. const listener = function (res) { console.log(res) }
  14030. InnerAudioContext.onStop(listener)
  14031. InnerAudioContext.offStop(listener) // 需传入与监听时同一个的函数对象
  14032. ``` */
  14033. offStop(
  14034. /** onStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  14035. listener?: OffStopCallback
  14036. ): void
  14037. /** [InnerAudioContext.offTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html)
  14038. *
  14039. * 需要基础库: `1.9.0`
  14040. *
  14041. * 在插件中使用:支持
  14042. *
  14043. * 移除音频播放进度更新事件的监听函数
  14044. *
  14045. * **示例代码**
  14046. *
  14047. * ```js
  14048. const listener = function (res) { console.log(res) }
  14049. InnerAudioContext.onTimeUpdate(listener)
  14050. InnerAudioContext.offTimeUpdate(listener) // 需传入与监听时同一个的函数对象
  14051. ``` */
  14052. offTimeUpdate(
  14053. /** onTimeUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  14054. listener?: OffTimeUpdateCallback
  14055. ): void
  14056. /** [InnerAudioContext.offWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html)
  14057. *
  14058. * 需要基础库: `1.9.0`
  14059. *
  14060. * 在插件中使用:支持
  14061. *
  14062. * 移除音频加载中事件的监听函数
  14063. *
  14064. * **示例代码**
  14065. *
  14066. * ```js
  14067. const listener = function (res) { console.log(res) }
  14068. InnerAudioContext.onWaiting(listener)
  14069. InnerAudioContext.offWaiting(listener) // 需传入与监听时同一个的函数对象
  14070. ``` */
  14071. offWaiting(
  14072. /** onWaiting 传入的监听函数。不传此参数则移除所有监听函数。 */
  14073. listener?: OffWaitingCallback
  14074. ): void
  14075. /** [InnerAudioContext.onCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html)
  14076. *
  14077. * 在插件中使用:支持
  14078. *
  14079. * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */
  14080. onCanplay(
  14081. /** 音频进入可以播放状态的事件的监听函数 */
  14082. listener: OnCanplayCallback
  14083. ): void
  14084. /** [InnerAudioContext.onEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html)
  14085. *
  14086. * 在插件中使用:支持
  14087. *
  14088. * 监听音频自然播放至结束的事件 */
  14089. onEnded(
  14090. /** 音频自然播放至结束的事件的监听函数 */
  14091. listener: OnEndedCallback
  14092. ): void
  14093. /** [InnerAudioContext.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html)
  14094. *
  14095. * 在插件中使用:支持
  14096. *
  14097. * 监听音频播放错误事件
  14098. *
  14099. * **Tips**
  14100. *
  14101. * 1. errCode=100001 时,如若 errMsg 中有 INNERCODE -11828 ,请先检查 response header 是否缺少 Content-Length
  14102. * 2. errCode=100001 时,如若 errMsg 中有 systemErrCode:200333420,请检查文件编码格式和 fileExtension 是否一致 */
  14103. onError(
  14104. /** 音频播放错误事件的监听函数 */
  14105. listener: InnerAudioContextOnErrorCallback
  14106. ): void
  14107. /** [InnerAudioContext.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPause.html)
  14108. *
  14109. * 在插件中使用:支持
  14110. *
  14111. * 监听音频暂停事件 */
  14112. onPause(
  14113. /** 音频暂停事件的监听函数 */
  14114. listener: OnPauseCallback
  14115. ): void
  14116. /** [InnerAudioContext.onPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html)
  14117. *
  14118. * 在插件中使用:支持
  14119. *
  14120. * 监听音频播放事件 */
  14121. onPlay(
  14122. /** 音频播放事件的监听函数 */
  14123. listener: OnPlayCallback
  14124. ): void
  14125. /** [InnerAudioContext.onSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html)
  14126. *
  14127. * 在插件中使用:支持
  14128. *
  14129. * 监听音频完成跳转操作的事件 */
  14130. onSeeked(
  14131. /** 音频完成跳转操作的事件的监听函数 */
  14132. listener: OnSeekedCallback
  14133. ): void
  14134. /** [InnerAudioContext.onSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html)
  14135. *
  14136. * 在插件中使用:支持
  14137. *
  14138. * 监听音频进行跳转操作的事件 */
  14139. onSeeking(
  14140. /** 音频进行跳转操作的事件的监听函数 */
  14141. listener: OnSeekingCallback
  14142. ): void
  14143. /** [InnerAudioContext.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html)
  14144. *
  14145. * 在插件中使用:支持
  14146. *
  14147. * 监听音频停止事件 */
  14148. onStop(
  14149. /** 音频停止事件的监听函数 */
  14150. listener: InnerAudioContextOnStopCallback
  14151. ): void
  14152. /** [InnerAudioContext.onTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onTimeUpdate.html)
  14153. *
  14154. * 在插件中使用:支持
  14155. *
  14156. * 监听音频播放进度更新事件 */
  14157. onTimeUpdate(
  14158. /** 音频播放进度更新事件的监听函数 */
  14159. listener: OnTimeUpdateCallback
  14160. ): void
  14161. /** [InnerAudioContext.onWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html)
  14162. *
  14163. * 在插件中使用:支持
  14164. *
  14165. * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
  14166. onWaiting(
  14167. /** 音频加载中事件的监听函数 */
  14168. listener: OnWaitingCallback
  14169. ): void
  14170. /** [InnerAudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.pause.html)
  14171. *
  14172. * 在插件中使用:支持
  14173. *
  14174. * 暂停。暂停后的音频再播放会从暂停处开始播放 */
  14175. pause(): void
  14176. /** [InnerAudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.play.html)
  14177. *
  14178. * 在插件中使用:支持
  14179. *
  14180. * 播放 */
  14181. play(): void
  14182. /** [InnerAudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.seek.html)
  14183. *
  14184. * 在插件中使用:支持
  14185. *
  14186. * 跳转到指定位置 */
  14187. seek(
  14188. /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
  14189. position: number
  14190. ): void
  14191. /** [InnerAudioContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.stop.html)
  14192. *
  14193. * 在插件中使用:支持
  14194. *
  14195. * 停止。停止后的音频再播放会从头开始播放。 */
  14196. stop(): void
  14197. }
  14198. interface IntersectionObserver {
  14199. /** [IntersectionObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html)
  14200. *
  14201. * 在插件中使用:支持
  14202. *
  14203. * 停止监听。回调函数将不再触发 */
  14204. disconnect(): void
  14205. /** [IntersectionObserver.observe(string targetSelector, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html)
  14206. *
  14207. * 在插件中使用:支持
  14208. *
  14209. * 指定目标节点并开始监听相交状态变化情况 */
  14210. observe(
  14211. /** 选择器 */
  14212. targetSelector: string,
  14213. /** 监听相交状态变化的回调函数 */
  14214. callback: IntersectionObserverObserveCallback
  14215. ): void
  14216. /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeTo(string selector, Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html)
  14217. *
  14218. * 在插件中使用:支持
  14219. *
  14220. * 使用选择器指定一个节点,作为参照区域之一。 */
  14221. relativeTo(
  14222. /** 选择器 */
  14223. selector: string,
  14224. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  14225. margins?: Margins
  14226. ): IntersectionObserver
  14227. /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeToViewport(Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeToViewport.html)
  14228. *
  14229. * 在插件中使用:支持
  14230. *
  14231. * 指定页面显示区域作为参照区域之一
  14232. *
  14233. * **示例代码**
  14234. *
  14235. * 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
  14236. * ```javascript
  14237. Page({
  14238. onLoad: function(){
  14239. wx.createIntersectionObserver().relativeToViewport({bottom: 100}).observe('.target-class', (res) => {
  14240. res.intersectionRatio // 相交区域占目标节点的布局区域的比例
  14241. res.intersectionRect // 相交区域
  14242. res.intersectionRect.left // 相交区域的左边界坐标
  14243. res.intersectionRect.top // 相交区域的上边界坐标
  14244. res.intersectionRect.width // 相交区域的宽度
  14245. res.intersectionRect.height // 相交区域的高度
  14246. })
  14247. }
  14248. })
  14249. ``` */
  14250. relativeToViewport(
  14251. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  14252. margins?: Margins
  14253. ): IntersectionObserver
  14254. }
  14255. interface InterstitialAd {
  14256. /** [InterstitialAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html)
  14257. *
  14258. * 需要基础库: `2.8.0`
  14259. *
  14260. * 在插件中使用:不支持
  14261. *
  14262. * 销毁插屏广告实例。 */
  14263. destroy(): void
  14264. /** [InterstitialAd.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html)
  14265. *
  14266. * 在插件中使用:不支持
  14267. *
  14268. * 移除插屏广告关闭事件的监听函数
  14269. *
  14270. * **示例代码**
  14271. *
  14272. * ```js
  14273. const listener = function (res) { console.log(res) }
  14274. InterstitialAd.onClose(listener)
  14275. InterstitialAd.offClose(listener) // 需传入与监听时同一个的函数对象
  14276. ``` */
  14277. offClose(
  14278. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  14279. listener?: UDPSocketOffCloseCallback
  14280. ): void
  14281. /** [InterstitialAd.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html)
  14282. *
  14283. * 在插件中使用:不支持
  14284. *
  14285. * 移除插屏错误事件的监听函数
  14286. *
  14287. * **示例代码**
  14288. *
  14289. * ```js
  14290. const listener = function (res) { console.log(res) }
  14291. InterstitialAd.onError(listener)
  14292. InterstitialAd.offError(listener) // 需传入与监听时同一个的函数对象
  14293. ``` */
  14294. offError(
  14295. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  14296. listener?: InterstitialAdOffErrorCallback
  14297. ): void
  14298. /** [InterstitialAd.offLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html)
  14299. *
  14300. * 在插件中使用:不支持
  14301. *
  14302. * 移除插屏广告加载事件的监听函数
  14303. *
  14304. * **示例代码**
  14305. *
  14306. * ```js
  14307. const listener = function (res) { console.log(res) }
  14308. InterstitialAd.onLoad(listener)
  14309. InterstitialAd.offLoad(listener) // 需传入与监听时同一个的函数对象
  14310. ``` */
  14311. offLoad(
  14312. /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
  14313. listener?: OffLoadCallback
  14314. ): void
  14315. /** [InterstitialAd.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html)
  14316. *
  14317. * 在插件中使用:不支持
  14318. *
  14319. * 监听插屏广告关闭事件。 */
  14320. onClose(
  14321. /** 插屏广告关闭事件的监听函数 */
  14322. listener: UDPSocketOnCloseCallback
  14323. ): void
  14324. /** [InterstitialAd.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html)
  14325. *
  14326. * 在插件中使用:不支持
  14327. *
  14328. * 监听插屏错误事件。
  14329. *
  14330. * **错误码信息与解决方案表**
  14331. *
  14332. * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
  14333. * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
  14334. *
  14335. * | 代码 | 异常情况 | 理由 | 解决方案 |
  14336. * | ------ | -------------- | --------------- | -------------------------- |
  14337. * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 |
  14338. * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。|
  14339. * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 |
  14340. * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。|
  14341. * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
  14342. * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  14343. * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  14344. * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
  14345. * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
  14346. onError(
  14347. /** 插屏错误事件的监听函数 */
  14348. listener: InterstitialAdOnErrorCallback
  14349. ): void
  14350. /** [InterstitialAd.onLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html)
  14351. *
  14352. * 在插件中使用:不支持
  14353. *
  14354. * 监听插屏广告加载事件。 */
  14355. onLoad(
  14356. /** 插屏广告加载事件的监听函数 */
  14357. listener: OnLoadCallback
  14358. ): void
  14359. /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html)
  14360. *
  14361. * 需要基础库: `2.8.0`
  14362. *
  14363. * 在插件中使用:不支持
  14364. *
  14365. * 加载插屏广告。 */
  14366. load(): Promise<any>
  14367. /** [Promise InterstitialAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html)
  14368. *
  14369. * 在插件中使用:不支持
  14370. *
  14371. * 显示插屏广告。
  14372. *
  14373. * **错误码信息表**
  14374. *
  14375. * 如果插屏广告显示失败,InterstitialAd.show() 方法会返回一个rejected Promise,开发者可以获取到错误码及对应的错误信息。
  14376. *
  14377. * | 代码 | 异常情况 | 理由 |
  14378. * | ------ | -------------- | -------------------------- |
  14379. * | 2001 | 触发频率限制 | 小程序启动一定时间内不允许展示插屏广告 |
  14380. * | 2002 | 触发频率限制 | 距离小程序插屏广告或者激励视频广告上次播放时间间隔不足,不允许展示插屏广告 |
  14381. * | 2003 | 触发频率限制 | 当前正在播放激励视频广告或者插屏广告,不允许再次展示插屏广告 |
  14382. * | 2004 | 广告渲染失败 | 该项错误不是开发者的异常情况,或因小程序页面切换导致广告渲染失败 |
  14383. * | 2005 | 广告调用异常 | 插屏广告实例不允许跨页面调用 | */
  14384. show(): Promise<any>
  14385. }
  14386. interface IsoDep {
  14387. /** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html)
  14388. *
  14389. * 需要基础库: `2.11.2`
  14390. *
  14391. * 在插件中使用:支持
  14392. *
  14393. * 断开连接 */
  14394. close(option?: NdefCloseOption): void
  14395. /** [IsoDep.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.connect.html)
  14396. *
  14397. * 需要基础库: `2.11.2`
  14398. *
  14399. * 在插件中使用:支持
  14400. *
  14401. * 连接 NFC 标签 */
  14402. connect(option?: NdefConnectOption): void
  14403. /** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html)
  14404. *
  14405. * 需要基础库: `2.11.2`
  14406. *
  14407. * 在插件中使用:支持
  14408. *
  14409. * 获取复位信息 */
  14410. getHistoricalBytes(option?: GetHistoricalBytesOption): void
  14411. /** [IsoDep.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getMaxTransceiveLength.html)
  14412. *
  14413. * 需要基础库: `2.11.2`
  14414. *
  14415. * 在插件中使用:支持
  14416. *
  14417. * 获取最大传输长度 */
  14418. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  14419. /** [IsoDep.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html)
  14420. *
  14421. * 需要基础库: `2.11.2`
  14422. *
  14423. * 在插件中使用:支持
  14424. *
  14425. * 检查是否已连接 */
  14426. isConnected(option?: IsConnectedOption): void
  14427. /** [IsoDep.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html)
  14428. *
  14429. * 需要基础库: `2.11.2`
  14430. *
  14431. * 在插件中使用:支持
  14432. *
  14433. * 设置超时时间 */
  14434. setTimeout(option: SetTimeoutOption): void
  14435. /** [IsoDep.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.transceive.html)
  14436. *
  14437. * 需要基础库: `2.11.2`
  14438. *
  14439. * 在插件中使用:支持
  14440. *
  14441. * 发送数据 */
  14442. transceive(option: TransceiveOption): void
  14443. }
  14444. interface Join1v1ChatError {
  14445. /** 错误信息
  14446. *
  14447. * | 错误码 | 错误信息 | 说明 |
  14448. * | - | - | - |
  14449. * | -20000 | not open 1v1 Chat | 未开通双人通话 |
  14450. * | -20001 | device not support | 当前设备不支持 |
  14451. * | -20002 | on call | 正在通话中 |
  14452. * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 |
  14453. * | -30000 | system error | 内部系统错误 |
  14454. * | -30001 | wechat has no camera authorization | 微信缺失相机权限 |
  14455. * | -30002 | wechat has no record authorization | 微信缺失录音权限 |
  14456. * | -30003 | miniprogram has no record authorization | 小程序缺失录音权限 |
  14457. * | -30004 | miniprogram has no camera authorization | 小程序缺失相机权限 |
  14458. * | -1 | | 当前已在房间内 |
  14459. * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 |
  14460. * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 |
  14461. * | -1000 | | 系统错误 | */ errMsg: string
  14462. /** 错误码
  14463. *
  14464. * | 错误码 | 错误信息 | 说明 |
  14465. * | - | - | - |
  14466. * | -20000 | not open 1v1 Chat | 未开通双人通话 |
  14467. * | -20001 | device not support | 当前设备不支持 |
  14468. * | -20002 | on call | 正在通话中 |
  14469. * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 |
  14470. * | -30000 | system error | 内部系统错误 |
  14471. * | -30001 | wechat has no camera authorization | 微信缺失相机权限 |
  14472. * | -30002 | wechat has no record authorization | 微信缺失录音权限 |
  14473. * | -30003 | miniprogram has no record authorization | 小程序缺失录音权限 |
  14474. * | -30004 | miniprogram has no camera authorization | 小程序缺失相机权限 |
  14475. * | -1 | | 当前已在房间内 |
  14476. * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 |
  14477. * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 |
  14478. * | -1000 | | 系统错误 | */ errCode: number
  14479. }
  14480. interface JoinVoIPChatError {
  14481. /** 错误信息
  14482. *
  14483. * | 错误码 | 错误信息 | 说明 |
  14484. * | - | - | - |
  14485. * | -1 | 当前已在房间内 | |
  14486. * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | |
  14487. * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | |
  14488. * | -1000 | 系统错误 | | */ errMsg: string
  14489. /** 错误码
  14490. *
  14491. * | 错误码 | 错误信息 | 说明 |
  14492. * | - | - | - |
  14493. * | -1 | 当前已在房间内 | |
  14494. * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | |
  14495. * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | |
  14496. * | -1000 | 系统错误 | | */ errCode: number
  14497. }
  14498. interface LivePlayerContext {
  14499. /** [LivePlayerContext.exitFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html)
  14500. *
  14501. * 在插件中使用:支持
  14502. *
  14503. * 退出全屏 */
  14504. exitFullScreen(option?: ExitFullScreenOption): void
  14505. /** [LivePlayerContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html)
  14506. *
  14507. * 在插件中使用:支持
  14508. *
  14509. * 退出小窗,该方法可在任意页面调用 */
  14510. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  14511. /** [LivePlayerContext.mute(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html)
  14512. *
  14513. * 在插件中使用:支持
  14514. *
  14515. * 静音 */
  14516. mute(option?: MuteOption): void
  14517. /** [LivePlayerContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.pause.html)
  14518. *
  14519. * 需要基础库: `1.9.90`
  14520. *
  14521. * 在插件中使用:支持
  14522. *
  14523. * 暂停 */
  14524. pause(option?: PauseOption): void
  14525. /** [LivePlayerContext.play(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html)
  14526. *
  14527. * 在插件中使用:支持
  14528. *
  14529. * 播放 */
  14530. play(option?: PlayOption): void
  14531. /** [LivePlayerContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html)
  14532. *
  14533. * 在插件中使用:支持
  14534. *
  14535. * 进入全屏 */
  14536. requestFullScreen(
  14537. option: LivePlayerContextRequestFullScreenOption
  14538. ): void
  14539. /** [LivePlayerContext.requestPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestPictureInPicture.html)
  14540. *
  14541. * 需要基础库: `2.15.0`
  14542. *
  14543. * 在插件中使用:支持
  14544. *
  14545. * 进入小窗 */
  14546. requestPictureInPicture(option?: RequestPictureInPictureOption): void
  14547. /** [LivePlayerContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.resume.html)
  14548. *
  14549. * 需要基础库: `1.9.90`
  14550. *
  14551. * 在插件中使用:支持
  14552. *
  14553. * 恢复 */
  14554. resume(option?: ResumeOption): void
  14555. /** [LivePlayerContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html)
  14556. *
  14557. * 需要基础库: `2.7.1`
  14558. *
  14559. * 在插件中使用:支持
  14560. *
  14561. * 截图 */
  14562. snapshot(option: LivePlayerContextSnapshotOption): void
  14563. /** [LivePlayerContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html)
  14564. *
  14565. * 在插件中使用:支持
  14566. *
  14567. * 停止 */
  14568. stop(option?: StopOption): void
  14569. }
  14570. interface LivePusherContext {
  14571. /** [LivePusherContext.applyBlusherStickMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyBlusherStickMakeup.html)
  14572. *
  14573. * 需要基础库: `2.14.0`
  14574. *
  14575. * 在插件中使用:不支持
  14576. *
  14577. * 添加腮红美妆特效 */
  14578. applyBlusherStickMakeup(option: ApplyBlusherStickMakeupOption): void
  14579. /** [LivePusherContext.applyEyeBrowMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyEyeBrowMakeup.html)
  14580. *
  14581. * 需要基础库: `2.14.0`
  14582. *
  14583. * 在插件中使用:不支持
  14584. *
  14585. * 添加眉毛美妆特效 */
  14586. applyEyeBrowMakeup(option: ApplyEyeBrowMakeupOption): void
  14587. /** [LivePusherContext.applyEyeShadowMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyEyeShadowMakeup.html)
  14588. *
  14589. * 需要基础库: `2.14.0`
  14590. *
  14591. * 在插件中使用:不支持
  14592. *
  14593. * 添加眼影美妆特效 */
  14594. applyEyeShadowMakeup(option: ApplyEyeShadowMakeupOption): void
  14595. /** [LivePusherContext.applyFaceContourMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyFaceContourMakeup.html)
  14596. *
  14597. * 需要基础库: `2.14.0`
  14598. *
  14599. * 在插件中使用:不支持
  14600. *
  14601. * 添加修容美妆特效 */
  14602. applyFaceContourMakeup(option: ApplyFaceContourMakeupOption): void
  14603. /** [LivePusherContext.applyFilter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyFilter.html)
  14604. *
  14605. * 需要基础库: `2.14.0`
  14606. *
  14607. * 在插件中使用:不支持
  14608. *
  14609. * 添加滤镜效果 */
  14610. applyFilter(option: ApplyFilterOption): void
  14611. /** [LivePusherContext.applyLipStickMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyLipStickMakeup.html)
  14612. *
  14613. * 需要基础库: `2.14.0`
  14614. *
  14615. * 在插件中使用:不支持
  14616. *
  14617. * 添加口红美妆特效 */
  14618. applyLipStickMakeup(option: ApplyLipStickMakeupOption): void
  14619. /** [LivePusherContext.applySticker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applySticker.html)
  14620. *
  14621. * 需要基础库: `2.14.0`
  14622. *
  14623. * 在插件中使用:不支持
  14624. *
  14625. * 添加贴纸特效 */
  14626. applySticker(option: ApplyStickerOption): void
  14627. /** [LivePusherContext.clearFilters(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearFilters.html)
  14628. *
  14629. * 需要基础库: `2.14.0`
  14630. *
  14631. * 在插件中使用:不支持
  14632. *
  14633. * 清除所有滤镜效果 */
  14634. clearFilters(option?: ClearFiltersOption): void
  14635. /** [LivePusherContext.clearMakeups(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearMakeups.html)
  14636. *
  14637. * 需要基础库: `2.14.0`
  14638. *
  14639. * 在插件中使用:不支持
  14640. *
  14641. * 清除所有美妆特效 */
  14642. clearMakeups(option?: ClearMakeupsOption): void
  14643. /** [LivePusherContext.clearStickers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearStickers.html)
  14644. *
  14645. * 需要基础库: `2.14.0`
  14646. *
  14647. * 在插件中使用:不支持
  14648. *
  14649. * 清除所有贴纸特效 */
  14650. clearStickers(option?: ClearStickersOption): void
  14651. /** [LivePusherContext.createOffscreenCanvas(object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.createOffscreenCanvas.html)
  14652. *
  14653. * 需要基础库: `2.29.0`
  14654. *
  14655. * 在插件中使用:支持
  14656. *
  14657. * 创建一个能够承接 LivePusher 采集纹理的离屏 Canvas,客户端 8.0.31 版本开始支持。 */
  14658. createOffscreenCanvas(
  14659. /** 同[wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) */
  14660. options: IAnyObject
  14661. ): void
  14662. /** [LivePusherContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.exitPictureInPicture.html)
  14663. *
  14664. * 需要基础库: `2.25.0`
  14665. *
  14666. * 在插件中使用:支持
  14667. *
  14668. * 退出小窗,该方法可在任意页面调用 */
  14669. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  14670. /** [LivePusherContext.onCustomRendererEvent(string event, function|function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.onCustomRendererEvent.html)
  14671. *
  14672. * 需要基础库: `2.29.0`
  14673. *
  14674. * 在插件中使用:支持
  14675. *
  14676. * 开启自定义渲染时,开发者通过此方法订阅相关事件,客户端 8.0.31 版本开始支持。 */
  14677. onCustomRendererEvent(
  14678. /** 事件类型,后订阅的监听器会取消之前的监听器
  14679. *
  14680. * 参数 event 可选值:
  14681. * - 'frame': 采集到视频帧后触发;
  14682. * - 'update': 推流尺寸变更时触发; */
  14683. event: 'frame' | 'update',
  14684. /** 自定义渲染事件处理回调函数 */
  14685. callback: CustomRendererFrameEventCallback
  14686. ): void
  14687. /** [LivePusherContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pause.html)
  14688. *
  14689. * 在插件中使用:支持
  14690. *
  14691. * 暂停推流 */
  14692. pause(option?: PauseOption): void
  14693. /** [LivePusherContext.pauseBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pauseBGM.html)
  14694. *
  14695. * 需要基础库: `2.4.0`
  14696. *
  14697. * 在插件中使用:支持
  14698. *
  14699. * 暂停背景音 */
  14700. pauseBGM(option?: PauseBGMOption): void
  14701. /** [LivePusherContext.playBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.playBGM.html)
  14702. *
  14703. * 需要基础库: `2.4.0`
  14704. *
  14705. * 在插件中使用:支持
  14706. *
  14707. * 播放背景音 */
  14708. playBGM(option: PlayBGMOption): void
  14709. /** [LivePusherContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resume.html)
  14710. *
  14711. * 在插件中使用:支持
  14712. *
  14713. * 恢复推流 */
  14714. resume(option?: ResumeOption): void
  14715. /** [LivePusherContext.resumeBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resumeBGM.html)
  14716. *
  14717. * 需要基础库: `2.4.0`
  14718. *
  14719. * 在插件中使用:支持
  14720. *
  14721. * 恢复背景音 */
  14722. resumeBGM(option?: ResumeBGMOption): void
  14723. /** [LivePusherContext.sendMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.sendMessage.html)
  14724. *
  14725. * 需要基础库: `2.10.0`
  14726. *
  14727. * 在插件中使用:支持
  14728. *
  14729. * 发送SEI消息 */
  14730. sendMessage(option: SendMessageOption): void
  14731. /** [LivePusherContext.setBGMVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setBGMVolume.html)
  14732. *
  14733. * 需要基础库: `2.4.0`
  14734. *
  14735. * 在插件中使用:支持
  14736. *
  14737. * 设置背景音音量 */
  14738. setBGMVolume(option: SetBGMVolumeOption): void
  14739. /** [LivePusherContext.setMICVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setMICVolume.html)
  14740. *
  14741. * 需要基础库: `2.10.0`
  14742. *
  14743. * 在插件中使用:支持
  14744. *
  14745. * 设置麦克风音量 */
  14746. setMICVolume(option: SetMICVolumeOption): void
  14747. /** [LivePusherContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.snapshot.html)
  14748. *
  14749. * 需要基础库: `1.9.90`
  14750. *
  14751. * 在插件中使用:支持
  14752. *
  14753. * 快照 */
  14754. snapshot(option: LivePusherContextSnapshotOption): void
  14755. /** [LivePusherContext.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.start.html)
  14756. *
  14757. * 在插件中使用:支持
  14758. *
  14759. * 开始推流,同时开启摄像头预览 */
  14760. start(option?: LivePusherContextStartOption): void
  14761. /** [LivePusherContext.startPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.startPreview.html)
  14762. *
  14763. * 需要基础库: `2.7.0`
  14764. *
  14765. * 在插件中使用:支持
  14766. *
  14767. * 开启摄像头预览 */
  14768. startPreview(option?: StartPreviewOption): void
  14769. /** [LivePusherContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stop.html)
  14770. *
  14771. * 在插件中使用:支持
  14772. *
  14773. * 停止推流,同时停止摄像头预览 */
  14774. stop(option?: StopOption): void
  14775. /** [LivePusherContext.stopBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopBGM.html)
  14776. *
  14777. * 需要基础库: `2.4.0`
  14778. *
  14779. * 在插件中使用:支持
  14780. *
  14781. * 停止背景音 */
  14782. stopBGM(option?: StopBGMOption): void
  14783. /** [LivePusherContext.stopPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopPreview.html)
  14784. *
  14785. * 需要基础库: `2.7.0`
  14786. *
  14787. * 在插件中使用:支持
  14788. *
  14789. * 关闭摄像头预览 */
  14790. stopPreview(option?: StopPreviewOption): void
  14791. /** [LivePusherContext.switchCamera(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.switchCamera.html)
  14792. *
  14793. * 在插件中使用:支持
  14794. *
  14795. * 切换前后摄像头 */
  14796. switchCamera(option?: SwitchCameraOption): void
  14797. /** [LivePusherContext.toggleTorch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.toggleTorch.html)
  14798. *
  14799. * 需要基础库: `2.1.0`
  14800. *
  14801. * 在插件中使用:支持
  14802. *
  14803. * 切换手电筒 */
  14804. toggleTorch(option?: ToggleTorchOption): void
  14805. }
  14806. interface LogManager {
  14807. /** [LogManager.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.debug.html)
  14808. *
  14809. * 在插件中使用:不支持
  14810. *
  14811. * 写 debug 日志 */
  14812. debug(
  14813. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  14814. ...args: any[]
  14815. ): void
  14816. /** [LogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.info.html)
  14817. *
  14818. * 在插件中使用:不支持
  14819. *
  14820. * 写 info 日志 */
  14821. info(
  14822. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  14823. ...args: any[]
  14824. ): void
  14825. /** [LogManager.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.log.html)
  14826. *
  14827. * 在插件中使用:不支持
  14828. *
  14829. * 写 log 日志 */
  14830. log(
  14831. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  14832. ...args: any[]
  14833. ): void
  14834. /** [LogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.warn.html)
  14835. *
  14836. * 在插件中使用:不支持
  14837. *
  14838. * 写 warn 日志 */
  14839. warn(
  14840. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  14841. ...args: any[]
  14842. ): void
  14843. }
  14844. interface MapContext {
  14845. /** [MapContext.addArc(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addArc.html)
  14846. *
  14847. * 需要基础库: `2.22.0`
  14848. *
  14849. * 在插件中使用:支持
  14850. *
  14851. * 添加弧线,途经点与夹角必须设置一个。途经点必须在起终点有效坐标范围内,否则不能生成正确的弧线,同时设置夹角角度时,以夹角角度为准。夹角定义为起点到终点,与起点外切线逆时针旋转的角度。工具侧暂未支持。 */
  14852. addArc(option: AddArcOption): void
  14853. /** [MapContext.addCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html)
  14854. *
  14855. * 需要基础库: `2.12.0`
  14856. *
  14857. * 在插件中使用:支持
  14858. *
  14859. * 添加个性化图层。图层创建[参考文档](https://lbs.qq.com/dev/console/customLayer/create) */
  14860. addCustomLayer(option: AddCustomLayerOption): void
  14861. /** [MapContext.addGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addGroundOverlay.html)
  14862. *
  14863. * 需要基础库: `2.14.0`
  14864. *
  14865. * 在插件中使用:支持
  14866. *
  14867. * 创建自定义图片图层,图片会随着地图缩放而缩放。 */
  14868. addGroundOverlay(option: AddGroundOverlayOption): void
  14869. /** [MapContext.addMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addMarkers.html)
  14870. *
  14871. * 需要基础库: `2.13.0`
  14872. *
  14873. * 在插件中使用:支持
  14874. *
  14875. * 添加 marker。 */
  14876. addMarkers(option: AddMarkersOption): void
  14877. /** [MapContext.addVisualLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addVisualLayer.html)
  14878. *
  14879. * 需要基础库: `2.20.1`
  14880. *
  14881. * 在插件中使用:支持
  14882. *
  14883. * 添加可视化图层。需要刷新时,interval 可设置的最小值为 15 s。 */
  14884. addVisualLayer(option: AddVisualLayerOption): void
  14885. /** [MapContext.executeVisualLayerCommand(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.executeVisualLayerCommand.html)
  14886. *
  14887. * 需要基础库: `2.26.0`
  14888. *
  14889. * 在插件中使用:支持
  14890. *
  14891. * 执行可视化图层指令,结合 `MapContext.on('visualLayerEvent')` 监听事件使用。 */
  14892. executeVisualLayerCommand(option: ExecuteVisualLayerCommandOption): void
  14893. /** [MapContext.fromScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.fromScreenLocation.html)
  14894. *
  14895. * 需要基础库: `2.14.0`
  14896. *
  14897. * 在插件中使用:支持
  14898. *
  14899. * 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。 */
  14900. fromScreenLocation(option: FromScreenLocationOption): void
  14901. /** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html)
  14902. *
  14903. * 在插件中使用:支持
  14904. *
  14905. * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */
  14906. getCenterLocation(option: GetCenterLocationOption): void
  14907. /** [MapContext.getRegion(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html)
  14908. *
  14909. * 需要基础库: `1.4.0`
  14910. *
  14911. * 在插件中使用:支持
  14912. *
  14913. * 获取当前地图的视野范围 */
  14914. getRegion(option?: GetRegionOption): void
  14915. /** [MapContext.getRotate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRotate.html)
  14916. *
  14917. * 需要基础库: `2.8.0`
  14918. *
  14919. * 在插件中使用:支持
  14920. *
  14921. * 获取当前地图的旋转角 */
  14922. getRotate(option?: GetRotateOption): void
  14923. /** [MapContext.getScale(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getScale.html)
  14924. *
  14925. * 需要基础库: `1.4.0`
  14926. *
  14927. * 在插件中使用:支持
  14928. *
  14929. * 获取当前地图的缩放级别 */
  14930. getScale(option?: GetScaleOption): void
  14931. /** [MapContext.getSkew(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html)
  14932. *
  14933. * 需要基础库: `2.8.0`
  14934. *
  14935. * 在插件中使用:支持
  14936. *
  14937. * 获取当前地图的倾斜角 */
  14938. getSkew(option?: GetSkewOption): void
  14939. /** [MapContext.includePoints(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html)
  14940. *
  14941. * 需要基础库: `1.2.0`
  14942. *
  14943. * 在插件中使用:支持
  14944. *
  14945. * 缩放视野展示所有经纬度 */
  14946. includePoints(option: IncludePointsOption): void
  14947. /** [MapContext.initMarkerCluster(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.initMarkerCluster.html)
  14948. *
  14949. * 需要基础库: `2.13.0`
  14950. *
  14951. * 在插件中使用:支持
  14952. *
  14953. * 初始化点聚合的配置,未调用时采用默认配置。 */
  14954. initMarkerCluster(option: InitMarkerClusterOption): void
  14955. /** [MapContext.moveAlong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveAlong.html)
  14956. *
  14957. * 需要基础库: `2.13.0`
  14958. *
  14959. * 在插件中使用:支持
  14960. *
  14961. * 沿指定路径移动 `marker`,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 `marker` 再次调用 `moveAlong` 方法,前一次的动画将被打断。 */
  14962. moveAlong(option: MoveAlongOption): void
  14963. /** [MapContext.moveToLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html)
  14964. *
  14965. * 需要基础库: `1.2.0`
  14966. *
  14967. * 在插件中使用:支持
  14968. *
  14969. * 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。[2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持将地图中心移动到指定位置。 */
  14970. moveToLocation(option?: MoveToLocationOption): void
  14971. /** [MapContext.on(string event, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.on.html)
  14972. *
  14973. * 需要基础库: `2.13.0`
  14974. *
  14975. * 在插件中使用:支持
  14976. *
  14977. * 监听地图事件。
  14978. *
  14979. * ### visualLayerEvent
  14980. *
  14981. * 可视化图层 visualLayer 统一回调出口,[2.26.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持。
  14982. *
  14983. * #### 返回参数
  14984. *
  14985. * | 参数 | 类型 | 说明 |
  14986. * | --------- | ------ | -------- |
  14987. * | layerId | String | 图层 id |
  14988. * | eventType | String | 事件类型 |
  14989. * | eventInfo | String | 事件信息 |
  14990. *
  14991. * ### markerClusterCreate
  14992. *
  14993. * 缩放或拖动导致新的聚合簇产生时触发,仅返回新创建的聚合簇信息。
  14994. *
  14995. * #### 返回参数
  14996. *
  14997. * | 参数 | 类型 | 说明 |
  14998. * | -------- | -------------------- | ---------- |
  14999. * | clusters | `Array<ClusterInfo>` | 聚合簇数据 |
  15000. *
  15001. * ### markerClusterClick
  15002. *
  15003. * 聚合簇的点击事件。
  15004. *
  15005. * #### 返回参数
  15006. *
  15007. * | 参数 | 类型 | 说明 |
  15008. * | --------- | ------------- | --------- |
  15009. * | cluster | ClusterInfo | 聚合簇 |
  15010. *
  15011. * #### ClusterInfo 结构
  15012. *
  15013. * | 参数 | 类型 | 说明 |
  15014. * | --------- | --------------- | -------------------------- |
  15015. * | clusterId | Number | 聚合簇的 id |
  15016. * | center | LatLng | 聚合簇的坐标 |
  15017. * | markerIds | `Array<Number>` | 该聚合簇内的点标记数据数组 |
  15018. *
  15019. * **示例代码**
  15020. *
  15021. * ```js
  15022. MapContext.on('visualLayerEvent', (res) => {})
  15023. MapContext.on('markerClusterCreate', (res) => {})
  15024. MapContext.on('markerClusterClick', (res) => {})
  15025. ``` */
  15026. on(
  15027. /** 事件名
  15028. *
  15029. * 参数 event 可选值:
  15030. * - 'markerClusterCreate': ;
  15031. * - 'markerClusterClick': ;
  15032. * - 'visualLayerEvent': ; */
  15033. event:
  15034. | 'markerClusterCreate'
  15035. | 'markerClusterClick'
  15036. | 'visualLayerEvent',
  15037. /** 事件的回调函数 */
  15038. callback: (...args: any[]) => any
  15039. ): void
  15040. /** [MapContext.openMapApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.openMapApp.html)
  15041. *
  15042. * 需要基础库: `2.14.0`
  15043. *
  15044. * 在插件中使用:支持
  15045. *
  15046. * 拉起地图APP选择导航。 */
  15047. openMapApp(option: OpenMapAppOption): void
  15048. /** [MapContext.removeArc(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeArc.html)
  15049. *
  15050. * 需要基础库: `2.22.0`
  15051. *
  15052. * 在插件中使用:支持
  15053. *
  15054. * 删除弧线。工具侧暂未支持。 */
  15055. removeArc(option: RemoveArcOption): void
  15056. /** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html)
  15057. *
  15058. * 需要基础库: `2.12.0`
  15059. *
  15060. * 在插件中使用:支持
  15061. *
  15062. * 移除个性化图层。 */
  15063. removeCustomLayer(option: RemoveCustomLayerOption): void
  15064. /** [MapContext.removeGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeGroundOverlay.html)
  15065. *
  15066. * 需要基础库: `2.14.0`
  15067. *
  15068. * 在插件中使用:支持
  15069. *
  15070. * 移除自定义图片图层。 */
  15071. removeGroundOverlay(option: RemoveGroundOverlayOption): void
  15072. /** [MapContext.removeMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeMarkers.html)
  15073. *
  15074. * 需要基础库: `2.13.0`
  15075. *
  15076. * 在插件中使用:支持
  15077. *
  15078. * 移除 marker。 */
  15079. removeMarkers(option: RemoveMarkersOption): void
  15080. /** [MapContext.removeVisualLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeVisualLayer.html)
  15081. *
  15082. * 需要基础库: `2.20.1`
  15083. *
  15084. * 在插件中使用:支持
  15085. *
  15086. * 移除可视化图层。 */
  15087. removeVisualLayer(option: RemoveVisualLayerOption): void
  15088. /** [MapContext.setBoundary(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setBoundary.html)
  15089. *
  15090. * 需要基础库: `2.22.0`
  15091. *
  15092. * 在插件中使用:支持
  15093. *
  15094. * 限制地图的显示范围。此接口同时会限制地图的最小缩放整数级别。 */
  15095. setBoundary(option: SetBoundaryOption): void
  15096. /** [MapContext.setCenterOffset(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html)
  15097. *
  15098. * 需要基础库: `2.10.0`
  15099. *
  15100. * 在插件中使用:支持
  15101. *
  15102. * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5] */
  15103. setCenterOffset(option: SetCenterOffsetOption): void
  15104. /** [MapContext.setLocMarkerIcon(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setLocMarkerIcon.html)
  15105. *
  15106. * 需要基础库: `2.16.0`
  15107. *
  15108. * 在插件中使用:支持
  15109. *
  15110. * 设置定位点图标,支持网络路径、本地路径、代码包路径 */
  15111. setLocMarkerIcon(option: SetLocMarkerIconOption): void
  15112. /** [MapContext.toScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html)
  15113. *
  15114. * 需要基础库: `2.14.0`
  15115. *
  15116. * 在插件中使用:支持
  15117. *
  15118. * 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。 */
  15119. toScreenLocation(option: ToScreenLocationOption): void
  15120. /** [MapContext.translateMarker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html)
  15121. *
  15122. * 需要基础库: `1.2.0`
  15123. *
  15124. * 在插件中使用:支持
  15125. *
  15126. * 平移marker,带动画。 */
  15127. translateMarker(option: TranslateMarkerOption): void
  15128. /** [MapContext.updateGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.updateGroundOverlay.html)
  15129. *
  15130. * 需要基础库: `2.14.0`
  15131. *
  15132. * 在插件中使用:支持
  15133. *
  15134. * 更新自定义图片图层。 */
  15135. updateGroundOverlay(option: UpdateGroundOverlayOption): void
  15136. }
  15137. interface MediaAudioPlayer {
  15138. /** [Promise MediaAudioPlayer.addAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.addAudioSource.html)
  15139. *
  15140. * 在插件中使用:支持
  15141. *
  15142. * 添加音频源 */
  15143. addAudioSource(
  15144. /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
  15145. *
  15146. * 视频解码器实例。作为音频源添加到音频播放器中 */
  15147. source: VideoDecoder
  15148. ): Promise<any>
  15149. /** [Promise MediaAudioPlayer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.destroy.html)
  15150. *
  15151. * 在插件中使用:支持
  15152. *
  15153. * 销毁播放器 */
  15154. destroy(): Promise<any>
  15155. /** [Promise MediaAudioPlayer.removeAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.removeAudioSource.html)
  15156. *
  15157. * 在插件中使用:支持
  15158. *
  15159. * 移除音频源 */
  15160. removeAudioSource(
  15161. /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
  15162. *
  15163. * 视频解码器实例 */
  15164. source: VideoDecoder
  15165. ): Promise<any>
  15166. /** [Promise MediaAudioPlayer.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.start.html)
  15167. *
  15168. * 在插件中使用:支持
  15169. *
  15170. * 启动播放器 */
  15171. start(): Promise<any>
  15172. /** [Promise MediaAudioPlayer.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.stop.html)
  15173. *
  15174. * 在插件中使用:支持
  15175. *
  15176. * 停止播放器 */
  15177. stop(): Promise<any>
  15178. }
  15179. interface MediaContainer {
  15180. /** [MediaContainer.addTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.addTrack.html)
  15181. *
  15182. * 需要基础库: `2.9.0`
  15183. *
  15184. * 在插件中使用:支持
  15185. *
  15186. * 将音频或视频轨道添加到容器 */
  15187. addTrack(
  15188. /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
  15189. *
  15190. * 要添加的音频或视频轨道 */
  15191. track: MediaTrack
  15192. ): void
  15193. /** [MediaContainer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.destroy.html)
  15194. *
  15195. * 需要基础库: `2.9.0`
  15196. *
  15197. * 在插件中使用:支持
  15198. *
  15199. * 将容器销毁,释放资源 */
  15200. destroy(): void
  15201. /** [MediaContainer.export()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.export.html)
  15202. *
  15203. * 需要基础库: `2.9.0`
  15204. *
  15205. * 在插件中使用:支持
  15206. *
  15207. * 将容器内的轨道合并并导出视频文件 */
  15208. export(): void
  15209. /** [MediaContainer.extractDataSource(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html)
  15210. *
  15211. * 需要基础库: `2.9.0`
  15212. *
  15213. * 在插件中使用:支持
  15214. *
  15215. * 将传入的视频源分离轨道。不会自动将轨道添加到待合成的容器里。 */
  15216. extractDataSource(option: ExtractDataSourceOption): void
  15217. /** [MediaContainer.removeTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.removeTrack.html)
  15218. *
  15219. * 需要基础库: `2.9.0`
  15220. *
  15221. * 在插件中使用:支持
  15222. *
  15223. * 将音频或视频轨道从容器中移除 */
  15224. removeTrack(
  15225. /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
  15226. *
  15227. * 要移除的音频或视频轨道 */
  15228. track: MediaTrack
  15229. ): void
  15230. }
  15231. interface MediaQueryObserver {
  15232. /** [MediaQueryObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.disconnect.html)
  15233. *
  15234. * 在插件中使用:支持
  15235. *
  15236. * 停止监听。回调函数将不再触发 */
  15237. disconnect(): void
  15238. /** [MediaQueryObserver.observe(Object descriptor, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.observe.html)
  15239. *
  15240. * 在插件中使用:支持
  15241. *
  15242. * 开始监听页面 media query 变化情况 */
  15243. observe(
  15244. /** media query 描述符 */
  15245. descriptor: ObserveDescriptor,
  15246. /** 监听 media query 状态变化的回调函数 */
  15247. callback: MediaQueryObserverObserveCallback
  15248. ): void
  15249. }
  15250. interface MediaRecorder {
  15251. /** [MediaRecorder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.off.html)
  15252. *
  15253. * 需要基础库: `2.11.0`
  15254. *
  15255. * 在插件中使用:支持
  15256. *
  15257. * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。 */
  15258. off(
  15259. /** 事件名 */
  15260. eventName: string,
  15261. /** 事件触发时执行的回调函数 */
  15262. callback: (...args: any[]) => any
  15263. ): void
  15264. /** [MediaRecorder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.on.html)
  15265. *
  15266. * 需要基础库: `2.11.0`
  15267. *
  15268. * 在插件中使用:支持
  15269. *
  15270. * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行。 */
  15271. on(
  15272. /** 事件名
  15273. *
  15274. * 参数 eventName 可选值:
  15275. * - 'start': 录制开始事件。;
  15276. * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize};
  15277. * - 'pause': 录制暂停事件。;
  15278. * - 'resume': 录制继续事件。;
  15279. * - 'timeupdate': 录制时间更新事件。; */
  15280. eventName: 'start' | 'stop' | 'pause' | 'resume' | 'timeupdate',
  15281. /** 事件触发时执行的回调函数 */
  15282. callback: (...args: any[]) => any
  15283. ): void
  15284. /** [Promise MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html)
  15285. *
  15286. * 需要基础库: `2.11.0`
  15287. *
  15288. * 在插件中使用:支持
  15289. *
  15290. * 销毁录制器 */
  15291. destroy(): Promise<any>
  15292. /** [Promise MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html)
  15293. *
  15294. * 需要基础库: `2.11.0`
  15295. *
  15296. * 在插件中使用:支持
  15297. *
  15298. * 暂停录制 */
  15299. pause(): Promise<any>
  15300. /** [Promise MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html)
  15301. *
  15302. * 需要基础库: `2.11.0`
  15303. *
  15304. * 在插件中使用:支持
  15305. *
  15306. * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧 */
  15307. requestFrame(callback: (...args: any[]) => any): Promise<any>
  15308. /** [Promise MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html)
  15309. *
  15310. * 需要基础库: `2.11.0`
  15311. *
  15312. * 在插件中使用:支持
  15313. *
  15314. * 恢复录制 */
  15315. resume(): Promise<any>
  15316. /** [Promise MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html)
  15317. *
  15318. * 需要基础库: `2.11.0`
  15319. *
  15320. * 在插件中使用:支持
  15321. *
  15322. * 开始录制 */
  15323. start(): Promise<any>
  15324. /** [Promise MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html)
  15325. *
  15326. * 需要基础库: `2.11.0`
  15327. *
  15328. * 在插件中使用:支持
  15329. *
  15330. * 结束录制 */
  15331. stop(): Promise<any>
  15332. }
  15333. interface MifareClassic {
  15334. /** [MifareClassic.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html)
  15335. *
  15336. * 需要基础库: `2.11.2`
  15337. *
  15338. * 在插件中使用:支持
  15339. *
  15340. * 断开连接 */
  15341. close(option?: NdefCloseOption): void
  15342. /** [MifareClassic.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.connect.html)
  15343. *
  15344. * 需要基础库: `2.11.2`
  15345. *
  15346. * 在插件中使用:支持
  15347. *
  15348. * 连接 NFC 标签 */
  15349. connect(option?: NdefConnectOption): void
  15350. /** [MifareClassic.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html)
  15351. *
  15352. * 需要基础库: `2.11.2`
  15353. *
  15354. * 在插件中使用:支持
  15355. *
  15356. * 获取最大传输长度 */
  15357. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  15358. /** [MifareClassic.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html)
  15359. *
  15360. * 需要基础库: `2.11.2`
  15361. *
  15362. * 在插件中使用:支持
  15363. *
  15364. * 检查是否已连接 */
  15365. isConnected(option?: IsConnectedOption): void
  15366. /** [MifareClassic.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html)
  15367. *
  15368. * 需要基础库: `2.11.2`
  15369. *
  15370. * 在插件中使用:支持
  15371. *
  15372. * 设置超时时间 */
  15373. setTimeout(option: SetTimeoutOption): void
  15374. /** [MifareClassic.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.transceive.html)
  15375. *
  15376. * 需要基础库: `2.11.2`
  15377. *
  15378. * 在插件中使用:支持
  15379. *
  15380. * 发送数据 */
  15381. transceive(option: TransceiveOption): void
  15382. }
  15383. interface MifareUltralight {
  15384. /** [MifareUltralight.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.close.html)
  15385. *
  15386. * 需要基础库: `2.11.2`
  15387. *
  15388. * 在插件中使用:支持
  15389. *
  15390. * 断开连接 */
  15391. close(option?: NdefCloseOption): void
  15392. /** [MifareUltralight.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.connect.html)
  15393. *
  15394. * 需要基础库: `2.11.2`
  15395. *
  15396. * 在插件中使用:支持
  15397. *
  15398. * 连接 NFC 标签 */
  15399. connect(option?: NdefConnectOption): void
  15400. /** [MifareUltralight.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html)
  15401. *
  15402. * 需要基础库: `2.11.2`
  15403. *
  15404. * 在插件中使用:支持
  15405. *
  15406. * 获取最大传输长度 */
  15407. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  15408. /** [MifareUltralight.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html)
  15409. *
  15410. * 需要基础库: `2.11.2`
  15411. *
  15412. * 在插件中使用:支持
  15413. *
  15414. * 检查是否已连接 */
  15415. isConnected(option?: IsConnectedOption): void
  15416. /** [MifareUltralight.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html)
  15417. *
  15418. * 需要基础库: `2.11.2`
  15419. *
  15420. * 在插件中使用:支持
  15421. *
  15422. * 设置超时时间 */
  15423. setTimeout(option: SetTimeoutOption): void
  15424. /** [MifareUltralight.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.transceive.html)
  15425. *
  15426. * 需要基础库: `2.11.2`
  15427. *
  15428. * 在插件中使用:支持
  15429. *
  15430. * 发送数据 */
  15431. transceive(option: TransceiveOption): void
  15432. }
  15433. interface NFCAdapter {
  15434. /** [NFCAdapter.offDiscovered(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html)
  15435. *
  15436. * 需要基础库: `2.11.2`
  15437. *
  15438. * 在插件中使用:支持
  15439. *
  15440. * 移除 NFC Tag的监听函数
  15441. *
  15442. * **示例代码**
  15443. *
  15444. * ```js
  15445. const listener = function (res) { console.log(res) }
  15446. NFCAdapter.onDiscovered(listener)
  15447. NFCAdapter.offDiscovered(listener) // 需传入与监听时同一个的函数对象
  15448. ``` */
  15449. offDiscovered(
  15450. /** onDiscovered 传入的监听函数。不传此参数则移除所有监听函数。 */
  15451. listener?: OffDiscoveredCallback
  15452. ): void
  15453. /** [NFCAdapter.onDiscovered(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html)
  15454. *
  15455. * 需要基础库: `2.11.2`
  15456. *
  15457. * 在插件中使用:支持
  15458. *
  15459. * 监听 NFC Tag */
  15460. onDiscovered(
  15461. /** 的监听函数 */
  15462. listener: OnDiscoveredCallback
  15463. ): void
  15464. /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html)
  15465. *
  15466. * 需要基础库: `2.11.2`
  15467. *
  15468. * 在插件中使用:支持 */
  15469. startDiscovery(option?: StartDiscoveryOption): void
  15470. /** [NFCAdapter.stopDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html)
  15471. *
  15472. * 需要基础库: `2.11.2`
  15473. *
  15474. * 在插件中使用:支持 */
  15475. stopDiscovery(option?: StopDiscoveryOption): void
  15476. /** [[IsoDep](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html) NFCAdapter.getIsoDep()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html)
  15477. *
  15478. * 需要基础库: `2.11.2`
  15479. *
  15480. * 在插件中使用:支持
  15481. *
  15482. * 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */
  15483. getIsoDep(): IsoDep
  15484. /** [[MifareClassic](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html) NFCAdapter.getMifareClassic()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html)
  15485. *
  15486. * 需要基础库: `2.11.2`
  15487. *
  15488. * 在插件中使用:支持
  15489. *
  15490. * 获取MifareClassic实例,实例支持MIFARE Classic标签的读写 */
  15491. getMifareClassic(): MifareClassic
  15492. /** [[MifareUltralight](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html) NFCAdapter.getMifareUltralight()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html)
  15493. *
  15494. * 需要基础库: `2.11.2`
  15495. *
  15496. * 在插件中使用:支持
  15497. *
  15498. * 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */
  15499. getMifareUltralight(): MifareUltralight
  15500. /** [[Ndef](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html) NFCAdapter.getNdef()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html)
  15501. *
  15502. * 需要基础库: `2.11.2`
  15503. *
  15504. * 在插件中使用:支持
  15505. *
  15506. * 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */
  15507. getNdef(): Ndef
  15508. /** [[NfcA](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html) NFCAdapter.getNfcA()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html)
  15509. *
  15510. * 需要基础库: `2.11.2`
  15511. *
  15512. * 在插件中使用:支持
  15513. *
  15514. * 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */
  15515. getNfcA(): NfcA
  15516. /** [[NfcB](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html) NFCAdapter.getNfcB()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html)
  15517. *
  15518. * 需要基础库: `2.11.2`
  15519. *
  15520. * 在插件中使用:支持
  15521. *
  15522. * 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */
  15523. getNfcB(): NfcB
  15524. /** [[NfcF](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html) NFCAdapter.getNfcF()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html)
  15525. *
  15526. * 需要基础库: `2.11.2`
  15527. *
  15528. * 在插件中使用:支持
  15529. *
  15530. * 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */
  15531. getNfcF(): NfcF
  15532. /** [[NfcV](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html) NFCAdapter.getNfcV()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html)
  15533. *
  15534. * 需要基础库: `2.11.2`
  15535. *
  15536. * 在插件中使用:支持
  15537. *
  15538. * 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */
  15539. getNfcV(): NfcV
  15540. }
  15541. interface NFCError {
  15542. /** 错误信息
  15543. *
  15544. * | 错误码 | 错误信息 | 说明 |
  15545. * | - | - | - |
  15546. * | 0 | ok | 正常 |
  15547. * | 13000 | | 当前设备不支持NFC |
  15548. * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 |
  15549. * | 13002 | | 当前设备支持NFC,但不支持HCE |
  15550. * | 13003 | | AID列表参数格式错误 |
  15551. * | 13004 | | 未设置微信为默认NFC支付应用 |
  15552. * | 13005 | | 返回的指令不合法 |
  15553. * | 13006 | | 注册AID失败 | */ errMsg: string
  15554. /** 错误码
  15555. *
  15556. * | 错误码 | 错误信息 | 说明 |
  15557. * | - | - | - |
  15558. * | 0 | ok | 正常 |
  15559. * | 13000 | | 当前设备不支持NFC |
  15560. * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 |
  15561. * | 13002 | | 当前设备支持NFC,但不支持HCE |
  15562. * | 13003 | | AID列表参数格式错误 |
  15563. * | 13004 | | 未设置微信为默认NFC支付应用 |
  15564. * | 13005 | | 返回的指令不合法 |
  15565. * | 13006 | | 注册AID失败 | */ errCode: number
  15566. }
  15567. interface Ndef {
  15568. /** [Ndef.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.close.html)
  15569. *
  15570. * 需要基础库: `2.11.2`
  15571. *
  15572. * 在插件中使用:支持
  15573. *
  15574. * 断开连接 */
  15575. close(option?: NdefCloseOption): void
  15576. /** [Ndef.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.connect.html)
  15577. *
  15578. * 需要基础库: `2.11.2`
  15579. *
  15580. * 在插件中使用:支持
  15581. *
  15582. * 连接 NFC 标签 */
  15583. connect(option?: NdefConnectOption): void
  15584. /** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html)
  15585. *
  15586. * 需要基础库: `2.11.2`
  15587. *
  15588. * 在插件中使用:支持
  15589. *
  15590. * 检查是否已连接 */
  15591. isConnected(option?: IsConnectedOption): void
  15592. /** [Ndef.offNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html)
  15593. *
  15594. * 需要基础库: `2.11.2`
  15595. *
  15596. * 在插件中使用:支持
  15597. *
  15598. * 取消监听 Ndef 消息 */
  15599. offNdefMessage(callback: (...args: any[]) => any): void
  15600. /** [Ndef.onNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.onNdefMessage.html)
  15601. *
  15602. * 需要基础库: `2.11.2`
  15603. *
  15604. * 在插件中使用:支持
  15605. *
  15606. * 监听 Ndef 消息 */
  15607. onNdefMessage(callback: (...args: any[]) => any): void
  15608. /** [Ndef.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.setTimeout.html)
  15609. *
  15610. * 需要基础库: `2.11.2`
  15611. *
  15612. * 在插件中使用:支持
  15613. *
  15614. * 设置超时时间 */
  15615. setTimeout(option: SetTimeoutOption): void
  15616. /** [Ndef.writeNdefMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.writeNdefMessage.html)
  15617. *
  15618. * 需要基础库: `2.11.2`
  15619. *
  15620. * 在插件中使用:支持
  15621. *
  15622. * 重写 Ndef 标签内容 */
  15623. writeNdefMessage(option: WriteNdefMessageOption): void
  15624. }
  15625. interface NfcA {
  15626. /** [NfcA.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.close.html)
  15627. *
  15628. * 需要基础库: `2.11.2`
  15629. *
  15630. * 在插件中使用:支持
  15631. *
  15632. * 断开连接 */
  15633. close(option?: NdefCloseOption): void
  15634. /** [NfcA.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.connect.html)
  15635. *
  15636. * 需要基础库: `2.11.2`
  15637. *
  15638. * 在插件中使用:支持
  15639. *
  15640. * 连接 NFC 标签 */
  15641. connect(option?: NdefConnectOption): void
  15642. /** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html)
  15643. *
  15644. * 需要基础库: `2.11.2`
  15645. *
  15646. * 在插件中使用:支持
  15647. *
  15648. * 获取ATQA信息 */
  15649. getAtqa(option?: GetAtqaOption): void
  15650. /** [NfcA.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getMaxTransceiveLength.html)
  15651. *
  15652. * 需要基础库: `2.11.2`
  15653. *
  15654. * 在插件中使用:支持
  15655. *
  15656. * 获取最大传输长度 */
  15657. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  15658. /** [NfcA.getSak(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html)
  15659. *
  15660. * 需要基础库: `2.11.2`
  15661. *
  15662. * 在插件中使用:支持
  15663. *
  15664. * 获取SAK信息 */
  15665. getSak(option?: GetSakOption): void
  15666. /** [NfcA.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html)
  15667. *
  15668. * 需要基础库: `2.11.2`
  15669. *
  15670. * 在插件中使用:支持
  15671. *
  15672. * 检查是否已连接 */
  15673. isConnected(option?: IsConnectedOption): void
  15674. /** [NfcA.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html)
  15675. *
  15676. * 需要基础库: `2.11.2`
  15677. *
  15678. * 在插件中使用:支持
  15679. *
  15680. * 设置超时时间 */
  15681. setTimeout(option: SetTimeoutOption): void
  15682. /** [NfcA.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.transceive.html)
  15683. *
  15684. * 需要基础库: `2.11.2`
  15685. *
  15686. * 在插件中使用:支持
  15687. *
  15688. * 发送数据 */
  15689. transceive(option: TransceiveOption): void
  15690. }
  15691. interface NfcB {
  15692. /** [NfcB.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.close.html)
  15693. *
  15694. * 需要基础库: `2.11.2`
  15695. *
  15696. * 在插件中使用:支持
  15697. *
  15698. * 断开连接 */
  15699. close(option?: NdefCloseOption): void
  15700. /** [NfcB.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.connect.html)
  15701. *
  15702. * 需要基础库: `2.11.2`
  15703. *
  15704. * 在插件中使用:支持
  15705. *
  15706. * 连接 NFC 标签 */
  15707. connect(option?: NdefConnectOption): void
  15708. /** [NfcB.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html)
  15709. *
  15710. * 需要基础库: `2.11.2`
  15711. *
  15712. * 在插件中使用:支持
  15713. *
  15714. * 获取最大传输长度 */
  15715. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  15716. /** [NfcB.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html)
  15717. *
  15718. * 需要基础库: `2.11.2`
  15719. *
  15720. * 在插件中使用:支持
  15721. *
  15722. * 检查是否已连接 */
  15723. isConnected(option?: IsConnectedOption): void
  15724. /** [NfcB.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html)
  15725. *
  15726. * 需要基础库: `2.11.2`
  15727. *
  15728. * 在插件中使用:支持
  15729. *
  15730. * 设置超时时间 */
  15731. setTimeout(option: SetTimeoutOption): void
  15732. /** [NfcB.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.transceive.html)
  15733. *
  15734. * 需要基础库: `2.11.2`
  15735. *
  15736. * 在插件中使用:支持
  15737. *
  15738. * 发送数据 */
  15739. transceive(option: TransceiveOption): void
  15740. }
  15741. interface NfcF {
  15742. /** [NfcF.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.close.html)
  15743. *
  15744. * 需要基础库: `2.11.2`
  15745. *
  15746. * 在插件中使用:支持
  15747. *
  15748. * 断开连接 */
  15749. close(option?: NdefCloseOption): void
  15750. /** [NfcF.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.connect.html)
  15751. *
  15752. * 需要基础库: `2.11.2`
  15753. *
  15754. * 在插件中使用:支持
  15755. *
  15756. * 连接 NFC 标签 */
  15757. connect(option?: NdefConnectOption): void
  15758. /** [NfcF.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html)
  15759. *
  15760. * 需要基础库: `2.11.2`
  15761. *
  15762. * 在插件中使用:支持
  15763. *
  15764. * 获取最大传输长度 */
  15765. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  15766. /** [NfcF.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html)
  15767. *
  15768. * 需要基础库: `2.11.2`
  15769. *
  15770. * 在插件中使用:支持
  15771. *
  15772. * 检查是否已连接 */
  15773. isConnected(option?: IsConnectedOption): void
  15774. /** [NfcF.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html)
  15775. *
  15776. * 需要基础库: `2.11.2`
  15777. *
  15778. * 在插件中使用:支持
  15779. *
  15780. * 设置超时时间 */
  15781. setTimeout(option: SetTimeoutOption): void
  15782. /** [NfcF.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.transceive.html)
  15783. *
  15784. * 需要基础库: `2.11.2`
  15785. *
  15786. * 在插件中使用:支持
  15787. *
  15788. * 发送数据 */
  15789. transceive(option: TransceiveOption): void
  15790. }
  15791. interface NfcV {
  15792. /** [NfcV.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.close.html)
  15793. *
  15794. * 需要基础库: `2.11.2`
  15795. *
  15796. * 在插件中使用:支持
  15797. *
  15798. * 断开连接 */
  15799. close(option?: NdefCloseOption): void
  15800. /** [NfcV.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.connect.html)
  15801. *
  15802. * 需要基础库: `2.11.2`
  15803. *
  15804. * 在插件中使用:支持
  15805. *
  15806. * 连接 NFC 标签 */
  15807. connect(option?: NdefConnectOption): void
  15808. /** [NfcV.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html)
  15809. *
  15810. * 需要基础库: `2.11.2`
  15811. *
  15812. * 在插件中使用:支持
  15813. *
  15814. * 获取最大传输长度 */
  15815. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  15816. /** [NfcV.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html)
  15817. *
  15818. * 需要基础库: `2.11.2`
  15819. *
  15820. * 在插件中使用:支持
  15821. *
  15822. * 检查是否已连接 */
  15823. isConnected(option?: IsConnectedOption): void
  15824. /** [NfcV.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html)
  15825. *
  15826. * 需要基础库: `2.11.2`
  15827. *
  15828. * 在插件中使用:支持
  15829. *
  15830. * 设置超时时间 */
  15831. setTimeout(option: SetTimeoutOption): void
  15832. /** [NfcV.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.transceive.html)
  15833. *
  15834. * 需要基础库: `2.11.2`
  15835. *
  15836. * 在插件中使用:支持
  15837. *
  15838. * 发送数据 */
  15839. transceive(option: TransceiveOption): void
  15840. }
  15841. interface Nfcrwerror {
  15842. /** 错误信息
  15843. *
  15844. * | 错误码 | 错误信息 | 说明 |
  15845. * | - | - | - |
  15846. * | 13000 | 设备不支持NFC | |
  15847. * | 13001 | 系统NFC开关未打开 | |
  15848. * | 13010 | 未知错误 | |
  15849. * | 13019 | user is not authorized | 用户未授权 |
  15850. * | 13011 | invalid parameter | 参数无效 |
  15851. * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 |
  15852. * | 13021 | NFC discovery already started | 已经开始NFC扫描 |
  15853. * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 |
  15854. * | 13022 | Tech already connected | 标签已经连接 |
  15855. * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 |
  15856. * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 |
  15857. * | 13014 | invalid tech | 无效的标签技术 |
  15858. * | 13015 | unavailable tech | 从标签上获取对应技术失败 |
  15859. * | 13024 | function not support | 当前标签技术不支持该功能 |
  15860. * | 13017 | system internal error | 相关读写操作失败 |
  15861. * | 13016 | connect fail | 连接失败 | */ errMsg: string
  15862. /** 错误码
  15863. *
  15864. * | 错误码 | 错误信息 | 说明 |
  15865. * | - | - | - |
  15866. * | 13000 | 设备不支持NFC | |
  15867. * | 13001 | 系统NFC开关未打开 | |
  15868. * | 13010 | 未知错误 | |
  15869. * | 13019 | user is not authorized | 用户未授权 |
  15870. * | 13011 | invalid parameter | 参数无效 |
  15871. * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 |
  15872. * | 13021 | NFC discovery already started | 已经开始NFC扫描 |
  15873. * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 |
  15874. * | 13022 | Tech already connected | 标签已经连接 |
  15875. * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 |
  15876. * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 |
  15877. * | 13014 | invalid tech | 无效的标签技术 |
  15878. * | 13015 | unavailable tech | 从标签上获取对应技术失败 |
  15879. * | 13024 | function not support | 当前标签技术不支持该功能 |
  15880. * | 13017 | system internal error | 相关读写操作失败 |
  15881. * | 13016 | connect fail | 连接失败 | */ errCode: number
  15882. }
  15883. interface NodesRef {
  15884. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.boundingClientRect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html)
  15885. *
  15886. * 在插件中使用:支持
  15887. *
  15888. * 添加节点的布局位置的查询请求。相对于显示区域,以像素为单位。其功能类似于 DOM 的 `getBoundingClientRect`。返回 `NodesRef` 对应的 `SelectorQuery`。
  15889. *
  15890. * **示例代码**
  15891. *
  15892. * ```js
  15893. Page({
  15894. getRect () {
  15895. wx.createSelectorQuery().select('#the-id').boundingClientRect(function(rect){
  15896. rect.id // 节点的ID
  15897. rect.dataset // 节点的dataset
  15898. rect.left // 节点的左边界坐标
  15899. rect.right // 节点的右边界坐标
  15900. rect.top // 节点的上边界坐标
  15901. rect.bottom // 节点的下边界坐标
  15902. rect.width // 节点的宽度
  15903. rect.height // 节点的高度
  15904. }).exec()
  15905. },
  15906. getAllRects () {
  15907. wx.createSelectorQuery().selectAll('.a-class').boundingClientRect(function(rects){
  15908. rects.forEach(function(rect){
  15909. rect.id // 节点的ID
  15910. rect.dataset // 节点的dataset
  15911. rect.left // 节点的左边界坐标
  15912. rect.right // 节点的右边界坐标
  15913. rect.top // 节点的上边界坐标
  15914. rect.bottom // 节点的下边界坐标
  15915. rect.width // 节点的宽度
  15916. rect.height // 节点的高度
  15917. })
  15918. }).exec()
  15919. }
  15920. })
  15921. ``` */
  15922. boundingClientRect(
  15923. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  15924. callback?: BoundingClientRectCallback
  15925. ): SelectorQuery
  15926. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.context(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.context.html)
  15927. *
  15928. * 需要基础库: `2.4.2`
  15929. *
  15930. * 在插件中使用:支持
  15931. *
  15932. * 添加节点的 Context 对象查询请求。目前支持 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html)、[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html)、[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html)、[EditorContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html)和 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 的获取。
  15933. *
  15934. * **示例代码**
  15935. *
  15936. * ```js
  15937. Page({
  15938. getContext () {
  15939. wx.createSelectorQuery().select('.the-video-class').context(function(res){
  15940. console.log(res.context) // 节点对应的 Context 对象。如:选中的节点是 <video> 组件,那么此处即返回 VideoContext 对象
  15941. }).exec()
  15942. }
  15943. })
  15944. ``` */
  15945. context(
  15946. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  15947. callback?: ContextCallback
  15948. ): SelectorQuery
  15949. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.fields(Object fields, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.fields.html)
  15950. *
  15951. * 在插件中使用:支持
  15952. *
  15953. * 获取节点的相关信息。需要获取的字段在fields中指定。返回值是 `nodesRef` 对应的 `selectorQuery`
  15954. *
  15955. * **注意**
  15956. *
  15957. * computedStyle 的优先级高于 size,当同时在 computedStyle 里指定了 width/height 和传入了 size: true,则优先返回 computedStyle 获取到的 width/height。
  15958. *
  15959. * **示例代码**
  15960. *
  15961. * ```js
  15962. Page({
  15963. getFields () {
  15964. wx.createSelectorQuery().select('#the-id').fields({
  15965. dataset: true,
  15966. size: true,
  15967. scrollOffset: true,
  15968. properties: ['scrollX', 'scrollY'],
  15969. computedStyle: ['margin', 'backgroundColor'],
  15970. context: true,
  15971. }, function (res) {
  15972. res.dataset // 节点的dataset
  15973. res.width // 节点的宽度
  15974. res.height // 节点的高度
  15975. res.scrollLeft // 节点的水平滚动位置
  15976. res.scrollTop // 节点的竖直滚动位置
  15977. res.scrollX // 节点 scroll-x 属性的当前值
  15978. res.scrollY // 节点 scroll-y 属性的当前值
  15979. // 此处返回指定要返回的样式名
  15980. res.margin
  15981. res.backgroundColor
  15982. res.context // 节点对应的 Context 对象
  15983. }).exec()
  15984. }
  15985. })
  15986. ``` */
  15987. fields(
  15988. fields: Fields,
  15989. /** 回调函数 */
  15990. callback?: FieldsCallback
  15991. ): SelectorQuery
  15992. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.node(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.node.html)
  15993. *
  15994. * 需要基础库: `2.7.0`
  15995. *
  15996. * 在插件中使用:支持
  15997. *
  15998. * 获取 Node 节点实例。目前支持 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html) 和 [ScrollViewContext](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.html) 的获取。
  15999. *
  16000. * **示例代码**
  16001. *
  16002. * ```js
  16003. Page({
  16004. getNode() {
  16005. wx.createSelectorQuery().select('.canvas').node(function(res){
  16006. console.log(res.node) // 节点对应的 Canvas 实例。
  16007. }).exec()
  16008. }
  16009. })
  16010. ``` */
  16011. node(
  16012. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  16013. callback?: NodeCallback
  16014. ): SelectorQuery
  16015. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.scrollOffset(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.scrollOffset.html)
  16016. *
  16017. * 在插件中使用:支持
  16018. *
  16019. * 添加节点的滚动位置查询请求。以像素为单位。节点必须是 `scroll-view` 或者 `viewport`,返回 `NodesRef` 对应的 `SelectorQuery`。
  16020. *
  16021. * **示例代码**
  16022. *
  16023. * ```js
  16024. Page({
  16025. getScrollOffset () {
  16026. wx.createSelectorQuery().selectViewport().scrollOffset(function(res){
  16027. res.id // 节点的ID
  16028. res.dataset // 节点的dataset
  16029. res.scrollLeft // 节点的水平滚动位置
  16030. res.scrollTop // 节点的竖直滚动位置
  16031. }).exec()
  16032. }
  16033. })
  16034. ``` */
  16035. scrollOffset(
  16036. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  16037. callback?: ScrollOffsetCallback
  16038. ): SelectorQuery
  16039. }
  16040. interface OffscreenCanvas {
  16041. /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) OffscreenCanvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.createImage.html)
  16042. *
  16043. * 需要基础库: `2.7.3`
  16044. *
  16045. * 在插件中使用:需要基础库 `2.16.1`
  16046. *
  16047. * 创建一个图片对象。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
  16048. *
  16049. * ****
  16050. *
  16051. * 注意不允许混用 webgl 和 2d 画布创建的图片对象,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。 */
  16052. createImage(): Image
  16053. /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) OffscreenCanvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html)
  16054. *
  16055. * 需要基础库: `2.7.0`
  16056. *
  16057. * 在插件中使用:需要基础库 `2.16.1`
  16058. *
  16059. * 该方法返回 OffscreenCanvas 的绘图上下文
  16060. *
  16061. * ****
  16062. *
  16063. * 注意不允许混用 webgl 和 2d 绘图上下文,传入的 contextType 必须要与 `wx.createOffscreenCanvas` 传入的 type 类型一致。 */
  16064. getContext(
  16065. /** 绘图上下文类型,需要与 createOffscreenCanvas 时传入的 type 一致
  16066. *
  16067. * 参数 contextType 可选值:
  16068. * - 'webgl': webgl类型上下文;
  16069. * - '2d': 2d类型上下文; */
  16070. contextType: 'webgl' | '2d'
  16071. ): any
  16072. }
  16073. interface OpenSyncError {
  16074. /** 错误信息
  16075. *
  16076. * | 错误信息 | 说明 |
  16077. * | - | - |
  16078. * | fail no such file or directory "${filePath}" | 上级目录不存在 | */ errMsg: string
  16079. /** 错误码
  16080. *
  16081. * | 错误信息 | 说明 |
  16082. * | - | - |
  16083. * | fail no such file or directory "${filePath}" | 上级目录不存在 | */ errCode: number
  16084. }
  16085. interface Performance {
  16086. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html)
  16087. *
  16088. * 需要基础库: `2.11.0`
  16089. *
  16090. * 在插件中使用:不支持
  16091. *
  16092. * 该方法返回当前缓冲区中的所有性能数据 */
  16093. getEntries(): PerformanceEntry[]
  16094. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByName.html)
  16095. *
  16096. * 需要基础库: `2.11.0`
  16097. *
  16098. * 在插件中使用:不支持
  16099. *
  16100. * 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据 */
  16101. getEntriesByName(
  16102. /** 名称 */
  16103. name: string,
  16104. /** 类型 */
  16105. entryType?: string
  16106. ): PerformanceEntry[]
  16107. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByType.html)
  16108. *
  16109. * 需要基础库: `2.11.0`
  16110. *
  16111. * 在插件中使用:不支持
  16112. *
  16113. * 获取当前缓冲区中所有类型为 [entryType] 的性能数据 */
  16114. getEntriesByType(
  16115. /** 类型 */
  16116. entryType: string
  16117. ): PerformanceEntry[]
  16118. /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.setBufferSize.html)
  16119. *
  16120. * 需要基础库: `2.11.0`
  16121. *
  16122. * 在插件中使用:不支持
  16123. *
  16124. * 设置缓冲区大小,默认缓冲 30 条性能数据 */
  16125. setBufferSize(size: number): void
  16126. /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.createObserver.html)
  16127. *
  16128. * 需要基础库: `2.11.0`
  16129. *
  16130. * 在插件中使用:不支持
  16131. *
  16132. * 创建全局性能事件监听器 */
  16133. createObserver(
  16134. /** 回调函数 */
  16135. callback: (...args: any[]) => any
  16136. ): PerformanceObserver
  16137. }
  16138. interface PerformanceObserver {
  16139. /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.disconnect.html)
  16140. *
  16141. * 需要基础库: `2.11.0`
  16142. *
  16143. * 在插件中使用:不支持
  16144. *
  16145. * 停止监听 */
  16146. disconnect(): void
  16147. /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.observe.html)
  16148. *
  16149. * 需要基础库: `2.11.0`
  16150. *
  16151. * 在插件中使用:不支持
  16152. *
  16153. * 开始监听 */
  16154. observe(
  16155. /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
  16156. options: ObserveOption
  16157. ): void
  16158. }
  16159. interface PreDownloadSubpackageTask {
  16160. /** [PreDownloadSubpackageTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/PreDownloadSubpackageTask.onProgressUpdate.html)
  16161. *
  16162. * 需要基础库: `2.27.3`
  16163. *
  16164. * 在插件中使用:不支持
  16165. *
  16166. * 监听分包加载进度变化事件 */
  16167. onProgressUpdate(
  16168. /** 分包加载进度变化事件的监听函数 */
  16169. listener: PreDownloadSubpackageTaskOnProgressUpdateCallback
  16170. ): void
  16171. }
  16172. interface ReadCompressedFileSyncError {
  16173. /** 错误信息
  16174. *
  16175. * | 错误信息 | 说明 |
  16176. * | - | - |
  16177. * | fail decompress fail | 指定的 compressionAlgorithm 与文件实际压缩格式不符 |
  16178. * | fail no such file or directory, open ${filePath} | 指定的 filePath 所在目录不存在 |
  16179. * | fail permission denied, open ${dirPath} | 指定的 filePath 路径没有读权限 | */ errMsg: string
  16180. /** 错误码
  16181. *
  16182. * | 错误信息 | 说明 |
  16183. * | - | - |
  16184. * | fail decompress fail | 指定的 compressionAlgorithm 与文件实际压缩格式不符 |
  16185. * | fail no such file or directory, open ${filePath} | 指定的 filePath 所在目录不存在 |
  16186. * | fail permission denied, open ${dirPath} | 指定的 filePath 路径没有读权限 | */ errCode: number
  16187. }
  16188. interface ReadSyncError {
  16189. /** 错误信息
  16190. *
  16191. * | 错误信息 | 说明 |
  16192. * | - | - |
  16193. * | bad file descriptor | 无效的文件描述符 |
  16194. * | fail permission denied | 指定的 fd 路径没有读权限 |
  16195. * | fail the value of "offset" is out of range | 传入的 offset 不合法 |
  16196. * | fail the value of "length" is out of range | 传入的 length 不合法 |
  16197. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errMsg: string
  16198. /** 错误码
  16199. *
  16200. * | 错误信息 | 说明 |
  16201. * | - | - |
  16202. * | bad file descriptor | 无效的文件描述符 |
  16203. * | fail permission denied | 指定的 fd 路径没有读权限 |
  16204. * | fail the value of "offset" is out of range | 传入的 offset 不合法 |
  16205. * | fail the value of "length" is out of range | 传入的 length 不合法 |
  16206. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errCode: number
  16207. }
  16208. interface RealtimeLogManager {
  16209. /** [Object RealtimeLogManager.getCurrentState()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.getCurrentState.html)
  16210. *
  16211. * 需要基础库: `2.19.4`
  16212. *
  16213. * 在插件中使用:不支持
  16214. *
  16215. * 实时日志会将一定时间间隔内缓存的日志聚合上报,如果该时间内缓存的内容超出限制,则会被丢弃。此方法可以获取当前缓存剩余空间。
  16216. *
  16217. * > 注意:基础库内部在对日志进行上报时会补充一些结构化数据,如果遇到上报溢出的情况也会补充警告日志,所以此方法获取到的当前占用信息会比预期的大一些。 */
  16218. getCurrentState(): CurrentState
  16219. /** [RealtimeLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html)
  16220. *
  16221. * 需要基础库: `2.8.1`
  16222. *
  16223. * 在插件中使用:不支持
  16224. *
  16225. * 添加过滤关键字,暂不支持在插件使用 */
  16226. addFilterMsg(
  16227. /** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */
  16228. msg: string
  16229. ): void
  16230. /** [RealtimeLogManager.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.error.html)
  16231. *
  16232. * 需要基础库: `2.7.1`
  16233. *
  16234. * 在插件中使用:不支持
  16235. *
  16236. * 写 error 日志,暂不支持在插件使用 */
  16237. error(
  16238. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  16239. ...args: any[]
  16240. ): void
  16241. /** [RealtimeLogManager.in(Page pageInstance)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.in.html)
  16242. *
  16243. * 需要基础库: `2.9.1`
  16244. *
  16245. * 在插件中使用:不支持
  16246. *
  16247. * 设置实时日志page参数所在的页面,暂不支持在插件使用 */
  16248. in(
  16249. /** page实例 */
  16250. pageInstance: Page.TrivialInstance
  16251. ): void
  16252. /** [RealtimeLogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.info.html)
  16253. *
  16254. * 需要基础库: `2.7.1`
  16255. *
  16256. * 在插件中使用:不支持
  16257. *
  16258. * 写 info 日志,暂不支持在插件使用 */
  16259. info(
  16260. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  16261. ...args: any[]
  16262. ): void
  16263. /** [RealtimeLogManager.setFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.setFilterMsg.html)
  16264. *
  16265. * 需要基础库: `2.7.3`
  16266. *
  16267. * 在插件中使用:不支持
  16268. *
  16269. * 设置过滤关键字,暂不支持在插件使用 */
  16270. setFilterMsg(
  16271. /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
  16272. msg: string
  16273. ): void
  16274. /** [RealtimeLogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.warn.html)
  16275. *
  16276. * 需要基础库: `2.7.1`
  16277. *
  16278. * 在插件中使用:不支持
  16279. *
  16280. * 写 warn 日志,暂不支持在插件使用 */
  16281. warn(
  16282. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  16283. ...args: any[]
  16284. ): void
  16285. /** [[RealtimeTagLogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.html) RealtimeLogManager.tag(string tagName)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.tag.html)
  16286. *
  16287. * 需要基础库: `2.16.0`
  16288. *
  16289. * 在插件中使用:需要基础库 `2.16.0`
  16290. *
  16291. * 获取给定标签的日志管理器实例,目前只支持在插件使用 */
  16292. tag(
  16293. /** 标签名 */
  16294. tagName: string
  16295. ): RealtimeTagLogManager
  16296. }
  16297. interface RealtimeTagLogManager {
  16298. /** [RealtimeTagLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.addFilterMsg.html)
  16299. *
  16300. * 需要基础库: `2.16.0`
  16301. *
  16302. * 在插件中使用:需要基础库 `2.16.0`
  16303. *
  16304. * 添加过滤关键字 */
  16305. addFilterMsg(
  16306. /** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */
  16307. msg: string
  16308. ): void
  16309. /** [RealtimeTagLogManager.error(string key, Object|Array.&lt;any&gt;|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.error.html)
  16310. *
  16311. * 需要基础库: `2.16.0`
  16312. *
  16313. * 在插件中使用:需要基础库 `2.16.0`
  16314. *
  16315. * 写 error 日志 */
  16316. error(
  16317. /** 日志的 key */
  16318. key: string,
  16319. /** 日志的值,每次调用的参数的总大小不超过5Kb */
  16320. value: IAnyObject | any[] | number | string
  16321. ): void
  16322. /** [RealtimeTagLogManager.info(string key, Object|Array.&lt;any&gt;|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.info.html)
  16323. *
  16324. * 需要基础库: `2.16.0`
  16325. *
  16326. * 在插件中使用:需要基础库 `2.16.0`
  16327. *
  16328. * 写 info 日志 */
  16329. info(
  16330. /** 日志的 key */
  16331. key: string,
  16332. /** 日志的值,每次调用的参数的总大小不超过5Kb */
  16333. value: IAnyObject | any[] | number | string
  16334. ): void
  16335. /** [RealtimeTagLogManager.setFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.setFilterMsg.html)
  16336. *
  16337. * 需要基础库: `2.16.0`
  16338. *
  16339. * 在插件中使用:需要基础库 `2.16.0`
  16340. *
  16341. * 设置过滤关键字 */
  16342. setFilterMsg(
  16343. /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
  16344. msg: string
  16345. ): void
  16346. /** [RealtimeTagLogManager.warn(string key, Object|Array.&lt;any&gt;|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.warn.html)
  16347. *
  16348. * 需要基础库: `2.16.0`
  16349. *
  16350. * 在插件中使用:需要基础库 `2.16.0`
  16351. *
  16352. * 写 warn 日志 */
  16353. warn(
  16354. /** 日志的 key */
  16355. key: string,
  16356. /** 日志的值,每次调用的参数的总大小不超过5Kb */
  16357. value: IAnyObject | any[] | number | string
  16358. ): void
  16359. }
  16360. interface RecorderManager {
  16361. /** [RecorderManager.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onError.html)
  16362. *
  16363. * 在插件中使用:支持
  16364. *
  16365. * 监听录音错误事件 */
  16366. onError(
  16367. /** 录音错误事件的监听函数 */
  16368. listener: UDPSocketOnErrorCallback
  16369. ): void
  16370. /** [RecorderManager.onFrameRecorded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html)
  16371. *
  16372. * 在插件中使用:支持
  16373. *
  16374. * 监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。 */
  16375. onFrameRecorded(
  16376. /** 已录制完指定帧大小的文件事件的监听函数 */
  16377. listener: OnFrameRecordedCallback
  16378. ): void
  16379. /** [RecorderManager.onInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionBegin.html)
  16380. *
  16381. * 需要基础库: `2.3.0`
  16382. *
  16383. * 在插件中使用:支持
  16384. *
  16385. * 监听录音因为受到系统占用而被中断开始事件。以下场景会触发此事件:微信语音聊天、微信视频聊天。此事件触发后,录音会被暂停。pause 事件在此事件后触发 */
  16386. onInterruptionBegin(
  16387. /** 录音因为受到系统占用而被中断开始事件的监听函数 */
  16388. listener: OnInterruptionBeginCallback
  16389. ): void
  16390. /** [RecorderManager.onInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionEnd.html)
  16391. *
  16392. * 需要基础库: `2.3.0`
  16393. *
  16394. * 在插件中使用:支持
  16395. *
  16396. * 监听录音中断结束事件。在收到 interruptionBegin 事件之后,小程序内所有录音会暂停,收到此事件之后才可再次录音成功。 */
  16397. onInterruptionEnd(
  16398. /** 录音中断结束事件的监听函数 */
  16399. listener: OnInterruptionEndCallback
  16400. ): void
  16401. /** [RecorderManager.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onPause.html)
  16402. *
  16403. * 在插件中使用:支持
  16404. *
  16405. * 监听录音暂停事件 */
  16406. onPause(
  16407. /** 录音暂停事件的监听函数 */
  16408. listener: OnPauseCallback
  16409. ): void
  16410. /** [RecorderManager.onResume(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html)
  16411. *
  16412. * 在插件中使用:支持
  16413. *
  16414. * 监听录音继续事件 */
  16415. onResume(
  16416. /** 录音继续事件的监听函数 */
  16417. listener: OnResumeCallback
  16418. ): void
  16419. /** [RecorderManager.onStart(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStart.html)
  16420. *
  16421. * 在插件中使用:支持
  16422. *
  16423. * 监听录音开始事件 */
  16424. onStart(
  16425. /** 录音开始事件的监听函数 */
  16426. listener: OnStartCallback
  16427. ): void
  16428. /** [RecorderManager.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStop.html)
  16429. *
  16430. * 在插件中使用:支持
  16431. *
  16432. * 监听录音结束事件 */
  16433. onStop(
  16434. /** 录音结束事件的监听函数 */
  16435. listener: RecorderManagerOnStopCallback
  16436. ): void
  16437. /** [RecorderManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.pause.html)
  16438. *
  16439. * 在插件中使用:支持
  16440. *
  16441. * 暂停录音 */
  16442. pause(): void
  16443. /** [RecorderManager.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.resume.html)
  16444. *
  16445. * 在插件中使用:支持
  16446. *
  16447. * 继续录音 */
  16448. resume(): void
  16449. /** [RecorderManager.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html)
  16450. *
  16451. * 在插件中使用:支持
  16452. *
  16453. * 开始录音
  16454. *
  16455. * **采样率与编码码率限制**
  16456. *
  16457. * 每种采样率有对应的编码码率范围有效值,设置不合法的采样率或编码码率会导致录音失败,具体对应关系如下表。
  16458. *
  16459. * | 采样率 | 编码码率 |
  16460. * | ------ | -------------- |
  16461. * | 8000 | 16000 ~ 48000 |
  16462. * | 11025 | 16000 ~ 48000 |
  16463. * | 12000 | 24000 ~ 64000 |
  16464. * | 16000 | 24000 ~ 96000 |
  16465. * | 22050 | 32000 ~ 128000 |
  16466. * | 24000 | 32000 ~ 128000 |
  16467. * | 32000 | 48000 ~ 192000 |
  16468. * | 44100 | 64000 ~ 320000 |
  16469. * | 48000 | 64000 ~ 320000 | */
  16470. start(option: RecorderManagerStartOption): void
  16471. /** [RecorderManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.stop.html)
  16472. *
  16473. * 在插件中使用:支持
  16474. *
  16475. * 停止录音 */
  16476. stop(): void
  16477. }
  16478. interface RequestTask {
  16479. /** [RequestTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.abort.html)
  16480. *
  16481. * 需要基础库: `1.4.0`
  16482. *
  16483. * 在插件中使用:支持
  16484. *
  16485. * 中断请求任务 */
  16486. abort(): void
  16487. /** [RequestTask.offChunkReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offChunkReceived.html)
  16488. *
  16489. * 需要基础库: `2.20.1`
  16490. *
  16491. * 在插件中使用:支持
  16492. *
  16493. * 移除 Transfer-Encoding Chunk Received 事件的监听函数
  16494. *
  16495. * **示例代码**
  16496. *
  16497. * ```js
  16498. const listener = function (res) { console.log(res) }
  16499. RequestTask.onChunkReceived(listener)
  16500. RequestTask.offChunkReceived(listener) // 需传入与监听时同一个的函数对象
  16501. ``` */
  16502. offChunkReceived(
  16503. /** onChunkReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  16504. listener?: OffChunkReceivedCallback
  16505. ): void
  16506. /** [RequestTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html)
  16507. *
  16508. * 需要基础库: `2.1.0`
  16509. *
  16510. * 在插件中使用:支持
  16511. *
  16512. * 移除 HTTP Response Header 事件的监听函数
  16513. *
  16514. * **示例代码**
  16515. *
  16516. * ```js
  16517. const listener = function (res) { console.log(res) }
  16518. RequestTask.onHeadersReceived(listener)
  16519. RequestTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
  16520. ``` */
  16521. offHeadersReceived(
  16522. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  16523. listener?: OffHeadersReceivedCallback
  16524. ): void
  16525. /** [RequestTask.onChunkReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onChunkReceived.html)
  16526. *
  16527. * 需要基础库: `2.20.1`
  16528. *
  16529. * 在插件中使用:支持
  16530. *
  16531. * 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。 */
  16532. onChunkReceived(
  16533. /** Transfer-Encoding Chunk Received 事件的监听函数 */
  16534. listener: OnChunkReceivedCallback
  16535. ): void
  16536. /** [RequestTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html)
  16537. *
  16538. * 需要基础库: `2.1.0`
  16539. *
  16540. * 在插件中使用:支持
  16541. *
  16542. * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
  16543. onHeadersReceived(
  16544. /** HTTP Response Header 事件的监听函数 */
  16545. listener: OnHeadersReceivedCallback
  16546. ): void
  16547. }
  16548. interface RewardedVideoAd {
  16549. /** [Promise RewardedVideoAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.load.html)
  16550. *
  16551. * 在插件中使用:不支持
  16552. *
  16553. * 加载激励视频广告。 */
  16554. load(): Promise<any>
  16555. /** [Promise RewardedVideoAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.show.html)
  16556. *
  16557. * 在插件中使用:不支持
  16558. *
  16559. * 显示激励视频广告。激励视频广告将从屏幕下方推入。 */
  16560. show(): Promise<any>
  16561. /** [RewardedVideoAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.destroy.html)
  16562. *
  16563. * 需要基础库: `2.8.0`
  16564. *
  16565. * 在插件中使用:不支持
  16566. *
  16567. * 销毁激励视频广告实例。 */
  16568. destroy(): void
  16569. /** [RewardedVideoAd.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html)
  16570. *
  16571. * 在插件中使用:不支持
  16572. *
  16573. * 移除用户点击 `关闭广告` 按钮的事件的监听函数
  16574. *
  16575. * **示例代码**
  16576. *
  16577. * ```js
  16578. const listener = function (res) { console.log(res) }
  16579. RewardedVideoAd.onClose(listener)
  16580. RewardedVideoAd.offClose(listener) // 需传入与监听时同一个的函数对象
  16581. ``` */
  16582. offClose(
  16583. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  16584. listener?: RewardedVideoAdOffCloseCallback
  16585. ): void
  16586. /** [RewardedVideoAd.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html)
  16587. *
  16588. * 在插件中使用:不支持
  16589. *
  16590. * 移除激励视频错误事件的监听函数
  16591. *
  16592. * **示例代码**
  16593. *
  16594. * ```js
  16595. const listener = function (res) { console.log(res) }
  16596. RewardedVideoAd.onError(listener)
  16597. RewardedVideoAd.offError(listener) // 需传入与监听时同一个的函数对象
  16598. ``` */
  16599. offError(
  16600. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  16601. listener?: RewardedVideoAdOffErrorCallback
  16602. ): void
  16603. /** [RewardedVideoAd.offLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html)
  16604. *
  16605. * 在插件中使用:不支持
  16606. *
  16607. * 移除激励视频广告加载事件的监听函数
  16608. *
  16609. * **示例代码**
  16610. *
  16611. * ```js
  16612. const listener = function (res) { console.log(res) }
  16613. RewardedVideoAd.onLoad(listener)
  16614. RewardedVideoAd.offLoad(listener) // 需传入与监听时同一个的函数对象
  16615. ``` */
  16616. offLoad(
  16617. /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
  16618. listener?: OffLoadCallback
  16619. ): void
  16620. /** [RewardedVideoAd.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html)
  16621. *
  16622. * 在插件中使用:不支持
  16623. *
  16624. * 监听用户点击 `关闭广告` 按钮的事件。 */
  16625. onClose(
  16626. /** 用户点击 `关闭广告` 按钮的事件的监听函数 */
  16627. listener: RewardedVideoAdOnCloseCallback
  16628. ): void
  16629. /** [RewardedVideoAd.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html)
  16630. *
  16631. * 在插件中使用:不支持
  16632. *
  16633. * 监听激励视频错误事件。
  16634. *
  16635. * **错误码信息与解决方案表**
  16636. *
  16637. * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
  16638. * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
  16639. *
  16640. * | 代码 | 异常情况 | 理由 | 解决方案 |
  16641. * | ------ | -------------- | --------------- | -------------------------- |
  16642. * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 |
  16643. * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。|
  16644. * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 |
  16645. * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。|
  16646. * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
  16647. * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  16648. * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  16649. * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
  16650. * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
  16651. onError(
  16652. /** 激励视频错误事件的监听函数 */
  16653. listener: RewardedVideoAdOnErrorCallback
  16654. ): void
  16655. /** [RewardedVideoAd.onLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html)
  16656. *
  16657. * 在插件中使用:不支持
  16658. *
  16659. * 监听激励视频广告加载事件。 */
  16660. onLoad(
  16661. /** 激励视频广告加载事件的监听函数 */
  16662. listener: OnLoadCallback
  16663. ): void
  16664. }
  16665. interface ScrollViewContext {
  16666. /** [ScrollViewContext.scrollIntoView(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollIntoView.html)
  16667. *
  16668. * 需要基础库: `2.14.4`
  16669. *
  16670. * 在插件中使用:支持
  16671. *
  16672. * 滚动至指定位置 */
  16673. scrollIntoView(
  16674. /** 元素选择器 */
  16675. selector: string
  16676. ): void
  16677. /** [ScrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollTo.html)
  16678. *
  16679. * 需要基础库: `2.14.4`
  16680. *
  16681. * 在插件中使用:支持
  16682. *
  16683. * 滚动至指定位置 */
  16684. scrollTo(option: ScrollToOption): void
  16685. }
  16686. interface SelectorQuery {
  16687. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.exec(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html)
  16688. *
  16689. * 在插件中使用:支持
  16690. *
  16691. * 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。 */
  16692. exec(
  16693. /** 回调函数 */
  16694. callback?: (...args: any[]) => any
  16695. ): NodesRef
  16696. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.select(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html)
  16697. *
  16698. * 在插件中使用:支持
  16699. *
  16700. * 在当前页面下选择第一个匹配选择器 `selector` 的节点。返回一个 `NodesRef` 对象实例,可以用于获取节点信息。
  16701. *
  16702. * **selector 语法**
  16703. *
  16704. * selector类似于 CSS 的选择器,但仅支持下列语法。
  16705. *
  16706. * - ID选择器:#the-id
  16707. * - class选择器(可以连续指定多个):.a-class.another-class
  16708. * - 子元素选择器:.the-parent > .the-child
  16709. * - 后代选择器:.the-ancestor .the-descendant
  16710. * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  16711. * - 多选择器的并集:#a-node, .some-other-nodes */
  16712. select(
  16713. /** 选择器 */
  16714. selector: string
  16715. ): NodesRef
  16716. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectAll(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html)
  16717. *
  16718. * 在插件中使用:支持
  16719. *
  16720. * 在当前页面下选择匹配选择器 selector 的所有节点。
  16721. *
  16722. * **selector 语法**
  16723. *
  16724. * selector类似于 CSS 的选择器,但仅支持下列语法。
  16725. *
  16726. * - ID选择器:#the-id
  16727. * - class选择器(可以连续指定多个):.a-class.another-class
  16728. * - 子元素选择器:.the-parent > .the-child
  16729. * - 后代选择器:.the-ancestor .the-descendant
  16730. * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  16731. * - 多选择器的并集:#a-node, .some-other-nodes */
  16732. selectAll(
  16733. /** 选择器 */
  16734. selector: string
  16735. ): NodesRef
  16736. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectViewport()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html)
  16737. *
  16738. * 在插件中使用:支持
  16739. *
  16740. * 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。 */
  16741. selectViewport(): NodesRef
  16742. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) SelectorQuery.in(Component component)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.in.html)
  16743. *
  16744. * 需要基础库: `1.6.0`
  16745. *
  16746. * 在插件中使用:支持
  16747. *
  16748. * 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
  16749. *
  16750. * **示例代码**
  16751. *
  16752. * ```js
  16753. Component({
  16754. queryMultipleNodes (){
  16755. const query = wx.createSelectorQuery().in(this)
  16756. query.select('#the-id').boundingClientRect(function(res){
  16757. res.top // 这个组件内 #the-id 节点的上边界坐标
  16758. }).exec()
  16759. }
  16760. })
  16761. ``` */
  16762. in(
  16763. /** 自定义组件实例 */
  16764. component: Component.TrivialInstance | Page.TrivialInstance
  16765. ): SelectorQuery
  16766. }
  16767. interface SocketTask {
  16768. /** [SocketTask.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html)
  16769. *
  16770. * 在插件中使用:支持
  16771. *
  16772. * 关闭 WebSocket 连接 */
  16773. close(option: SocketTaskCloseOption): void
  16774. /** [SocketTask.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html)
  16775. *
  16776. * 在插件中使用:支持
  16777. *
  16778. * 监听 WebSocket 连接关闭事件 */
  16779. onClose(
  16780. /** WebSocket 连接关闭事件的监听函数 */
  16781. listener: SocketTaskOnCloseCallback
  16782. ): void
  16783. /** [SocketTask.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html)
  16784. *
  16785. * 在插件中使用:支持
  16786. *
  16787. * 监听 WebSocket 错误事件 */
  16788. onError(
  16789. /** WebSocket 错误事件的监听函数 */
  16790. listener: UDPSocketOnErrorCallback
  16791. ): void
  16792. /** [SocketTask.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html)
  16793. *
  16794. * 在插件中使用:支持
  16795. *
  16796. * 监听 WebSocket 接受到服务器的消息事件 */
  16797. onMessage(
  16798. /** WebSocket 接受到服务器的消息事件的监听函数 */
  16799. listener: SocketTaskOnMessageCallback
  16800. ): void
  16801. /** [SocketTask.onOpen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html)
  16802. *
  16803. * 在插件中使用:支持
  16804. *
  16805. * 监听 WebSocket 连接打开事件 */
  16806. onOpen(
  16807. /** WebSocket 连接打开事件的监听函数 */
  16808. listener: OnOpenCallback
  16809. ): void
  16810. /** [SocketTask.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html)
  16811. *
  16812. * 在插件中使用:支持
  16813. *
  16814. * 通过 WebSocket 连接发送数据 */
  16815. send(option: SocketTaskSendOption): void
  16816. }
  16817. interface Stats {
  16818. /** [boolean Stats.isDirectory()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isDirectory.html)
  16819. *
  16820. * 在插件中使用:需要基础库 `2.19.2`
  16821. *
  16822. * 判断当前文件是否一个目录 */
  16823. isDirectory(): boolean
  16824. /** [boolean Stats.isFile()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isFile.html)
  16825. *
  16826. * 在插件中使用:需要基础库 `2.19.2`
  16827. *
  16828. * 判断当前文件是否一个普通文件 */
  16829. isFile(): boolean
  16830. }
  16831. interface TCPSocket {
  16832. /** [TCPSocket.bindWifi(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.bindWifi.html)
  16833. *
  16834. * 需要基础库: `2.25.0`
  16835. *
  16836. * 在插件中使用:不支持
  16837. *
  16838. * 将 TCP Socket 绑定到当前 wifi 网络,成功后会触发 onBindWifi 事件(仅安卓支持) */
  16839. bindWifi(options: BindWifiOption): void
  16840. /** [TCPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.close.html)
  16841. *
  16842. * 在插件中使用:不支持
  16843. *
  16844. * 关闭连接 */
  16845. close(): void
  16846. /** [TCPSocket.connect(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.connect.html)
  16847. *
  16848. * 在插件中使用:不支持
  16849. *
  16850. * 在给定的套接字上启动连接 */
  16851. connect(options: TCPSocketConnectOption): void
  16852. /** [TCPSocket.offBindWifi(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offBindWifi.html)
  16853. *
  16854. * 需要基础库: `2.25.0`
  16855. *
  16856. * 在插件中使用:不支持
  16857. *
  16858. * 移除当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数
  16859. *
  16860. * **示例代码**
  16861. *
  16862. * ```js
  16863. const listener = function (res) { console.log(res) }
  16864. TCPSocket.onBindWifi(listener)
  16865. TCPSocket.offBindWifi(listener) // 需传入与监听时同一个的函数对象
  16866. ``` */
  16867. offBindWifi(
  16868. /** onBindWifi 传入的监听函数。不传此参数则移除所有监听函数。 */
  16869. listener?: OffBindWifiCallback
  16870. ): void
  16871. /** [TCPSocket.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offClose.html)
  16872. *
  16873. * 在插件中使用:不支持
  16874. *
  16875. * 移除一旦 socket 完全关闭就发出该事件的监听函数
  16876. *
  16877. * **示例代码**
  16878. *
  16879. * ```js
  16880. const listener = function (res) { console.log(res) }
  16881. TCPSocket.onClose(listener)
  16882. TCPSocket.offClose(listener) // 需传入与监听时同一个的函数对象
  16883. ``` */
  16884. offClose(
  16885. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  16886. listener?: UDPSocketOffCloseCallback
  16887. ): void
  16888. /** [TCPSocket.offConnect(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offConnect.html)
  16889. *
  16890. * 在插件中使用:不支持
  16891. *
  16892. * 移除当一个 socket 连接成功建立的时候触发该事件的监听函数
  16893. *
  16894. * **示例代码**
  16895. *
  16896. * ```js
  16897. const listener = function (res) { console.log(res) }
  16898. TCPSocket.onConnect(listener)
  16899. TCPSocket.offConnect(listener) // 需传入与监听时同一个的函数对象
  16900. ``` */
  16901. offConnect(
  16902. /** onConnect 传入的监听函数。不传此参数则移除所有监听函数。 */
  16903. listener?: OffConnectCallback
  16904. ): void
  16905. /** [TCPSocket.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offError.html)
  16906. *
  16907. * 在插件中使用:不支持
  16908. *
  16909. * 移除当错误发生时触发的监听函数
  16910. *
  16911. * **示例代码**
  16912. *
  16913. * ```js
  16914. const listener = function (res) { console.log(res) }
  16915. TCPSocket.onError(listener)
  16916. TCPSocket.offError(listener) // 需传入与监听时同一个的函数对象
  16917. ``` */
  16918. offError(
  16919. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  16920. listener?: UDPSocketOffErrorCallback
  16921. ): void
  16922. /** [TCPSocket.offMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offMessage.html)
  16923. *
  16924. * 在插件中使用:不支持
  16925. *
  16926. * 移除当接收到数据的时触发该事件的监听函数
  16927. *
  16928. * **示例代码**
  16929. *
  16930. * ```js
  16931. const listener = function (res) { console.log(res) }
  16932. TCPSocket.onMessage(listener)
  16933. TCPSocket.offMessage(listener) // 需传入与监听时同一个的函数对象
  16934. ``` */
  16935. offMessage(
  16936. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  16937. listener?: TCPSocketOffMessageCallback
  16938. ): void
  16939. /** [TCPSocket.onBindWifi(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onBindWifi.html)
  16940. *
  16941. * 需要基础库: `2.25.0`
  16942. *
  16943. * 在插件中使用:不支持
  16944. *
  16945. * 监听当一个 socket 绑定当前 wifi 网络成功时触发该事件 */
  16946. onBindWifi(
  16947. /** 当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数 */
  16948. listener: OnBindWifiCallback
  16949. ): void
  16950. /** [TCPSocket.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onClose.html)
  16951. *
  16952. * 在插件中使用:不支持
  16953. *
  16954. * 监听一旦 socket 完全关闭就发出该事件 */
  16955. onClose(
  16956. /** 一旦 socket 完全关闭就发出该事件的监听函数 */
  16957. listener: UDPSocketOnCloseCallback
  16958. ): void
  16959. /** [TCPSocket.onConnect(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onConnect.html)
  16960. *
  16961. * 在插件中使用:不支持
  16962. *
  16963. * 监听当一个 socket 连接成功建立的时候触发该事件 */
  16964. onConnect(
  16965. /** 当一个 socket 连接成功建立的时候触发该事件的监听函数 */
  16966. listener: OnConnectCallback
  16967. ): void
  16968. /** [TCPSocket.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onError.html)
  16969. *
  16970. * 在插件中使用:不支持
  16971. *
  16972. * 监听当错误发生时触发 */
  16973. onError(
  16974. /** 的监听函数 */
  16975. listener: UDPSocketOnErrorCallback
  16976. ): void
  16977. /** [TCPSocket.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onMessage.html)
  16978. *
  16979. * 在插件中使用:不支持
  16980. *
  16981. * 监听当接收到数据的时触发该事件 */
  16982. onMessage(
  16983. /** 当接收到数据的时触发该事件的监听函数 */
  16984. listener: TCPSocketOnMessageCallback
  16985. ): void
  16986. /** [TCPSocket.write(string|ArrayBuffer data)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.write.html)
  16987. *
  16988. * 在插件中使用:不支持
  16989. *
  16990. * 在 socket 上发送数据 */
  16991. write(
  16992. /** 要发送的数据 */
  16993. data: string | ArrayBuffer
  16994. ): void
  16995. }
  16996. interface TruncateSyncError {
  16997. /** 错误信息
  16998. *
  16999. * | 错误信息 | 说明 |
  17000. * | - | - |
  17001. * | fail no such file or directory, open ${filePath} | 指定的 filePath 所在目录不存在 |
  17002. * | fail illegal operation on a directory, open "${filePath}" | 指定的 filePath 是一个已经存在的目录 |
  17003. * | fail permission denied, open ${dirPath} | 指定的 filePath 路径没有写权限 |
  17004. * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 |
  17005. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errMsg: string
  17006. /** 错误码
  17007. *
  17008. * | 错误信息 | 说明 |
  17009. * | - | - |
  17010. * | fail no such file or directory, open ${filePath} | 指定的 filePath 所在目录不存在 |
  17011. * | fail illegal operation on a directory, open "${filePath}" | 指定的 filePath 是一个已经存在的目录 |
  17012. * | fail permission denied, open ${dirPath} | 指定的 filePath 路径没有写权限 |
  17013. * | fail the maximum size of the file storage limit is exceeded | 存储空间不足 |
  17014. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errCode: number
  17015. }
  17016. interface UDPSocket {
  17017. /** [UDPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.close.html)
  17018. *
  17019. * 在插件中使用:需要基础库 `2.11.1`
  17020. *
  17021. * 关闭 UDP Socket 实例,相当于销毁。 在关闭之后,UDP Socket 实例不能再发送消息,每次调用 `UDPSocket.send` 将会触发错误事件,并且 message 事件回调函数也不会再也执行。在 `UDPSocket` 实例被创建后将被 Native 强引用,保证其不被 GC。在 `UDPSocket.close` 后将解除对其的强引用,让 UDPSocket 实例遵从 GC。 */
  17022. close(): void
  17023. /** [UDPSocket.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.connect.html)
  17024. *
  17025. * 需要基础库: `2.15.0`
  17026. *
  17027. * 在插件中使用:需要基础库 `2.11.1`
  17028. *
  17029. * 预先连接到指定的 IP 和 port,需要配合 write 方法一起使用 */
  17030. connect(option: UDPSocketConnectOption): void
  17031. /** [UDPSocket.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offClose.html)
  17032. *
  17033. * 在插件中使用:需要基础库 `2.11.1`
  17034. *
  17035. * 移除关闭事件的监听函数
  17036. *
  17037. * **示例代码**
  17038. *
  17039. * ```js
  17040. const listener = function (res) { console.log(res) }
  17041. UDPSocket.onClose(listener)
  17042. UDPSocket.offClose(listener) // 需传入与监听时同一个的函数对象
  17043. ``` */
  17044. offClose(
  17045. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  17046. listener?: UDPSocketOffCloseCallback
  17047. ): void
  17048. /** [UDPSocket.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html)
  17049. *
  17050. * 在插件中使用:需要基础库 `2.11.1`
  17051. *
  17052. * 移除错误事件的监听函数
  17053. *
  17054. * **示例代码**
  17055. *
  17056. * ```js
  17057. const listener = function (res) { console.log(res) }
  17058. UDPSocket.onError(listener)
  17059. UDPSocket.offError(listener) // 需传入与监听时同一个的函数对象
  17060. ``` */
  17061. offError(
  17062. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  17063. listener?: UDPSocketOffErrorCallback
  17064. ): void
  17065. /** [UDPSocket.offListening(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html)
  17066. *
  17067. * 在插件中使用:需要基础库 `2.11.1`
  17068. *
  17069. * 移除开始监听数据包消息的事件的监听函数
  17070. *
  17071. * **示例代码**
  17072. *
  17073. * ```js
  17074. const listener = function (res) { console.log(res) }
  17075. UDPSocket.onListening(listener)
  17076. UDPSocket.offListening(listener) // 需传入与监听时同一个的函数对象
  17077. ``` */
  17078. offListening(
  17079. /** onListening 传入的监听函数。不传此参数则移除所有监听函数。 */
  17080. listener?: OffListeningCallback
  17081. ): void
  17082. /** [UDPSocket.offMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offMessage.html)
  17083. *
  17084. * 在插件中使用:需要基础库 `2.11.1`
  17085. *
  17086. * 移除收到消息的事件的监听函数
  17087. *
  17088. * **示例代码**
  17089. *
  17090. * ```js
  17091. const listener = function (res) { console.log(res) }
  17092. UDPSocket.onMessage(listener)
  17093. UDPSocket.offMessage(listener) // 需传入与监听时同一个的函数对象
  17094. ``` */
  17095. offMessage(
  17096. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  17097. listener?: UDPSocketOffMessageCallback
  17098. ): void
  17099. /** [UDPSocket.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html)
  17100. *
  17101. * 在插件中使用:需要基础库 `2.11.1`
  17102. *
  17103. * 监听关闭事件 */
  17104. onClose(
  17105. /** 关闭事件的监听函数 */
  17106. listener: UDPSocketOnCloseCallback
  17107. ): void
  17108. /** [UDPSocket.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onError.html)
  17109. *
  17110. * 在插件中使用:需要基础库 `2.11.1`
  17111. *
  17112. * 监听错误事件 */
  17113. onError(
  17114. /** 错误事件的监听函数 */
  17115. listener: UDPSocketOnErrorCallback
  17116. ): void
  17117. /** [UDPSocket.onListening(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onListening.html)
  17118. *
  17119. * 在插件中使用:需要基础库 `2.11.1`
  17120. *
  17121. * 监听开始监听数据包消息的事件 */
  17122. onListening(
  17123. /** 开始监听数据包消息的事件的监听函数 */
  17124. listener: OnListeningCallback
  17125. ): void
  17126. /** [UDPSocket.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onMessage.html)
  17127. *
  17128. * 在插件中使用:需要基础库 `2.11.1`
  17129. *
  17130. * 监听收到消息的事件 */
  17131. onMessage(
  17132. /** 收到消息的事件的监听函数 */
  17133. listener: UDPSocketOnMessageCallback
  17134. ): void
  17135. /** [UDPSocket.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.send.html)
  17136. *
  17137. * 在插件中使用:需要基础库 `2.11.1`
  17138. *
  17139. * 向指定的 IP 和 port 发送消息。基础库 2.9.0 起支持广播 (指定地址为 255.255.255.255)。 */
  17140. send(option: UDPSocketSendOption): void
  17141. /** [UDPSocket.setTTL(number ttl)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.setTTL.html)
  17142. *
  17143. * 需要基础库: `2.18.0`
  17144. *
  17145. * 在插件中使用:支持
  17146. *
  17147. * 设置 IP_TTL 套接字选项,用于设置一个 IP 数据包传输时允许的最大跳步数 */
  17148. setTTL(
  17149. /** ttl 参数可以是 0 到 255 之间 */
  17150. ttl: number
  17151. ): void
  17152. /** [UDPSocket.write()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.write.html)
  17153. *
  17154. * 需要基础库: `2.15.0`
  17155. *
  17156. * 在插件中使用:需要基础库 `2.11.1`
  17157. *
  17158. * 用法与 send 方法相同,如果没有预先调用 connect 则与 send 无差异(注意即使调用了 connect 也需要在本接口填入地址和端口参数) */
  17159. write(): void
  17160. /** [number UDPSocket.bind(number port)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.bind.html)
  17161. *
  17162. * 在插件中使用:需要基础库 `2.11.1`
  17163. *
  17164. * 绑定一个系统随机分配的可用端口,或绑定一个指定的端口号 */
  17165. bind(
  17166. /** 需要基础库: `2.9.0`
  17167. *
  17168. * 指定要绑定的端口号,不传则返回系统随机分配的可用端口 */
  17169. port?: number
  17170. ): number
  17171. }
  17172. interface UpdateManager {
  17173. /** [UpdateManager.applyUpdate()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.applyUpdate.html)
  17174. *
  17175. * 在插件中使用:不支持
  17176. *
  17177. * 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。
  17178. *
  17179. * **示例代码**
  17180. *
  17181. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  17182. applyUpdate(): void
  17183. /** [UpdateManager.onCheckForUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html)
  17184. *
  17185. * 在插件中使用:不支持
  17186. *
  17187. * 监听向微信后台请求检查更新结果事件。微信在小程序每次启动(包括热启动)时自动检查更新,不需由开发者主动触发。
  17188. *
  17189. * **示例代码**
  17190. *
  17191. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  17192. onCheckForUpdate(
  17193. /** 向微信后台请求检查更新结果事件的监听函数 */
  17194. listener: OnCheckForUpdateCallback
  17195. ): void
  17196. /** [UpdateManager.onUpdateFailed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html)
  17197. *
  17198. * 在插件中使用:不支持
  17199. *
  17200. * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调
  17201. *
  17202. * **示例代码**
  17203. *
  17204. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  17205. onUpdateFailed(
  17206. /** 小程序更新失败事件的监听函数 */
  17207. listener: OnUpdateFailedCallback
  17208. ): void
  17209. /** [UpdateManager.onUpdateReady(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html)
  17210. *
  17211. * 在插件中使用:不支持
  17212. *
  17213. * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调
  17214. *
  17215. * **示例代码**
  17216. *
  17217. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  17218. onUpdateReady(
  17219. /** 小程序有版本更新事件的监听函数 */
  17220. listener: OnUpdateReadyCallback
  17221. ): void
  17222. }
  17223. interface UploadTask {
  17224. /** [UploadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.abort.html)
  17225. *
  17226. * 需要基础库: `1.4.0`
  17227. *
  17228. * 在插件中使用:支持
  17229. *
  17230. * 中断上传任务 */
  17231. abort(): void
  17232. /** [UploadTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offHeadersReceived.html)
  17233. *
  17234. * 需要基础库: `2.1.0`
  17235. *
  17236. * 在插件中使用:支持
  17237. *
  17238. * 移除 HTTP Response Header 事件的监听函数
  17239. *
  17240. * **示例代码**
  17241. *
  17242. * ```js
  17243. const listener = function (res) { console.log(res) }
  17244. UploadTask.onHeadersReceived(listener)
  17245. UploadTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
  17246. ``` */
  17247. offHeadersReceived(
  17248. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  17249. listener?: OffHeadersReceivedCallback
  17250. ): void
  17251. /** [UploadTask.offProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html)
  17252. *
  17253. * 需要基础库: `2.1.0`
  17254. *
  17255. * 在插件中使用:支持
  17256. *
  17257. * 移除上传进度变化事件的监听函数
  17258. *
  17259. * **示例代码**
  17260. *
  17261. * ```js
  17262. const listener = function (res) { console.log(res) }
  17263. UploadTask.onProgressUpdate(listener)
  17264. UploadTask.offProgressUpdate(listener) // 需传入与监听时同一个的函数对象
  17265. ``` */
  17266. offProgressUpdate(
  17267. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  17268. listener?: UploadTaskOffProgressUpdateCallback
  17269. ): void
  17270. /** [UploadTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html)
  17271. *
  17272. * 需要基础库: `2.1.0`
  17273. *
  17274. * 在插件中使用:支持
  17275. *
  17276. * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
  17277. onHeadersReceived(
  17278. /** HTTP Response Header 事件的监听函数 */
  17279. listener: OnHeadersReceivedCallback
  17280. ): void
  17281. /** [UploadTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html)
  17282. *
  17283. * 需要基础库: `1.4.0`
  17284. *
  17285. * 在插件中使用:支持
  17286. *
  17287. * 监听上传进度变化事件 */
  17288. onProgressUpdate(
  17289. /** 上传进度变化事件的监听函数 */
  17290. listener: UploadTaskOnProgressUpdateCallback
  17291. ): void
  17292. }
  17293. interface UserCryptoManager {
  17294. /** [UserCryptoManager.getLatestUserKey(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getLatestUserKey.html)
  17295. *
  17296. * 需要基础库: `2.17.3`
  17297. *
  17298. * 在插件中使用:不支持
  17299. *
  17300. * 获取最新的用户加密密钥
  17301. *
  17302. * **示例代码**
  17303. *
  17304. * ```js
  17305. const userCryptoManager = wx.getUserCryptoManager()
  17306. userCryptoManager.getLatestUserKey({
  17307. success: res => {
  17308. const {encryptKey, iv, version, expireTime} = res
  17309. console.log(encryptKey, iv, version, expireTime)
  17310. }
  17311. })
  17312. ``` */
  17313. getLatestUserKey(option?: GetLatestUserKeyOption): void
  17314. /** [UserCryptoManager.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html)
  17315. *
  17316. * 需要基础库: `2.17.3`
  17317. *
  17318. * 在插件中使用:不支持
  17319. *
  17320. * 获取密码学安全随机数
  17321. *
  17322. * **示例代码**
  17323. *
  17324. * ```js
  17325. wx.getRandomValues({
  17326. length: 6 // 生成 6 个字节长度的随机数,
  17327. success: res => {
  17328. console.log(wx.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
  17329. }
  17330. })
  17331. ``` */
  17332. getRandomValues(option: GetRandomValuesOption): void
  17333. }
  17334. interface VKCamera {
  17335. /** [Float32Array VKCamera.getProjectionMatrix(number near, number far)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.getProjectionMatrix.html)
  17336. *
  17337. * 需要基础库: `2.20.0`
  17338. *
  17339. * 在插件中使用:需要基础库 `2.20.0`
  17340. *
  17341. * 获取投影矩阵 */
  17342. getProjectionMatrix(
  17343. /** 近视点 */
  17344. near: number,
  17345. /** 远视点 */
  17346. far: number
  17347. ): Float32Array
  17348. }
  17349. interface VKFrame {
  17350. /** [ArrayBuffer VKFrame.getCameraBuffer(number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraBuffer.html)
  17351. *
  17352. * 需要基础库: `2.24.0`
  17353. *
  17354. * 在插件中使用:不支持
  17355. *
  17356. * 获取当前帧 rgba buffer。iOS 端微信在 v8.0.20 开始支持,安卓端微信在 v8.0.30 开始支持。按 aspect-fill 规则裁剪,此接口要求在创建 VKSession 对象时必须传入 gl 参数。此接口仅建议拿来做帧分析使用,上屏请使用 getCameraTexture 来代替。 */
  17357. getCameraBuffer(
  17358. /** 宽度,受系统限制,必须是 16 的整数倍 */
  17359. width: number,
  17360. /** 高度 */
  17361. height: number
  17362. ): ArrayBuffer
  17363. /** [Float32Array VKFrame.getDisplayTransform()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getDisplayTransform.html)
  17364. *
  17365. * 需要基础库: `2.20.0`
  17366. *
  17367. * 在插件中使用:需要基础库 `2.20.0`
  17368. *
  17369. * 获取纹理调整矩阵。默认获取到的纹理是未经裁剪调整的纹理,此矩阵可用于在着色器中根据帧对象尺寸对纹理进行裁剪。 */
  17370. getDisplayTransform(): Float32Array
  17371. /** [Object VKFrame.getCameraTexture(WebGLRenderingContext gl)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraTexture.html)
  17372. *
  17373. * 需要基础库: `2.20.0`
  17374. *
  17375. * 在插件中使用:需要基础库 `2.20.0`
  17376. *
  17377. * 获取当前帧纹理,目前只支持 YUV 纹理。 */
  17378. getCameraTexture(
  17379. /** 画布 */
  17380. gl: WebGLRenderingContext
  17381. ): YUVTextureRes
  17382. }
  17383. interface VKSession {
  17384. /** [Array.&lt;Object&gt; VKSession.getAllMarker()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllMarker.html)
  17385. *
  17386. * 需要基础库: `2.24.5`
  17387. *
  17388. * 在插件中使用:需要基础库 `2.24.5`
  17389. *
  17390. * 获取所有 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true */
  17391. getAllMarker(): VKMarker[]
  17392. /** [Array.&lt;Object&gt; VKSession.getAllOSDMarker()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllOSDMarker.html)
  17393. *
  17394. * 需要基础库: `2.24.5`
  17395. *
  17396. * 在插件中使用:需要基础库 `2.24.5`
  17397. *
  17398. * 获取所有 OSD marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
  17399. getAllOSDMarker(): VKMarker[]
  17400. /** [Array.&lt;Object&gt; VKSession.hitTest(number x, number y, Object reset)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.hitTest.html)
  17401. *
  17402. * 需要基础库: `2.20.0`
  17403. *
  17404. * 在插件中使用:需要基础库 `2.20.0`
  17405. *
  17406. * 触摸检测,v1 版本只支持单平面(即 hitTest 生成一次平面后,后续 hitTest 均不会再生成平面,而是以之前生成的平面为基础进行检测)。如果需要重新识别其他平面,可以在调用此方法时将 reset 参数置为 true。 */
  17407. hitTest(
  17408. /** 相对视窗的横坐标,取值范围为 [0, 1],0 为左边缘,1 为右边缘 */
  17409. x: number,
  17410. /** 相对视窗的纵坐标,取值范围为 [0, 1],0 为上边缘,1 为下边缘 */
  17411. y: number,
  17412. /** 是否需要重新识别其他平面,v2 版本不再需要此参数 */
  17413. reset: IAnyObject
  17414. ): HitTestRes[]
  17415. /** [VKSession.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.cancelAnimationFrame.html)
  17416. *
  17417. * 需要基础库: `2.20.0`
  17418. *
  17419. * 在插件中使用:需要基础库 `2.20.0`
  17420. *
  17421. * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。 */
  17422. cancelAnimationFrame(requestID: number): void
  17423. /** [VKSession.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.destroy.html)
  17424. *
  17425. * 需要基础库: `2.20.0`
  17426. *
  17427. * 在插件中使用:需要基础库 `2.20.0`
  17428. *
  17429. * 销毁会话。 */
  17430. destroy(): void
  17431. /** [VKSession.detectBody(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectBody.html)
  17432. *
  17433. * 需要基础库: `2.28.0`
  17434. *
  17435. * 在插件中使用:需要基础库 `2.28.0`
  17436. *
  17437. * 静态图像人体关键点检测。当 wx.createVKSession 参数传入 {track: {body: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
  17438. detectBody(option: DetectBodyOption): void
  17439. /** [VKSession.detectFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectFace.html)
  17440. *
  17441. * 需要基础库: `2.25.0`
  17442. *
  17443. * 在插件中使用:需要基础库 `2.25.0`
  17444. *
  17445. * 静态图像人脸关键点检测。当 wx.createVKSession 参数传入 {track: {face: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。
  17446. *
  17447. * ****
  17448. *
  17449. * ### 特别说明
  17450. * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
  17451. detectFace(option: DetectFaceOption): void
  17452. /** [VKSession.detectHand(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectHand.html)
  17453. *
  17454. * 需要基础库: `2.28.0`
  17455. *
  17456. * 在插件中使用:需要基础库 `2.28.0`
  17457. *
  17458. * 静态图像手势关键点检测。当 wx.createVKSession 参数传入 {track: {hand: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
  17459. detectHand(option: DetectHandOption): void
  17460. /** [VKSession.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.off.html)
  17461. *
  17462. * 需要基础库: `2.20.0`
  17463. *
  17464. * 在插件中使用:需要基础库 `2.20.0`
  17465. *
  17466. * 取消监听会话事件。 */
  17467. off(
  17468. /** 事件名称 */
  17469. eventName: string,
  17470. /** 事件监听函数 */
  17471. fn: (...args: any[]) => any
  17472. ): void
  17473. /** [VKSession.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.on.html)
  17474. *
  17475. * 需要基础库: `2.20.0`
  17476. *
  17477. * 在插件中使用:需要基础库 `2.20.0`
  17478. *
  17479. * 监听会话事件。 */
  17480. on(
  17481. /** 事件名称
  17482. *
  17483. * 参数 eventName 可选值:
  17484. * - 'resize': 相机尺寸变化事件,回调参数为相机尺寸;
  17485. * - 'addAnchors': 增加 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持);
  17486. * - 'updateAnchors': 更新 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持) 或 [VKFaceAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html)/[VKOCRAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html)/[VKHandAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html)/[VKBodyAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html)列表(v1、v2都支持);
  17487. * - 'removeAnchors': 删除 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持) 或 [VKFaceAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html)/[VKOCRAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html)/[VKHandAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html)/[VKBodyAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html) 列表(v1、v2都支持); */
  17488. eventName:
  17489. | 'resize'
  17490. | 'addAnchors'
  17491. | 'updateAnchors'
  17492. | 'removeAnchors',
  17493. /** 事件监听函数 */
  17494. fn: (...args: any[]) => any
  17495. ): void
  17496. /** [VKSession.removeMarker(number markerId)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeMarker.html)
  17497. *
  17498. * 需要基础库: `2.24.5`
  17499. *
  17500. * 在插件中使用:需要基础库 `2.24.5`
  17501. *
  17502. * 删除一个 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true */
  17503. removeMarker(
  17504. /** marker id */
  17505. markerId: number
  17506. ): void
  17507. /** [VKSession.removeOSDMarker(number markerId)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeOSDMarker.html)
  17508. *
  17509. * 需要基础库: `2.24.5`
  17510. *
  17511. * 在插件中使用:需要基础库 `2.24.5`
  17512. *
  17513. * 删除一个 OSD marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
  17514. removeOSDMarker(
  17515. /** marker id */
  17516. markerId: number
  17517. ): void
  17518. /** [VKSession.runOCR(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.runOCR.html)
  17519. *
  17520. * 需要基础库: `2.27.0`
  17521. *
  17522. * 在插件中使用:需要基础库 `2.27.0`
  17523. *
  17524. * 静态图像OCR检测。当 wx.createVKSession 参数传入 {track: {OCR: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
  17525. runOCR(option: RunOCROption): void
  17526. /** [VKSession.start(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.start.html)
  17527. *
  17528. * 需要基础库: `2.20.0`
  17529. *
  17530. * 在插件中使用:需要基础库 `2.20.0`
  17531. *
  17532. * 开启会话。 */
  17533. start(
  17534. /** 开启会话回调 */
  17535. callback: VKSessionStartCallback
  17536. ): void
  17537. /** [VKSession.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.stop.html)
  17538. *
  17539. * 需要基础库: `2.20.0`
  17540. *
  17541. * 在插件中使用:需要基础库 `2.20.0`
  17542. *
  17543. * 停止会话。 */
  17544. stop(): void
  17545. /** [VKSession.updateOSDThreshold(number threshold)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.updateOSDThreshold.html)
  17546. *
  17547. * 需要基础库: `2.24.5`
  17548. *
  17549. * 在插件中使用:需要基础库 `2.24.5`
  17550. *
  17551. * 更新 OSD 识别精确度,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
  17552. updateOSDThreshold(
  17553. /** 阈值 */
  17554. threshold: number
  17555. ): void
  17556. /** [[VKFrame](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.html) VKSession.getVKFrame(number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getVKFrame.html)
  17557. *
  17558. * 需要基础库: `2.20.0`
  17559. *
  17560. * 在插件中使用:需要基础库 `2.20.0`
  17561. *
  17562. * 获取帧对象,每调用一次都会触发一次帧分析过程。目前 VKSession 相机的最大帧数是 30 fps,因此调用 getVKFrame 的频率也可以限制在 30 fps,以减少渲染开销。 */
  17563. getVKFrame(
  17564. /** 宽度 */
  17565. width: number,
  17566. /** 高度 */
  17567. height: number
  17568. ): VKFrame
  17569. /** [number VKSession.addMarker(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addMarker.html)
  17570. *
  17571. * 需要基础库: `2.24.5`
  17572. *
  17573. * 在插件中使用:需要基础库 `2.24.5`
  17574. *
  17575. * 添加一个 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true
  17576. *
  17577. * **使用提示**
  17578. *
  17579. * 注意事项:
  17580. * 1. 使用 addMarker 接口之前,需要在 createVKSession 的时候声明开启 marker 跟踪。即 wx.createVKSession({ track: { marker: true } })
  17581. * 2. 可以添加多个 marker 图片,但不能重复添加相同的 marker 图片。
  17582. *
  17583. * 对传入的图片有如下要求:
  17584. * 1. 格式:jpg/png 格式三通道彩图或者 1 通道灰度图
  17585. * 2. 分辨率:尺寸在 480x480 ~ 1920x1920 之间,建议为 1080 分辨率
  17586. * 3. 宽高比:在 1:1 ~ 16:9 之间,要求尽量方正,避免狭长的图片
  17587. * 4. 质量:目标图像为平面模型,需要占画面主体,避免大面积留白,建议用扫描件
  17588. *
  17589. * 示例:
  17590. *
  17591. * <img width="500px" src="https://res.wx.qq.com/op_res/sJPS5gttY4yQq-CmG9crrtaOpjb6Yc6mDhJKdUmrIpmtbWBMfAUAFavtKT6-tEZIh-8zT8tfBJBtvH048ge5Vw" alt="image.png" />
  17592. *
  17593. * 建议:
  17594. *
  17595. * 1. 图片具有丰富的细节
  17596. * 2. 避免重复单一的纹理,例如:
  17597. *
  17598. * <img width="500px" src="https://res.wx.qq.com/op_res/VfNcS-M6nPWWXq_CJ483Dq3iLsNXMvLiM6Wb5ZHOrVVGR2u5ixbQlbiSSuNHzVcMQQY5V0dvnlyOGihUIbyTvA" alt="image.png" />
  17599. * <br>
  17600. * <img width="500px" src="https://res.wx.qq.com/op_res/VfNcS-M6nPWWXq_CJ483Dq-_lR2j4eOi23IOJ2LHFQY_PWufbx3s3uROgLi_flJMHQA8DNvlebs9UwumozPlXg" alt="image.png" />
  17601. * <br>
  17602. * <img width="500px" src="https://res.wx.qq.com/op_res/VfNcS-M6nPWWXq_CJ483Dr9IaSPF18UPnz4KrbAhGW9pIb8oWxzHgmClGIRZK59N4gUnJh69yoQW1TFGqce8ew" alt="image.png" />
  17603. * <br>
  17604. *
  17605. * 3. 避免使用柔和平滑边缘的纹理及大量渐变图像,例如:
  17606. *
  17607. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCq6DPj88qSVwHFZiumbE0IMq9ibzbnhjewzUSa-n5_VgF_lF9g07FFHHYyrY14KTSfA" alt="image.png" />
  17608. *
  17609. * 4. 避免模糊,建议采用高清、高对比度图像作为识别对象
  17610. * 5. 建议图像有均匀的特征(角点)分布,正确示例:
  17611. *
  17612. * <img width="500px" src="https://res.wx.qq.com/op_res/sJPS5gttY4yQq-CmG9crrrBRWB_Cw2aFXAn1KY0YtfjnQ7WNt854gA8H2zfmZUztlFcJbdEHouBGs63hUO4Mxg" alt="image.png" />
  17613. *
  17614. * 避免角点较少、中间大量空白、没有特征及角点的图像,错误示例:
  17615. *
  17616. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCqzjY2LY-ylRjFS7TVD-cZsEE8TTB-xzR2YiWKhWyWg1bgpbRqQq-4l6OWPDii4S3Xg" alt="image.png" /> */
  17617. addMarker(
  17618. /** 图片路径,目前只支持本地用户图片 */
  17619. path: string
  17620. ): number
  17621. /** [number VKSession.addOSDMarker(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addOSDMarker.html)
  17622. *
  17623. * 需要基础库: `2.24.5`
  17624. *
  17625. * 在插件中使用:需要基础库 `2.24.5`
  17626. *
  17627. * 添加一个 OSD marker(one-shot detection marker),要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true
  17628. *
  17629. * **使用提示**
  17630. *
  17631. * 注意事项:
  17632. * 1. 使用 addOSDMarker 接口之前,需要在 createVKSession 的时候声明开启 OSD 跟踪。即 wx.createVKSession({ track: { OSD: true } })
  17633. * 2. 可以添加多个 OSDMarker 图片,但不能重复添加相同的 OSDMarker 图片。
  17634. *
  17635. * 对传入的图片有如下要求:
  17636. * 1. 格式:jpg 格式彩色图片
  17637. * 2. 分辨率:尺寸不低于 240x240
  17638. * 3. 宽高比:在 1:1 ~ 16:9 之间,要求尽量方正,避免狭长的图片
  17639. * 4. 质量:目标物体需要占画面主体,避免大面积留白,避免大面积文字,不能含其他物体。
  17640. *
  17641. * 示例:
  17642. *
  17643. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCq_Mq0ReXEA5nOzDIvnYYPttmwxn0V1e_yI6UUgkNT6K6aOQj2QRba5IHQglHULkrKg" alt="image.png" />
  17644. * <br>
  17645. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCqwiRcyGk9oenkCpd3vAHWSTSZPPJcgIrPzcpwnSpmk_9bMiCqUdS8Ds789Rjhy0CtA" alt="image.png" />
  17646. * <br>
  17647. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCqx8fYUYypBmFmB1_zX-APH06j1oMZDz7K0CE2To_982NDOB5fmM4Y2Rrr1uQF6J4gg" alt="image.png" />
  17648. * <br>
  17649. *
  17650. * 建议:
  17651. *
  17652. * 1. 具有丰富的细节,避免纯色且形状特点不鲜明的物体,例如:
  17653. *
  17654. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCq-6WwSZKlNbN-if0NCag-Dm6AmNJeBFi5dvR-bRZINlZmuA9G1e4wpngvhlr2z6CXQ" alt="image.png" />
  17655. *
  17656. * 2. 避免模糊,最好采用高清图片 */
  17657. addOSDMarker(
  17658. /** 图片路径,目前只支持本地用户图片 */
  17659. path: string
  17660. ): number
  17661. /** [number VKSession.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.requestAnimationFrame.html)
  17662. *
  17663. * 需要基础库: `2.20.0`
  17664. *
  17665. * 在插件中使用:需要基础库 `2.20.0`
  17666. *
  17667. * 在下次进行重绘时执行。 */
  17668. requestAnimationFrame(
  17669. /** 执行的 callback */
  17670. callback: (...args: any[]) => any
  17671. ): number
  17672. }
  17673. interface VideoContext {
  17674. /** [VideoContext.exitBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitBackgroundPlayback.html)
  17675. *
  17676. * 需要基础库: `2.14.3`
  17677. *
  17678. * 在插件中使用:支持
  17679. *
  17680. * 退出后台音频播放模式。 */
  17681. exitBackgroundPlayback(): void
  17682. /** [VideoContext.exitFullScreen()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html)
  17683. *
  17684. * 需要基础库: `1.4.0`
  17685. *
  17686. * 在插件中使用:支持
  17687. *
  17688. * 退出全屏 */
  17689. exitFullScreen(): void
  17690. /** [VideoContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html)
  17691. *
  17692. * 在插件中使用:支持
  17693. *
  17694. * 退出小窗,该方法可在任意页面调用 */
  17695. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  17696. /** [VideoContext.hideStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html)
  17697. *
  17698. * 需要基础库: `2.1.0`
  17699. *
  17700. * 在插件中使用:支持
  17701. *
  17702. * 隐藏状态栏,仅在iOS全屏下有效 */
  17703. hideStatusBar(): void
  17704. /** [VideoContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html)
  17705. *
  17706. * 在插件中使用:支持
  17707. *
  17708. * 暂停视频 */
  17709. pause(): void
  17710. /** [VideoContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html)
  17711. *
  17712. * 在插件中使用:支持
  17713. *
  17714. * 播放视频 */
  17715. play(): void
  17716. /** [VideoContext.playbackRate(number rate)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html)
  17717. *
  17718. * 需要基础库: `1.4.0`
  17719. *
  17720. * 在插件中使用:支持
  17721. *
  17722. * 设置倍速播放 */
  17723. playbackRate(
  17724. /** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速 */
  17725. rate: number
  17726. ): void
  17727. /** [VideoContext.requestBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestBackgroundPlayback.html)
  17728. *
  17729. * 需要基础库: `2.14.3`
  17730. *
  17731. * 在插件中使用:支持
  17732. *
  17733. * 进入后台音频播放模式。 */
  17734. requestBackgroundPlayback(): void
  17735. /** [VideoContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html)
  17736. *
  17737. * 需要基础库: `1.4.0`
  17738. *
  17739. * 在插件中使用:支持
  17740. *
  17741. * 进入全屏。若有自定义内容需在全屏时展示,需将内容节点放置到 video 节点内。 */
  17742. requestFullScreen(option: VideoContextRequestFullScreenOption): void
  17743. /** [VideoContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html)
  17744. *
  17745. * 在插件中使用:支持
  17746. *
  17747. * 跳转到指定位置 */
  17748. seek(
  17749. /** 跳转到的位置,单位 s */
  17750. position: number
  17751. ): void
  17752. /** [VideoContext.sendDanmu(Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.sendDanmu.html)
  17753. *
  17754. * 在插件中使用:支持
  17755. *
  17756. * 发送弹幕 */
  17757. sendDanmu(
  17758. /** 弹幕内容 */
  17759. data: Danmu
  17760. ): void
  17761. /** [VideoContext.showStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.showStatusBar.html)
  17762. *
  17763. * 需要基础库: `2.1.0`
  17764. *
  17765. * 在插件中使用:支持
  17766. *
  17767. * 显示状态栏,仅在iOS全屏下有效 */
  17768. showStatusBar(): void
  17769. /** [VideoContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html)
  17770. *
  17771. * 需要基础库: `1.7.0`
  17772. *
  17773. * 在插件中使用:支持
  17774. *
  17775. * 停止视频 */
  17776. stop(): void
  17777. }
  17778. interface VideoDecoder {
  17779. /** [Object VideoDecoder.getFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.getFrameData.html)
  17780. *
  17781. * 需要基础库: `2.11.0`
  17782. *
  17783. * 在插件中使用:支持
  17784. *
  17785. * 获取下一帧的解码数据 */
  17786. getFrameData(): FrameDataOptions
  17787. /** [Promise VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html)
  17788. *
  17789. * 需要基础库: `2.11.0`
  17790. *
  17791. * 在插件中使用:支持
  17792. *
  17793. * 移除解码器 */
  17794. remove(): Promise<any>
  17795. /** [Promise VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html)
  17796. *
  17797. * 需要基础库: `2.11.0`
  17798. *
  17799. * 在插件中使用:支持
  17800. *
  17801. * 跳到某个时间点解码 */
  17802. seek(
  17803. /** 跳转的解码位置,单位 ms */
  17804. position: number
  17805. ): Promise<any>
  17806. /** [Promise VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html)
  17807. *
  17808. * 需要基础库: `2.11.0`
  17809. *
  17810. * 在插件中使用:支持
  17811. *
  17812. * 开始解码 */
  17813. start(option: VideoDecoderStartOption): Promise<any>
  17814. /** [Promise VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html)
  17815. *
  17816. * 需要基础库: `2.11.0`
  17817. *
  17818. * 在插件中使用:支持
  17819. *
  17820. * 停止解码 */
  17821. stop(): Promise<any>
  17822. /** [VideoDecoder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html)
  17823. *
  17824. * 需要基础库: `2.11.0`
  17825. *
  17826. * 在插件中使用:支持
  17827. *
  17828. * 取消监听录制事件。当对应事件触发时,该回调函数不再执行 */
  17829. off(
  17830. /** 事件名 */
  17831. eventName: string,
  17832. /** 事件触发时执行的回调函数 */
  17833. callback: (...args: any[]) => any
  17834. ): void
  17835. /** [VideoDecoder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.on.html)
  17836. *
  17837. * 需要基础库: `2.11.0`
  17838. *
  17839. * 在插件中使用:支持
  17840. *
  17841. * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行 */
  17842. on(
  17843. /** 事件名
  17844. *
  17845. * 参数 eventName 可选值:
  17846. * - 'start': 开始事件。返回 {width, height};
  17847. * - 'stop': 结束事件。;
  17848. * - 'seek': seek 完成事件。;
  17849. * - 'bufferchange': 缓冲区变化事件。;
  17850. * - 'ended': 解码结束事件。; */
  17851. eventName: 'start' | 'stop' | 'seek' | 'bufferchange' | 'ended',
  17852. /** 事件触发时执行的回调函数 */
  17853. callback: (...args: any[]) => any
  17854. ): void
  17855. }
  17856. interface WebAudioContext {
  17857. /** [AnalyserNode WebAudioContext.createAnalyser()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createAnalyser.html)
  17858. *
  17859. * 需要基础库: `2.22.0`
  17860. *
  17861. * 在插件中使用:不支持
  17862. *
  17863. * 创建一个 AnalyserNode 。可以用来获取音频时间和频率数据,以及实现数据可视化。 */
  17864. createAnalyser(): AnalyserNode
  17865. /** [BiquadFilterNode WebAudioContext.createBiquadFilter()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBiquadFilter.html)
  17866. *
  17867. * 在插件中使用:不支持
  17868. *
  17869. * 创建一个BiquadFilterNode */
  17870. createBiquadFilter(): BiquadFilterNode
  17871. /** [BufferSourceNode WebAudioContext.createBufferSource()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBufferSource.html)
  17872. *
  17873. * 在插件中使用:不支持
  17874. *
  17875. * 创建一个BufferSourceNode实例,通过AudioBuffer对象来播放音频数据。 */
  17876. createBufferSource(): BufferSourceNode
  17877. /** [ChannelMergerNode WebAudioContext.createChannelMerger(number numberOfInputs)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelMerger.html)
  17878. *
  17879. * 在插件中使用:不支持
  17880. *
  17881. * 创建一个ChannelMergerNode */
  17882. createChannelMerger(
  17883. /** 输出流中需要保持的输入流的个数 */
  17884. numberOfInputs: number
  17885. ): ChannelMergerNode
  17886. /** [ChannelSplitterNode WebAudioContext.createChannelSplitter(number numberOfOutputs)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelSplitter.html)
  17887. *
  17888. * 在插件中使用:不支持
  17889. *
  17890. * 创建一个ChannelSplitterNode */
  17891. createChannelSplitter(
  17892. /** 要分别输出的输入音频流中的通道数 */
  17893. numberOfOutputs: number
  17894. ): ChannelSplitterNode
  17895. /** [ConstantSourceNode WebAudioContext.createConstantSource()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createConstantSource.html)
  17896. *
  17897. * 在插件中使用:不支持
  17898. *
  17899. * 创建一个ConstantSourceNode */
  17900. createConstantSource(): ConstantSourceNode
  17901. /** [DelayNode WebAudioContext.createDelay(number maxDelayTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDelay.html)
  17902. *
  17903. * 在插件中使用:不支持
  17904. *
  17905. * 创建一个DelayNode */
  17906. createDelay(
  17907. /** 最大延迟时间 */
  17908. maxDelayTime: number
  17909. ): DelayNode
  17910. /** [DynamicsCompressorNode WebAudioContext.createDynamicsCompressor()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDynamicsCompressor.html)
  17911. *
  17912. * 在插件中使用:不支持
  17913. *
  17914. * 创建一个DynamicsCompressorNode */
  17915. createDynamicsCompressor(): DynamicsCompressorNode
  17916. /** [GainNode WebAudioContext.createGain()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createGain.html)
  17917. *
  17918. * 在插件中使用:不支持
  17919. *
  17920. * 创建一个GainNode */
  17921. createGain(): GainNode
  17922. /** [IIRFilterNode WebAudioContext.createIIRFilter(Array.&lt;number&gt; feedforward, Array.&lt;number&gt; feedback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createIIRFilter.html)
  17923. *
  17924. * 在插件中使用:不支持
  17925. *
  17926. * 创建一个IIRFilterNode */
  17927. createIIRFilter(
  17928. /** 一个浮点值数组,指定IIR滤波器传递函数的前馈(分子)系数。 */
  17929. feedforward: number[],
  17930. /** 一个浮点值数组,指定IIR滤波器传递函数的反馈(分母)系数。 */
  17931. feedback: number[]
  17932. ): IIRFilterNode
  17933. /** [OscillatorNode WebAudioContext.createOscillator()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createOscillator.html)
  17934. *
  17935. * 在插件中使用:不支持
  17936. *
  17937. * 创建一个OscillatorNode */
  17938. createOscillator(): OscillatorNode
  17939. /** [PannerNode WebAudioContext.createPanner()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPanner.html)
  17940. *
  17941. * 在插件中使用:不支持
  17942. *
  17943. * 创建一个PannerNode */
  17944. createPanner(): PannerNode
  17945. /** [PeriodicWaveNode WebAudioContext.createPeriodicWave(Float32Array real, Float32Array imag, object constraints)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPeriodicWave.html)
  17946. *
  17947. * 在插件中使用:不支持
  17948. *
  17949. * 创建一个PeriodicWaveNode
  17950. *
  17951. * **注意**
  17952. *
  17953. * `real`和`imag`数组必须拥有一样的长度,否则抛出错误
  17954. * ```js
  17955. const real = new Float32Array(2)
  17956. const imag = new Float32Array(2)
  17957. real[0] = 0
  17958. imag[0] = 0
  17959. real[1] = 1
  17960. imag[1] = 0
  17961. const waveNode = audioContext.createPeriodicWave(real, imag, {disableNormalization: true})
  17962. ``` */
  17963. createPeriodicWave(
  17964. /** 一组余弦项(传统上是A项) */
  17965. real: Float32Array,
  17966. /** 一组余弦项(传统上是A项) */
  17967. imag: Float32Array,
  17968. /** 一个字典对象,它指定是否应该禁用规范化(默认启用规范化) */
  17969. constraints: Constraints
  17970. ): PeriodicWaveNode
  17971. /** [Promise WebAudioContext.close()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.close.html)
  17972. *
  17973. * 在插件中使用:不支持
  17974. *
  17975. * 关闭WebAudioContext
  17976. *
  17977. * **注意事项**
  17978. *
  17979. * 同步关闭对应的WebAudio上下文。close后会立即释放当前上下文的资源,<b>不要在close后再次访问state属性。</b>
  17980. * ```js
  17981. const audioCtx = wx.createWebAudioContext()
  17982. audioCtx.close().then(() => {
  17983. console.log(audioCtx.state) // bad case:不应该在close后再访问state
  17984. })
  17985. ``` */
  17986. close(): Promise<any>
  17987. /** [Promise WebAudioContext.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.resume.html)
  17988. *
  17989. * 在插件中使用:不支持
  17990. *
  17991. * 同步恢复已经被暂停的WebAudioContext上下文 */
  17992. resume(): Promise<any>
  17993. /** [Promise WebAudioContext.suspend()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.suspend.html)
  17994. *
  17995. * 在插件中使用:不支持
  17996. *
  17997. * 同步暂停WebAudioContext上下文 */
  17998. suspend(): Promise<any>
  17999. /** [ScriptProcessorNode WebAudioContext.createScriptProcessor(number bufferSize, number numberOfInputChannels, number numberOfOutputChannels)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createScriptProcessor.html)
  18000. *
  18001. * 在插件中使用:不支持
  18002. *
  18003. * 创建一个ScriptProcessorNode */
  18004. createScriptProcessor(
  18005. /** 缓冲区大小,以样本帧为单位 */
  18006. bufferSize: number,
  18007. /** 用于指定输入node的声道的数量 */
  18008. numberOfInputChannels: number,
  18009. /** 用于指定输出node的声道的数量 */
  18010. numberOfOutputChannels: number
  18011. ): ScriptProcessorNode
  18012. /** [WaveShaperNode WebAudioContext.createWaveShaper()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createWaveShaper.html)
  18013. *
  18014. * 在插件中使用:不支持
  18015. *
  18016. * 创建一个WaveShaperNode */
  18017. createWaveShaper(): WaveShaperNode
  18018. /** [[AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html) WebAudioContext.createBuffer(number numOfChannels, number length, number sampleRate)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBuffer.html)
  18019. *
  18020. * 在插件中使用:不支持
  18021. *
  18022. * 创建一个AudioBuffer,代表着一段驻留在内存中的短音频 */
  18023. createBuffer(
  18024. /** 定义了 buffer 中包含的声频通道数量的整数 */
  18025. numOfChannels: number,
  18026. /** 代表 buffer 中的样本帧数的整数 */
  18027. length: number,
  18028. /** 线性音频样本的采样率,即每一秒包含的关键帧的个数 */
  18029. sampleRate: number
  18030. ): AudioBuffer
  18031. /** [[AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html) WebAudioContext.decodeAudioData()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html)
  18032. *
  18033. * 在插件中使用:不支持
  18034. *
  18035. * 异步解码一段资源为AudioBuffer。 */
  18036. decodeAudioData(): AudioBuffer
  18037. }
  18038. interface WifiError {
  18039. /** 错误信息
  18040. *
  18041. * | 错误码 | 错误信息 | 说明 |
  18042. * | - | - | - |
  18043. * | 0 | ok | 正常 |
  18044. * | 12000 | not init | 未先调用 `startWifi` 接口 |
  18045. * | 12001 | system not support | 当前系统不支持相关能力 |
  18046. * | 12002 | password error Wi-Fi | 密码错误 |
  18047. * | 12003 | connection timeout | 连接超时, 仅 Android 支持 |
  18048. * | 12004 | duplicate request | 重复连接 Wi-Fi |
  18049. * | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
  18050. * | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
  18051. * | 12007 | user denied | 用户拒绝授权链接 Wi-Fi |
  18052. * | 12008 | invalid SSID | 无效 SSID |
  18053. * | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
  18054. * | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
  18055. * | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
  18056. * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持 |
  18057. * | 12014 | invalid WEP / WPA password | iOS 特有,无效的 WEP / WPA 密码 | */ errMsg: string
  18058. /** 错误码
  18059. *
  18060. * | 错误码 | 错误信息 | 说明 |
  18061. * | - | - | - |
  18062. * | 0 | ok | 正常 |
  18063. * | 12000 | not init | 未先调用 `startWifi` 接口 |
  18064. * | 12001 | system not support | 当前系统不支持相关能力 |
  18065. * | 12002 | password error Wi-Fi | 密码错误 |
  18066. * | 12003 | connection timeout | 连接超时, 仅 Android 支持 |
  18067. * | 12004 | duplicate request | 重复连接 Wi-Fi |
  18068. * | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
  18069. * | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
  18070. * | 12007 | user denied | 用户拒绝授权链接 Wi-Fi |
  18071. * | 12008 | invalid SSID | 无效 SSID |
  18072. * | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
  18073. * | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
  18074. * | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
  18075. * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持 |
  18076. * | 12014 | invalid WEP / WPA password | iOS 特有,无效的 WEP / WPA 密码 | */ errCode: number
  18077. }
  18078. interface Worker {
  18079. /** [ArrayBuffer Worker.getCameraFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.getCameraFrameData.html)
  18080. *
  18081. * 需要基础库: `2.25.1`
  18082. *
  18083. * 在插件中使用:不支持
  18084. *
  18085. * 获取摄像头当前帧图像,返回ArrayBuffer数据。仅限在 worker 线程中使用。
  18086. *
  18087. * **示例代码**
  18088. *
  18089. * ```js
  18090. // app.js
  18091. const worker = wx.createWorker('workers/index.js', {
  18092. useExperimentalWorker: true
  18093. })
  18094. const cameraContext = wx.createCameraContext()
  18095. const cameraFrameListener = cameraContext.onCameraFrame(function() {})
  18096. cameraFrameListener.start({
  18097. worker: worker
  18098. })
  18099. ```
  18100. *
  18101. * ```js
  18102. // workers/index.js
  18103. const data = worker.getCameraFrameData()
  18104. console.log(data)
  18105. ``` */
  18106. getCameraFrameData(): ArrayBuffer
  18107. /** [Worker.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onMessage.html)
  18108. *
  18109. * 在插件中使用:不支持
  18110. *
  18111. * 监听主线程/Worker 线程向当前线程发送的消息的事件。 */
  18112. onMessage(
  18113. /** 主线程/Worker 线程向当前线程发送的消息的事件的监听函数 */
  18114. listener: WorkerOnMessageCallback
  18115. ): void
  18116. /** [Worker.onProcessKilled(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
  18117. *
  18118. * 在插件中使用:不支持
  18119. *
  18120. * 监听 worker线程被系统回收事件(开启 useExperimentalWorker 后,当iOS系统资源紧张时,ExperimentalWorker 线程存在被系统回收的可能,开发者可监听此事件并重新创建一个worker)。仅限在主线程 worker 对象上调用。 */
  18121. onProcessKilled(
  18122. /** worker线程被系统回收事件的监听函数 */
  18123. listener: OnProcessKilledCallback
  18124. ): void
  18125. /** [Worker.postMessage(Object message)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.postMessage.html)
  18126. *
  18127. * 在插件中使用:不支持
  18128. *
  18129. * 向主线程/Worker 线程发送的消息。
  18130. *
  18131. * **示例代码**
  18132. *
  18133. * worker 线程中
  18134. * ```js
  18135. worker.postMessage({
  18136. msg: 'hello from worker'
  18137. })
  18138. ```
  18139. *
  18140. * 主线程中
  18141. * ```js
  18142. const worker = wx.createWorker('workers/request/index.js')
  18143. worker.postMessage({
  18144. msg: 'hello from main'
  18145. })
  18146. ```
  18147. *
  18148. * **提醒**
  18149. *
  18150. * 在基础库版本2.20.2之前,postMessage仅支持传递可序列化的key-value对象。
  18151. * 在基础库2.20.2之后,postMessage支持传递任意类型的数据。 */
  18152. postMessage(
  18153. /** 需要发送的消息。 */
  18154. message: IAnyObject
  18155. ): void
  18156. /** [Worker.terminate()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.terminate.html)
  18157. *
  18158. * 在插件中使用:不支持
  18159. *
  18160. * 结束当前 Worker 线程。仅限在主线程 worker 对象上调用。 */
  18161. terminate(): void
  18162. /** [Worker.testOnProcessKilled()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.testOnProcessKilled.html)
  18163. *
  18164. * 需要基础库: `2.27.1`
  18165. *
  18166. * 在插件中使用:不支持
  18167. *
  18168. * 用于模拟 iOS ExperimentalWorker 线程被系统回收事件,以便于调试。接口仅在 worker 线程内可用。参考 [Worker.onProcessKilled](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
  18169. *
  18170. * **示例代码**
  18171. *
  18172. * ```js
  18173. // game.js
  18174. const worker = wx.createWorker('workers/index.js', {
  18175. useExperimentalWorker: true
  18176. })
  18177. // 监听 ExperimentalWorker 被系统回收事件
  18178. worker.onProcessKilled(function () {
  18179. console.log('worker has been killed')
  18180. // 重新创建一个worker
  18181. // wx.createWorker()
  18182. })
  18183. ```
  18184. *
  18185. * ```js
  18186. // workers/index.js
  18187. setTimeout(() => {
  18188. // 模拟 ExperimentalWorker 线程被系统回收事件
  18189. worker.testOnProcessKilled()
  18190. }, 2000)
  18191. ``` */
  18192. testOnProcessKilled(): void
  18193. }
  18194. interface Worklet {
  18195. /** [AnimationObject worklet.decay(Object options, Array clamp, number velocityFactor, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.decay.html)
  18196. *
  18197. * 在插件中使用:不支持
  18198. *
  18199. * 基于滚动的动画。 */
  18200. decay(
  18201. /** 动画配置 */
  18202. options: DecayOption,
  18203. /** 长度为 2 的数组类型,对动画过程中的速度进行截断 */
  18204. clamp: any[],
  18205. /** 单位是 pixels per second ,一些场景下可能需要对其进行换算。 */
  18206. velocityFactor: number,
  18207. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  18208. callback: (...args: any[]) => any
  18209. ): AnimationObject
  18210. /** [AnimationObject worklet.delay(number delayMS, AnimationObject delayedAnimation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.delay.html)
  18211. *
  18212. * 在插件中使用:不支持
  18213. *
  18214. * 延迟执行动画。 */
  18215. delay(
  18216. /** 动画开始前等待的时间,单位:毫秒。 */
  18217. delayMS: number,
  18218. /** 动画对象。 */
  18219. delayedAnimation: AnimationObject
  18220. ): AnimationObject
  18221. /** [AnimationObject worklet.repeat(AnimationObject animation, number numberOfReps, boolean reverse, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.repeat.html)
  18222. *
  18223. * 在插件中使用:不支持
  18224. *
  18225. * 重复执行动画。 */
  18226. repeat(
  18227. /** 动画对象 */
  18228. animation: AnimationObject,
  18229. /** 重复次数。为负值时一直循环,直到被取消动画。 */
  18230. numberOfReps?: number,
  18231. /** 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。 */
  18232. reverse?: boolean,
  18233. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  18234. callback?: (...args: any[]) => any
  18235. ): AnimationObject
  18236. /** [AnimationObject worklet.sequence(AnimationObject animationN)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.sequence.html)
  18237. *
  18238. * 在插件中使用:不支持
  18239. *
  18240. * 组合动画序列,依次执行传入的动画。 */
  18241. sequence(
  18242. /** 动画对象 */
  18243. animationN: AnimationObject
  18244. ): AnimationObject
  18245. /** [AnimationObject worklet.spring(number|string toValue, Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.spring.html)
  18246. *
  18247. * 在插件中使用:不支持
  18248. *
  18249. * 基于物理的动画。 */
  18250. spring(
  18251. /** 目标值 */
  18252. toValue: number | string,
  18253. /** 动画配置 */
  18254. options: SpringOption,
  18255. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  18256. callback: (...args: any[]) => any
  18257. ): AnimationObject
  18258. /** [AnimationObject worklet.timing(number|string toValue, Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.timing.html)
  18259. *
  18260. * 在插件中使用:不支持
  18261. *
  18262. * 基于时间的动画。 */
  18263. timing(
  18264. /** 目标值 */
  18265. toValue: number | string,
  18266. /** 动画配置 */
  18267. options: TimingOption,
  18268. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  18269. callback: (...args: any[]) => any
  18270. ): AnimationObject
  18271. /** [DerivedValue worklet.derived(WorkletFunction updaterWorklet)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.derived.html)
  18272. *
  18273. * 在插件中使用:不支持
  18274. *
  18275. * 衍生值 DerivedValue,可基于已有的 SharedValue 生成其它共享变量。 */
  18276. derived(
  18277. /** worklet 函数类型,该函数被立即执行,返回值作为 DerivedValue 的初始值。当函数内捕获的 SharedValue 类型值发生变化时,updaterWorklet 被驱动执行,返回值用于更新 DerivedValue。可类比 computed 计算属性进行理解,但实现原理并不一样。 */
  18278. updaterWorklet: WorkletFunction
  18279. ): DerivedValue
  18280. /** [SharedValue worklet.shared(any initialValue)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.shared.html)
  18281. *
  18282. * 在插件中使用:不支持
  18283. *
  18284. * 共享变量 SharedValue,用于跨线程共享数据和驱动动画。 */
  18285. shared(
  18286. /** 初始值,可通过 .value 属性进行读取和修改。类型可以是 number|string|bool|Object|Array|Function。 */
  18287. initialValue: any
  18288. ): SharedValue
  18289. /** [function worklet.runOnJS(function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnJS.html)
  18290. *
  18291. * 在插件中使用:不支持
  18292. *
  18293. * worklet 函数运行在 UI 线程时,捕获的外部函数可能为 worklet 类型或普通函数,为了更明显的对其区分,要求必须使用 runOnJS 调回 JS 线程的普通函数。
  18294. * 有这样的要求是因为,调用其它 worklet 函数时是同步调用,但在 UI 线程执行 JS 线程的函数只能是异步,开发者容易混淆,试图同步获取 JS 线程的返回值。 */
  18295. runOnJS(
  18296. /** 未声明为 worklet 类型的普通函数。 */
  18297. fn: (...args: any[]) => any
  18298. ): (...args: any[]) => any
  18299. /** [function worklet.runOnUI(function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnUI.html)
  18300. *
  18301. * 在插件中使用:不支持
  18302. *
  18303. * 在 UI 线程执行 worklet 函数。 */
  18304. runOnUI(
  18305. /** worklet 类型函数。 */
  18306. fn: (...args: any[]) => any
  18307. ): (...args: any[]) => any
  18308. /** [worklet.cancelAnimation(SharedValue sharedValue)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.cancelAnimation.html)
  18309. *
  18310. * 在插件中使用:不支持
  18311. *
  18312. * 取消由 SharedValue 驱动的动画。 */
  18313. cancelAnimation(
  18314. /** 共享变量。 */
  18315. sharedValue: SharedValue
  18316. ): void
  18317. }
  18318. interface WriteSyncError {
  18319. /** 错误信息
  18320. *
  18321. * | 错误信息 | 说明 |
  18322. * | - | - |
  18323. * | bad file descriptor | 无效的文件描述符 |
  18324. * | fail permission denied | 指定的 fd 路径没有写权限 |
  18325. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errMsg: string
  18326. /** 错误码
  18327. *
  18328. * | 错误信息 | 说明 |
  18329. * | - | - |
  18330. * | bad file descriptor | 无效的文件描述符 |
  18331. * | fail permission denied | 指定的 fd 路径没有写权限 |
  18332. * | fail sdcard not mounted | android sdcard 挂载失败 | */ errCode: number
  18333. }
  18334. interface Wx {
  18335. /** [Array.&lt;any&gt; wx.batchGetStorageSync(Array.&lt;string&gt; keyList)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html)
  18336. *
  18337. * 需要基础库: `2.25.0`
  18338. *
  18339. * 在插件中使用:不支持
  18340. *
  18341. * 从本地缓存中同步批量获取指定 key 的内容。
  18342. *
  18343. * **示例代码**
  18344. *
  18345. * ```js
  18346. try {
  18347. var valueList = wx.batchGetStorageSync(['key'])
  18348. if (valueList) {
  18349. // Do something with return value
  18350. }
  18351. } catch (e) {
  18352. // Do something when catch error
  18353. }
  18354. ```
  18355. *
  18356. * ****
  18357. *
  18358. * 对于多个key的读取, 批量读取在性能上优于多次getStorageSync读取 */
  18359. batchGetStorageSync(
  18360. /** 本地缓存中指定的 key 数组 */
  18361. keyList: string[]
  18362. ): any[]
  18363. /** [ArrayBuffer wx.base64ToArrayBuffer(string base64)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.base64ToArrayBuffer.html)
  18364. *
  18365. * 需要基础库: `1.1.0`
  18366. *
  18367. * 在插件中使用:支持
  18368. * @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  18369. *
  18370. * 将 Base64 字符串转成 ArrayBuffer 对象 */
  18371. base64ToArrayBuffer(
  18372. /** 要转化成 ArrayBuffer 对象的 Base64 字符串 */
  18373. base64: string
  18374. ): ArrayBuffer
  18375. /** [Object wx.getAccountInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html)
  18376. *
  18377. * 需要基础库: `2.2.2`
  18378. *
  18379. * 在插件中使用:需要基础库 `2.2.2`
  18380. *
  18381. * 获取当前帐号信息。线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。
  18382. *
  18383. * **示例代码**
  18384. *
  18385. * ```js
  18386. const accountInfo = wx.getAccountInfoSync();
  18387. console.log(accountInfo.miniProgram.appId) // 小程序 appId
  18388. console.log(accountInfo.plugin.appId) // 插件 appId
  18389. console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的形式
  18390. ``` */
  18391. getAccountInfoSync(): AccountInfo
  18392. /** [Object wx.getAppAuthorizeSetting()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)
  18393. *
  18394. * 需要基础库: `2.20.1`
  18395. *
  18396. * 在插件中使用:需要基础库 `2.21.3`
  18397. *
  18398. * 获取微信APP授权设置
  18399. *
  18400. * **示例代码**
  18401. *
  18402. * ```js
  18403. const appAuthorizeSetting = wx.getAppAuthorizeSetting()
  18404. console.log(appAuthorizeSetting.albumAuthorized)
  18405. console.log(appAuthorizeSetting.bluetoothAuthorized)
  18406. console.log(appAuthorizeSetting.cameraAuthorized)
  18407. console.log(appAuthorizeSetting.locationAuthorized)
  18408. console.log(appAuthorizeSetting.locationReducedAccuracy)
  18409. console.log(appAuthorizeSetting.microphoneAuthorized)
  18410. console.log(appAuthorizeSetting.notificationAlertAuthorized)
  18411. console.log(appAuthorizeSetting.notificationAuthorized)
  18412. console.log(appAuthorizeSetting.notificationBadgeAuthorized)
  18413. console.log(appAuthorizeSetting.notificationSoundAuthorized)
  18414. console.log(appAuthorizeSetting.phoneCalendarAuthorized)
  18415. ```
  18416. *
  18417. * **返回值说明**
  18418. *
  18419. * `'authorized'` 表示已经获得授权,无需再次请求授权;
  18420. * `'denied'` 表示请求授权被拒绝,无法再次请求授权;(此情况需要引导用户[打开系统设置](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html),在设置页中打开权限)
  18421. * `'non determined'` 表示尚未请求授权,会在微信下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) */
  18422. getAppAuthorizeSetting(): AppAuthorizeSetting
  18423. /** [Object wx.getAppBaseInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html)
  18424. *
  18425. * 需要基础库: `2.20.1`
  18426. *
  18427. * 在插件中使用:需要基础库 `2.21.3`
  18428. *
  18429. * 获取微信APP基础信息
  18430. *
  18431. * **示例代码**
  18432. *
  18433. * ```js
  18434. const appBaseInfo = wx.getAppBaseInfo()
  18435. console.log(appBaseInfo.SDKVersion)
  18436. console.log(appBaseInfo.enableDebug)
  18437. console.log(appBaseInfo.host)
  18438. console.log(appBaseInfo.language)
  18439. console.log(appBaseInfo.version)
  18440. console.log(appBaseInfo.theme)
  18441. ``` */
  18442. getAppBaseInfo(): AppBaseInfo
  18443. /** [Object wx.getBatteryInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html)
  18444. *
  18445. * 在插件中使用:需要基础库 `2.15.0`
  18446. *
  18447. * [wx.getBatteryInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html) 的同步版本 */
  18448. getBatteryInfoSync(): GetBatteryInfoSyncResult
  18449. /** [Object wx.getDeviceInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)
  18450. *
  18451. * 需要基础库: `2.20.1`
  18452. *
  18453. * 在插件中使用:需要基础库 `2.21.3`
  18454. *
  18455. * 获取设备基础信息
  18456. *
  18457. * **示例代码**
  18458. *
  18459. * ```js
  18460. const deviceInfo = wx.getDeviceInfo()
  18461. console.log(deviceInfo.abi)
  18462. console.log(deviceInfo.benchmarkLevel)
  18463. console.log(deviceInfo.brand)
  18464. console.log(deviceInfo.model)
  18465. console.log(deviceInfo.platform)
  18466. console.log(deviceInfo.system)
  18467. ``` */
  18468. getDeviceInfo(): DeviceInfo
  18469. /** [Object wx.getEnterOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getEnterOptionsSync.html)
  18470. *
  18471. * 需要基础库: `2.9.4`
  18472. *
  18473. * 在插件中使用:需要基础库 `2.9.4`
  18474. *
  18475. * 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onLaunch-Object-object) 的回调参数一致;如果当前是热启动,则返回值与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onShow-Object-object) 一致。
  18476. *
  18477. * **返回有效 referrerInfo 的场景**
  18478. *
  18479. * | 场景值 | 场景 | appId含义 |
  18480. * | ------ | ------------------------------- | ---------- |
  18481. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  18482. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  18483. * | 1036 | App 分享消息卡片 | 来源App |
  18484. * | 1037 | 小程序打开小程序 | 来源小程序 |
  18485. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  18486. * | 1043 | 公众号模板消息 | 来源公众号 |
  18487. *
  18488. * **不同 apiCategory 场景下的 API 限制**
  18489. *
  18490. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  18491. *
  18492. * | | default | nativeFunctionalized | browseOnly | embedded |
  18493. * |-|-|-|-|-|
  18494. * |navigateToMiniProgram | | `X` | `X` | |
  18495. * |openSetting | | | `X` | |
  18496. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  18497. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  18498. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  18499. * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
  18500. *
  18501. * **注意**
  18502. *
  18503. * 部分版本在无 `referrerInfo` 的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
  18504. getEnterOptionsSync(): LaunchOptionsApp
  18505. /** [Object wx.getExptInfoSync(Array.&lt;string&gt; keys)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getExptInfoSync.html)
  18506. *
  18507. * 需要基础库: `2.17.0`
  18508. *
  18509. * 在插件中使用:不支持
  18510. *
  18511. * 给定实验参数数组,获取对应的实验参数值
  18512. *
  18513. * **提示**
  18514. *
  18515. * 假设实验参数有 `color`, `size`
  18516. * 调用 wx.getExptInfoSync() 会返回 `{color:'#fff',size:20}` 类似的结果
  18517. * 而 wx.getExptInfoSync(['color']) 则只会返回 `{color:'#fff'}` */
  18518. getExptInfoSync(
  18519. /** 实验参数数组,不填则获取所有实验参数 */
  18520. keys?: string[]
  18521. ): IAnyObject
  18522. /** [Object wx.getExtConfigSync()](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html)
  18523. *
  18524. * 需要基础库: `1.1.0`
  18525. *
  18526. * 在插件中使用:不支持
  18527. *
  18528. * [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 的同步版本。
  18529. *
  18530. * **Tips**
  18531. *
  18532. * 1. 本接口暂时无法通过 [wx.canIUse](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html) 判断是否兼容,开发者需要自行判断 [wx.getExtConfigSync](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html) 是否存在来兼容
  18533. *
  18534. * ****
  18535. *
  18536. * ```js
  18537. let extConfig = wx.getExtConfigSync? wx.getExtConfigSync(): {}
  18538. console.log(extConfig)
  18539. ``` */
  18540. getExtConfigSync(): IAnyObject
  18541. /** [Object wx.getLaunchOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html)
  18542. *
  18543. * 需要基础库: `2.1.2`
  18544. *
  18545. * 在插件中使用:需要基础库 `2.9.4`
  18546. *
  18547. * 获取小程序启动时的参数。与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onlaunchobject-object) 的回调参数一致。
  18548. *
  18549. * **返回有效 referrerInfo 的场景**
  18550. *
  18551. * | 场景值 | 场景 | appId含义 |
  18552. * | ------ | ------------------------------- | ---------- |
  18553. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  18554. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  18555. * | 1036 | App 分享消息卡片 | 来源App |
  18556. * | 1037 | 小程序打开小程序 | 来源小程序 |
  18557. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  18558. * | 1043 | 公众号模板消息 | 来源公众号 |
  18559. * | 1069 | 移动应用 | 来源App |
  18560. *
  18561. * **不同 apiCategory 场景下的 API 限制**
  18562. *
  18563. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  18564. *
  18565. * | | default | nativeFunctionalized | browseOnly | embedded |
  18566. * |-|-|-|-|-|
  18567. * |navigateToMiniProgram | | `X` | `X` | |
  18568. * |openSetting | | | `X` | |
  18569. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  18570. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  18571. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  18572. * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
  18573. *
  18574. * **注意**
  18575. *
  18576. * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
  18577. getLaunchOptionsSync(): LaunchOptionsApp
  18578. /** [Object wx.getMenuButtonBoundingClientRect()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html)
  18579. *
  18580. * 需要基础库: `2.1.0`
  18581. *
  18582. * 在插件中使用:需要基础库 `2.15.0`
  18583. *
  18584. * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
  18585. *
  18586. * **示例代码**
  18587. *
  18588. * ```js
  18589. const res = wx.getMenuButtonBoundingClientRect()
  18590. console.log(res.width)
  18591. console.log(res.height)
  18592. console.log(res.top)
  18593. console.log(res.right)
  18594. console.log(res.bottom)
  18595. console.log(res.left)
  18596. ``` */
  18597. getMenuButtonBoundingClientRect(): ClientRect
  18598. /** [Object wx.getSkylineInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfoSync.html)
  18599. *
  18600. * 需要基础库: `2.26.2`
  18601. *
  18602. * 在插件中使用:需要基础库 `2.26.2`
  18603. *
  18604. * 获取当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  18605. getSkylineInfoSync(): SkylineInfo
  18606. /** [Object wx.getStorageInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfoSync.html)
  18607. *
  18608. * 在插件中使用:不支持
  18609. *
  18610. * [wx.getStorageInfo](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html) 的同步版本
  18611. *
  18612. * **示例代码**
  18613. *
  18614. * ```js
  18615. wx.getStorageInfo({
  18616. success (res) {
  18617. console.log(res.keys)
  18618. console.log(res.currentSize)
  18619. console.log(res.limitSize)
  18620. }
  18621. })
  18622. ```
  18623. *
  18624. * ```js
  18625. try {
  18626. const res = wx.getStorageInfoSync()
  18627. console.log(res.keys)
  18628. console.log(res.currentSize)
  18629. console.log(res.limitSize)
  18630. } catch (e) {
  18631. // Do something when catch error
  18632. }
  18633. ``` */
  18634. getStorageInfoSync(): GetStorageInfoSyncOption
  18635. /** [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html)
  18636. *
  18637. * 在插件中使用:需要基础库 `1.9.6`
  18638. *
  18639. * [wx.getSystemInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html) 的同步版本
  18640. *
  18641. * **示例代码**
  18642. *
  18643. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
  18644. *
  18645. * ```js
  18646. wx.getSystemInfo({
  18647. success (res) {
  18648. console.log(res.model)
  18649. console.log(res.pixelRatio)
  18650. console.log(res.windowWidth)
  18651. console.log(res.windowHeight)
  18652. console.log(res.language)
  18653. console.log(res.version)
  18654. console.log(res.platform)
  18655. }
  18656. })
  18657. ```
  18658. *
  18659. * ```js
  18660. try {
  18661. const res = wx.getSystemInfoSync()
  18662. console.log(res.model)
  18663. console.log(res.pixelRatio)
  18664. console.log(res.windowWidth)
  18665. console.log(res.windowHeight)
  18666. console.log(res.language)
  18667. console.log(res.version)
  18668. console.log(res.platform)
  18669. } catch (e) {
  18670. // Do something when catch error
  18671. }
  18672. ``` */
  18673. getSystemInfoSync(): SystemInfo
  18674. /** [Object wx.getSystemSetting()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)
  18675. *
  18676. * 需要基础库: `2.20.1`
  18677. *
  18678. * 在插件中使用:需要基础库 `2.21.3`
  18679. *
  18680. * 获取设备设置
  18681. *
  18682. * **示例代码**
  18683. *
  18684. * ```js
  18685. const systemSetting = wx.getSystemSetting()
  18686. console.log(systemSetting.bluetoothEnabled)
  18687. console.log(systemSetting.deviceOrientation)
  18688. console.log(systemSetting.locationEnabled)
  18689. console.log(systemSetting.wifiEnabled)
  18690. ``` */
  18691. getSystemSetting(): SystemSetting
  18692. /** [Object wx.getWindowInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)
  18693. *
  18694. * 需要基础库: `2.20.1`
  18695. *
  18696. * 在插件中使用:需要基础库 `2.21.3`
  18697. *
  18698. * 获取窗口信息
  18699. *
  18700. * **示例代码**
  18701. *
  18702. * ```js
  18703. const windowInfo = wx.getWindowInfo()
  18704. console.log(windowInfo.pixelRatio)
  18705. console.log(windowInfo.screenWidth)
  18706. console.log(windowInfo.screenHeight)
  18707. console.log(windowInfo.windowWidth)
  18708. console.log(windowInfo.windowHeight)
  18709. console.log(windowInfo.statusBarHeight)
  18710. console.log(windowInfo.safeArea)
  18711. console.log(windowInfo.screenTop)
  18712. ``` */
  18713. getWindowInfo(): WindowInfo
  18714. /** [Promise<string> wx.getRendererUserAgent()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getRendererUserAgent.html)
  18715. *
  18716. * 需要基础库: `2.26.3`
  18717. *
  18718. * 在插件中使用:需要基础库 `2.21.3`
  18719. *
  18720. * 获取 Webview 小程序的 UserAgent
  18721. *
  18722. * **示例代码**
  18723. *
  18724. * ```js
  18725. wx.getRendererUserAgent().then(userAgent => console.log(userAgent))
  18726. ``` */
  18727. getRendererUserAgent(): Promise<string>
  18728. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) wx.createAnimation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/wx.createAnimation.html)
  18729. *
  18730. * 在插件中使用:需要基础库 `1.9.6`
  18731. *
  18732. * 创建一个动画实例 [animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。 */
  18733. createAnimation(option: StepOption): Animation
  18734. /** [[AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) wx.createAudioContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createAudioContext.html)
  18735. *
  18736. * 在插件中使用:需要基础库 `1.9.6`
  18737. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  18738. *
  18739. * 创建 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) 对象。 */
  18740. createAudioContext(
  18741. /** [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件的 id */
  18742. id: string,
  18743. /** 在自定义组件下,当前组件实例的this,以操作组件内 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件 */
  18744. component?: Component.TrivialInstance | Page.TrivialInstance
  18745. ): AudioContext
  18746. /** [[BackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html) wx.getBackgroundAudioManager()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html)
  18747. *
  18748. * 需要基础库: `1.2.0`
  18749. *
  18750. * 在插件中使用:需要基础库 `1.9.6`
  18751. *
  18752. * 获取**全局唯一**的背景音频管理器。
  18753. * 小程序切入后台,如果音频处于播放状态,可以继续播放。但是后台状态不能通过调用API操纵音频的播放状态。
  18754. *
  18755. * 从微信客户端6.7.2版本开始,若需要在小程序切后台后继续播放音频,需要在 [app.json](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html) 中配置 `requiredBackgroundModes` 属性。开发版和体验版上可以直接生效,正式版还需通过审核。 */
  18756. getBackgroundAudioManager(): BackgroundAudioManager
  18757. /** [[CacheManager](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.html) wx.createCacheManager(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/wx.createCacheManager.html)
  18758. *
  18759. * 需要基础库: `2.24.0`
  18760. *
  18761. * 在插件中使用:不支持
  18762. *
  18763. * 创建缓存管理器
  18764. *
  18765. * **示例代码**
  18766. *
  18767. * <a href="https://github.com/wechat-miniprogram/miniprogram-offline-demo" target="_blank">查看完整示例代码</a>
  18768. *
  18769. * ```js
  18770. const cacheManager = createCacheManager()
  18771. cacheManager.addRule(/https:\/\/(?:.*)/ig) // 表示所有 https 请求都匹配
  18772. cacheManager.on('request', evt => {
  18773. // 在弱网时接收到 wx.request 请求
  18774. return new Promise((resolve, reject) => {
  18775. const matchRes = cm.match(evt)
  18776. if (matchRes && matchRes.data) {
  18777. // 有缓存,返回
  18778. resolve(matchRes.data)
  18779. } else {
  18780. // 没缓存,抛错
  18781. reject({ errMsg: 'no cache' })
  18782. }
  18783. })
  18784. })
  18785. ``` */
  18786. createCacheManager(option: CreateCacheManagerOption): CacheManager
  18787. /** [[CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) wx.createCameraContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/wx.createCameraContext.html)
  18788. *
  18789. * 需要基础库: `1.6.0`
  18790. *
  18791. * 在插件中使用:需要基础库 `1.9.6`
  18792. *
  18793. * 创建 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 上下文 [CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) 对象。 */
  18794. createCameraContext(): CameraContext
  18795. /** [[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) wx.createCanvasContext(string canvasId, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html)
  18796. *
  18797. * 在插件中使用:需要基础库 `1.9.6`
  18798. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html) 替换
  18799. *
  18800. * 创建 canvas 的绘图上下文 [CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 对象 */
  18801. createCanvasContext(
  18802. /** 要获取上下文的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 canvas-id 属性 */
  18803. canvasId: string,
  18804. /** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) ,如果省略则不在任何自定义组件内查找 */
  18805. component?: Component.TrivialInstance | Page.TrivialInstance
  18806. ): CanvasContext
  18807. /** [[DownloadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.html) wx.downloadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/wx.downloadFile.html)
  18808. *
  18809. * 在插件中使用:需要基础库 `1.9.6`
  18810. *
  18811. * 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径 (本地路径),单次下载允许的最大文件为 200MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  18812. *
  18813. * 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
  18814. *
  18815. * **示例代码**
  18816. *
  18817. * ```js
  18818. wx.downloadFile({
  18819. url: 'https://example.com/audio/123', //仅为示例,并非真实的资源
  18820. success (res) {
  18821. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  18822. if (res.statusCode === 200) {
  18823. wx.playVoice({
  18824. filePath: res.tempFilePath
  18825. })
  18826. }
  18827. }
  18828. })
  18829. ``` */
  18830. downloadFile(option: DownloadFileOption): DownloadTask
  18831. /** [[FileSystemManager](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.html) wx.getFileSystemManager()](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html)
  18832. *
  18833. * 需要基础库: `1.9.9`
  18834. *
  18835. * 在插件中使用:需要基础库 `2.19.2`
  18836. *
  18837. * 获取全局唯一的文件管理器 */
  18838. getFileSystemManager(): FileSystemManager
  18839. /** [[InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) wx.createInnerAudioContext(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html)
  18840. *
  18841. * 需要基础库: `1.6.0`
  18842. *
  18843. * 在插件中使用:需要基础库 `1.9.6`
  18844. *
  18845. * 创建内部 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 对象。
  18846. *
  18847. * **示例代码**
  18848. *
  18849. * ```js
  18850. const innerAudioContext = wx.createInnerAudioContext({
  18851. useWebAudioImplement: false // 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项
  18852. })
  18853. innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  18854. innerAudioContext.play() // 播放
  18855. innerAudioContext.pause() // 暂停
  18856. innerAudioContext.stop() // 停止
  18857. ``` */
  18858. createInnerAudioContext(
  18859. option?: CreateInnerAudioContextOption
  18860. ): InnerAudioContext
  18861. /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) wx.createIntersectionObserver(Object component, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createIntersectionObserver.html)
  18862. *
  18863. * 需要基础库: `1.9.3`
  18864. *
  18865. * 在插件中使用:需要基础库 `1.9.6`
  18866. *
  18867. * 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
  18868. *
  18869. * **示例代码**
  18870. *
  18871. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/LAbMxkmI7F2A) */
  18872. createIntersectionObserver(
  18873. /** 自定义组件实例 */
  18874. component: IAnyObject,
  18875. /** 选项 */
  18876. options?: CreateIntersectionObserverOption
  18877. ): IntersectionObserver
  18878. /** [[InterstitialAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html) wx.createInterstitialAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html)
  18879. *
  18880. * 需要基础库: `2.6.0`
  18881. *
  18882. * 在插件中使用:需要基础库 `2.8.1`
  18883. *
  18884. * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 */
  18885. createInterstitialAd(option: CreateInterstitialAdOption): InterstitialAd
  18886. /** [[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) wx.createLivePlayerContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html)
  18887. *
  18888. * 需要基础库: `1.7.0`
  18889. *
  18890. * 在插件中使用:需要基础库 `1.9.6`
  18891. *
  18892. * 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
  18893. createLivePlayerContext(
  18894. /** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */
  18895. id: string,
  18896. /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件 */
  18897. component?: Component.TrivialInstance | Page.TrivialInstance
  18898. ): LivePlayerContext
  18899. /** [[LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) wx.createLivePusherContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePusherContext.html)
  18900. *
  18901. * 需要基础库: `1.7.0`
  18902. *
  18903. * 在插件中使用:需要基础库 `1.9.6`
  18904. *
  18905. * 创建 [live-pusher](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html) 上下文 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。 */
  18906. createLivePusherContext(): LivePusherContext
  18907. /** [[LogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.html) wx.getLogManager(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html)
  18908. *
  18909. * 需要基础库: `2.1.0`
  18910. *
  18911. * 在插件中使用:不支持
  18912. *
  18913. * 获取日志管理器对象。
  18914. *
  18915. * **示例代码**
  18916. *
  18917. * ```js
  18918. const logger = wx.getLogManager({level: 1})
  18919. logger.log({str: 'hello world'}, 'basic log', 100, [1, 2, 3])
  18920. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  18921. logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3])
  18922. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
  18923. ``` */
  18924. getLogManager(option: GetLogManagerOption): LogManager
  18925. /** [[MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) wx.createMapContext(string mapId, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/wx.createMapContext.html)
  18926. *
  18927. * 在插件中使用:需要基础库 `1.9.6`
  18928. *
  18929. * 创建 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 上下文 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
  18930. createMapContext(
  18931. /** [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件的 id */
  18932. mapId: string,
  18933. /** 在自定义组件下,当前组件实例的this,以操作组件内 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件 */
  18934. component?: Component.TrivialInstance | Page.TrivialInstance
  18935. ): MapContext
  18936. /** [[MediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.html) wx.createMediaAudioPlayer()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html)
  18937. *
  18938. * 需要基础库: `2.13.0`
  18939. *
  18940. * 在插件中使用:支持
  18941. *
  18942. * 创建媒体音频播放器对象 [MediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.html) 对象,可用于播放视频解码器 [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) 输出的音频。
  18943. *
  18944. * **示例代码**
  18945. *
  18946. * ```js
  18947. // 创建视频解码器,具体参数见 createVideoDecoder 文档
  18948. const videoDecoder = wx.createVideoDecoder()
  18949. // 创建媒体音频播放器
  18950. const mediaAudioPlayer = wx.createMediaAudioPlayer()
  18951. // 启动视频解码器
  18952. videoDecoder.start()
  18953. // 启动播放器
  18954. mediaAudioPlayer.start().then(() => {
  18955. // 添加播放器音频来源
  18956. mediaAudioPlayer.addAudioSource(videoDecoder).then(res => {
  18957. videoDecoder.getFrameData() // 建议在 requestAnimationFrame 里获取每一帧视频数据
  18958. console.log(res)
  18959. })
  18960. // 移除播放器音频来源
  18961. mediaAudioPlayer.removeAudioSource(videoDecoder).then()
  18962. // 停止播放器
  18963. mediaAudioPlayer.stop().then()
  18964. // 销毁播放器
  18965. mediaAudioPlayer.destroy().then()
  18966. // 设置播放器音量
  18967. mediaAudioPlayer.volume = 0.5
  18968. })
  18969. ```
  18970. *
  18971. * **完整demo(小游戏)**
  18972. *
  18973. * - https://developers.weixin.qq.com/s/SF2duHmb7MjI */
  18974. createMediaAudioPlayer(): MediaAudioPlayer
  18975. /** [[MediaContainer](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.html) wx.createMediaContainer()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/wx.createMediaContainer.html)
  18976. *
  18977. * 需要基础库: `2.9.0`
  18978. *
  18979. * 在插件中使用:需要基础库 `2.10.0`
  18980. *
  18981. * 创建音视频处理容器,最终可将容器中的轨道合成一个视频 */
  18982. createMediaContainer(): MediaContainer
  18983. /** [[MediaRecorder](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.html) wx.createMediaRecorder(Object canvas, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html)
  18984. *
  18985. * 需要基础库: `2.11.0`
  18986. *
  18987. * 在插件中使用:需要基础库 `2.11.0`
  18988. *
  18989. * 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件
  18990. *
  18991. * **示例代码**
  18992. *
  18993. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/MCz3kPmC7zpa)
  18994. *
  18995. * **低版本异步接口兼容**
  18996. *
  18997. * 对基础库 2.16.1 版本前的 mediaRecorder,所有的接口都没有返回 Promise 对象,若需要兼容低版本,则可采用如下方式的写法:
  18998. * ```javascript
  18999. // 启动 mediaRecorder
  19000. await new Promise(resolve => {
  19001. recorder.on('start', resolve)
  19002. recorder.start()
  19003. })
  19004. // 逐帧绘制
  19005. while (frames--) {
  19006. await new Promise(resolve => recorder.requestFrame(resolve))
  19007. render()
  19008. }
  19009. // 绘制完成,生成视频
  19010. const {tempFilePath} = await new Promise(resolve => {
  19011. recorder.on('stop', resolve)
  19012. recorder.stop()
  19013. })
  19014. ``` */
  19015. createMediaRecorder(
  19016. /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象或通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建的离屏 WebGL Canvas 对象 */
  19017. canvas: IAnyObject,
  19018. options: CreateMediaRecorderOption
  19019. ): MediaRecorder
  19020. /** [[NFCAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.html) wx.getNFCAdapter()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getNFCAdapter.html)
  19021. *
  19022. * 需要基础库: `2.11.2`
  19023. *
  19024. * 在插件中使用:需要基础库 `2.11.2`
  19025. *
  19026. * 获取 NFC 实例
  19027. *
  19028. * **示例代码**
  19029. *
  19030. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/1WsbDwmb75ig) */
  19031. getNFCAdapter(): NFCAdapter
  19032. /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
  19033. *
  19034. * 需要基础库: `2.16.1`
  19035. *
  19036. * 在插件中使用:需要基础库 `2.16.1`
  19037. *
  19038. * 创建离屏 canvas 实例
  19039. *
  19040. * **离屏 Canvas 类型不可混用**
  19041. *
  19042. * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。
  19043. *
  19044. * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。
  19045. *
  19046. * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。
  19047. *
  19048. * **与 MediaRecorder 结合**
  19049. *
  19050. * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。
  19051. *
  19052. * **旧版 createOffscreenCanvas**
  19053. *
  19054. * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持
  19055. *
  19056. * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。
  19057. * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 */
  19058. createOffscreenCanvas(
  19059. /** 画布宽度 */
  19060. width: number,
  19061. /** 画布高度 */
  19062. height: number,
  19063. /** 在自定义组件下,当前组件实例的 this */
  19064. component?: Component.TrivialInstance | Page.TrivialInstance
  19065. ): OffscreenCanvas
  19066. /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
  19067. *
  19068. * 需要基础库: `2.16.1`
  19069. *
  19070. * 在插件中使用:需要基础库 `2.16.1`
  19071. *
  19072. * 创建离屏 canvas 实例
  19073. *
  19074. * **离屏 Canvas 类型不可混用**
  19075. *
  19076. * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。
  19077. *
  19078. * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。
  19079. *
  19080. * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。
  19081. *
  19082. * **与 MediaRecorder 结合**
  19083. *
  19084. * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。
  19085. *
  19086. * **旧版 createOffscreenCanvas**
  19087. *
  19088. * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持
  19089. *
  19090. * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。
  19091. * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 */
  19092. createOffscreenCanvas(
  19093. option: CreateOffscreenCanvasOption
  19094. ): OffscreenCanvas
  19095. /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.getPerformance.html)
  19096. *
  19097. * 需要基础库: `2.11.0`
  19098. *
  19099. * 在插件中使用:支持
  19100. *
  19101. * 获取当前小程序性能相关的信息。关于小程序启动性能优化的更多内容,请参考[启动性能指南](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips/start.html)。
  19102. *
  19103. * ****
  19104. *
  19105. * 目前支持获取以下几类性能指标,具体内容请参考 [PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html):
  19106. *
  19107. * | 指标类型(entryType) | 指标名称 | 最低版本 |
  19108. * | ------------------- | ---------------- | ------ |
  19109. * | 路由(navigation) | route: 路由性能 | |
  19110. * | 路由(navigation) | appLaunch: 小程序启动耗时 | |
  19111. * | 渲染(render) | firstRender: 页面首次渲染耗时 | |
  19112. * | 渲染(render) | firstPaint: 页面首次绘制 | <2.21.2> |
  19113. * | 渲染(render) | firstContentfulPaint: 页面首次内容绘制 | <2.21.2> |
  19114. * | 渲染(render) | largestContentfulPaint: 页面最大内容绘制 | <2.23.1> |
  19115. * | 脚本(script) | evaluateScript: 注入脚本耗时 | |
  19116. * | 包加载(loadPackage)| downloadPackage: 代码包下载耗时 | <2.24.0> |
  19117. * | 资源(resource) | resourceTiming: 视图层资源加载耗时 | <2.24.0> |
  19118. *
  19119. * **示例代码**
  19120. *
  19121. * ```js
  19122. const performance = wx.getPerformance()
  19123. const observer = performance.createObserver((entryList) => {
  19124. console.log(entryList.getEntries())
  19125. })
  19126. observer.observe({ entryTypes: ['render', 'script', 'navigation'] })
  19127. ```
  19128. *
  19129. * **注意**
  19130. *
  19131. * - 目前,当开启代码 [按需注入](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html) 时,`evaluateScript` 将仅包含公有部分代码(2.21.2 开始会区分公共部分/页面和组件的部分),页面和组件的代码注入的时间会包含在 `firstRender` 中(因为页面和组件的代码注入过程成为了首次渲染过程的一部分)。因此开启按需注入后,脚本耗时降低,渲染时间提高属于正常现象,优化效果可以关注整体启动耗时(`appLaunch`)来评估。
  19132. * - firstPaint 和 firstContentfulPaint 指标在开启 vConsole 的情况下,由于绘制 vConsole 面板,会导致数据提前。 */
  19133. getPerformance(): Performance
  19134. /** [[PreDownloadSubpackageTask](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/PreDownloadSubpackageTask.html) wx.preDownloadSubpackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/wx.preDownloadSubpackage.html)
  19135. *
  19136. * 需要基础库: `2.27.3`
  19137. *
  19138. * 在插件中使用:不支持
  19139. *
  19140. * 触发分包预下载。
  19141. *
  19142. * **示例代码**
  19143. *
  19144. * ```js
  19145. // 首先要在 app.json / game.json 中配置workers作为分包
  19146. {
  19147. "workers": {
  19148. "path": "myWorkersFolder",
  19149. "isSubpackage": true // true 表示把 worker 打包为分包。默认 false。填 false 时等同于 { "workers": "workers" }
  19150. }
  19151. }
  19152. ```
  19153. * ```js
  19154. // 然后调用 wx.preDownloadSubpackage 下载 worker 分包,下载成功后才可以创建 worker
  19155. var task = wx.preDownloadSubpackage({
  19156. packageType: "workers",
  19157. success(res) {
  19158. console.log("load worker success", res)
  19159. wx.createWorker("myWorkersFolder/request/index.js") // 创建 worker。 如果 worker 分包没下载完就调 createWorker 的话将报错
  19160. },
  19161. fail(res) {
  19162. console.log("load worker fail", res)
  19163. }
  19164. })
  19165. task.onProgressUpdate(res => {
  19166. console.log(res.progress) // 可通过 onProgressUpdate 接口监听下载进度
  19167. console.log(res.totalBytesWritten)
  19168. console.log(res.totalBytesExpectedToWrite)
  19169. })
  19170. ``` */
  19171. preDownloadSubpackage(
  19172. option: PreDownloadSubpackageOption
  19173. ): PreDownloadSubpackageTask
  19174. /** [[RealtimeLogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.html) wx.getRealtimeLogManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getRealtimeLogManager.html)
  19175. *
  19176. * 需要基础库: `2.7.1`
  19177. *
  19178. * 在插件中使用:需要基础库 `2.16.0`
  19179. *
  19180. * 获取实时日志管理器对象。
  19181. *
  19182. * **示例代码**
  19183. *
  19184. * ```js
  19185. // 小程序端
  19186. const logger = wx.getRealtimeLogManager()
  19187. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  19188. logger.error({str: 'hello world'}, 'error log', 100, [1, 2, 3])
  19189. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
  19190. // 插件端,基础库 2.16.0 版本后支持,只允许采用 key-value 的新格式上报
  19191. const logManager = wx.getRealtimeLogManager()
  19192. const logger = logManager.tag('plugin-log1')
  19193. logger.info('key1', 'value1')
  19194. logger.error('key2', {str: 'value2'})
  19195. logger.warn('key3', 'value3')
  19196. ``` */
  19197. getRealtimeLogManager(): RealtimeLogManager
  19198. /** [[RecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.html) wx.getRecorderManager()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html)
  19199. *
  19200. * 需要基础库: `1.6.0`
  19201. *
  19202. * 在插件中使用:需要基础库 `1.9.94`
  19203. *
  19204. * 获取**全局唯一**的录音管理器 RecorderManager */
  19205. getRecorderManager(): RecorderManager
  19206. /** [[RequestTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.html) wx.request(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html)
  19207. *
  19208. * 在插件中使用:需要基础库 `1.9.6`
  19209. *
  19210. * 发起 HTTPS 网络请求。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  19211. *
  19212. * **data 参数说明**
  19213. *
  19214. * 最终发送给服务器的数据是 String 类型,如果传入的 data 不是 String 类型,会被转换成 String 。转换规则如下:
  19215. * - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`)
  19216. * - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化
  19217. * - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)`
  19218. *
  19219. * **示例代码**
  19220. *
  19221. * ```js
  19222. wx.request({
  19223. url: 'example.php', //仅为示例,并非真实的接口地址
  19224. data: {
  19225. x: '',
  19226. y: ''
  19227. },
  19228. header: {
  19229. 'content-type': 'application/json' // 默认值
  19230. },
  19231. success (res) {
  19232. console.log(res.data)
  19233. }
  19234. })
  19235. ``` */
  19236. request<
  19237. T extends string | IAnyObject | ArrayBuffer =
  19238. | string
  19239. | IAnyObject
  19240. | ArrayBuffer
  19241. >(
  19242. option: RequestOption<T>
  19243. ): RequestTask
  19244. /** [[RewardedVideoAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.html) wx.createRewardedVideoAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createRewardedVideoAd.html)
  19245. *
  19246. * 需要基础库: `2.0.4`
  19247. *
  19248. * 在插件中使用:需要基础库 `2.8.1`
  19249. *
  19250. * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。 */
  19251. createRewardedVideoAd(
  19252. option: CreateRewardedVideoAdOption
  19253. ): RewardedVideoAd
  19254. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) wx.createSelectorQuery()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html)
  19255. *
  19256. * 需要基础库: `1.4.0`
  19257. *
  19258. * 在插件中使用:需要基础库 `1.9.6`
  19259. *
  19260. * 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
  19261. *
  19262. * **示例代码**
  19263. *
  19264. * ```js
  19265. const query = wx.createSelectorQuery()
  19266. query.select('#the-id').boundingClientRect()
  19267. query.selectViewport().scrollOffset()
  19268. query.exec(function(res){
  19269. res[0].top // #the-id节点的上边界坐标
  19270. res[1].scrollTop // 显示区域的竖直滚动位置
  19271. })
  19272. ``` */
  19273. createSelectorQuery(): SelectorQuery
  19274. /** [[SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) wx.connectSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.connectSocket.html)
  19275. *
  19276. * 在插件中使用:需要基础库 `1.9.6`
  19277. *
  19278. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  19279. *
  19280. * 创建一个 WebSocket 连接。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  19281. *
  19282. * **并发数**
  19283. *
  19284. * - 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接。
  19285. * - 1.7.0 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
  19286. *
  19287. * **示例代码**
  19288. *
  19289. * ```js
  19290. wx.connectSocket({
  19291. url: 'wss://example.qq.com',
  19292. header:{
  19293. 'content-type': 'application/json'
  19294. },
  19295. protocols: ['protocol1']
  19296. })
  19297. ``` */
  19298. connectSocket(option: ConnectSocketOption): SocketTask
  19299. /** [[TCPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.html) wx.createTCPSocket()](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/wx.createTCPSocket.html)
  19300. *
  19301. * 需要基础库: `2.18.0`
  19302. *
  19303. * 在插件中使用:支持
  19304. *
  19305. * 创建一个 TCP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  19306. *
  19307. * **连接限制**
  19308. *
  19309. * - 允许与局域网内的非本机 IP 通信
  19310. * - 允许与配置过的服务器域名通信,详见[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)
  19311. * - 禁止与以下端口号连接:`1024 以下` `1099` `1433` `1521` `1719` `1720` `1723` `2049` `2375` `3128` `3306` `3389` `3659` `4045` `5060` `5061` `5432` `5984` `6379` `6000` `6566` `7001` `7002` `8000-8100` `8443` `8888` `9200` `9300` `10051` `10080` `11211` `27017` `27018` `27019`
  19312. * - 每 5 分钟内最多创建 20 个 TCPSocket */
  19313. createTCPSocket(): TCPSocket
  19314. /** [[UDPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.html) wx.createUDPSocket()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/wx.createUDPSocket.html)
  19315. *
  19316. * 需要基础库: `2.7.0`
  19317. *
  19318. * 在插件中使用:需要基础库 `2.11.1`
  19319. *
  19320. * 创建一个 UDP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 */
  19321. createUDPSocket(): UDPSocket
  19322. /** [[UpdateManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html) wx.getUpdateManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.getUpdateManager.html)
  19323. *
  19324. * 需要基础库: `1.9.90`
  19325. *
  19326. * 在插件中使用:不支持
  19327. *
  19328. * 获取**全局唯一**的版本更新管理器,用于管理小程序更新。关于小程序的更新机制,可以查看[运行机制](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/operating-mechanism.html)文档。
  19329. *
  19330. * **示例代码**
  19331. *
  19332. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  19333. getUpdateManager(): UpdateManager
  19334. /** [[UploadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.html) wx.uploadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/wx.uploadFile.html)
  19335. *
  19336. * 在插件中使用:需要基础库 `1.9.6`
  19337. *
  19338. * 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 `content-type` 为 `multipart/form-data`。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  19339. *
  19340. * **示例代码**
  19341. *
  19342. * ```js
  19343. wx.chooseImage({
  19344. success (res) {
  19345. const tempFilePaths = res.tempFilePaths
  19346. wx.uploadFile({
  19347. url: 'https://example.weixin.qq.com/upload', //仅为示例,非真实的接口地址
  19348. filePath: tempFilePaths[0],
  19349. name: 'file',
  19350. formData: {
  19351. 'user': 'test'
  19352. },
  19353. success (res){
  19354. const data = res.data
  19355. //do something
  19356. }
  19357. })
  19358. }
  19359. })
  19360. ``` */
  19361. uploadFile(option: UploadFileOption): UploadTask
  19362. /** [[UserCryptoManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.html) wx.getUserCryptoManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/wx.getUserCryptoManager.html)
  19363. *
  19364. * 需要基础库: `2.17.3`
  19365. *
  19366. * 在插件中使用:不支持
  19367. *
  19368. * 获取用户加密模块 */
  19369. getUserCryptoManager(): UserCryptoManager
  19370. /** [[VKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.html) wx.createVKSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html)
  19371. *
  19372. * 需要基础库: `2.20.0`
  19373. *
  19374. * 在插件中使用:需要基础库 `2.20.0`
  19375. *
  19376. * 创建 vision kit 会话对象。
  19377. *
  19378. * **示例代码**
  19379. *
  19380. * v1 版本:[VisionKit基础能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/visionkit-basic)
  19381. * v2 版本:[VisionKit-v2基础能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/visionkit-basic-v2)
  19382. * ```js
  19383. // 以下 demo 以 v2 为例
  19384. // 创建 session 对象
  19385. const ssession = wx.createVKSession({
  19386. track: {
  19387. plane: {mode: 3},
  19388. },
  19389. version: 'v2',
  19390. gl, // WebGLRenderingContext
  19391. })
  19392. // 逐帧分析
  19393. const onFrame = timestamp => {
  19394. // 开发者可以自己控制帧率
  19395. const frame = session.getVKFrame(canvasWidth, canvasHeight)
  19396. if (frame) {
  19397. // 分析完毕,可以拿到帧对象
  19398. doRender(frame)
  19399. }
  19400. session.requestAnimationFrame(onFrame)
  19401. }
  19402. session.start(err => {
  19403. if (!err) session.requestAnimationFrame(onFrame)
  19404. })
  19405. // 渲染函数
  19406. const doRender = frame => {
  19407. // ...
  19408. }
  19409. ``` */
  19410. createVKSession(option: VKConfig): VKSession
  19411. /** [[VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) wx.createVideoContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.createVideoContext.html)
  19412. *
  19413. * 在插件中使用:需要基础库 `1.9.6`
  19414. *
  19415. * 创建 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 上下文 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
  19416. createVideoContext(
  19417. /** [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件的 id */
  19418. id: string,
  19419. /** 在自定义组件下,当前组件实例的this,以操作组件内 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件 */
  19420. component?: Component.TrivialInstance | Page.TrivialInstance
  19421. ): VideoContext
  19422. /** [[VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) wx.createVideoDecoder()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/wx.createVideoDecoder.html)
  19423. *
  19424. * 需要基础库: `2.11.0`
  19425. *
  19426. * 在插件中使用:需要基础库 `2.11.0`
  19427. *
  19428. * 创建视频解码器,可逐帧获取解码后的数据 */
  19429. createVideoDecoder(): VideoDecoder
  19430. /** [[WebAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.html) wx.createWebAudioContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html)
  19431. *
  19432. * 需要基础库: `2.19.0`
  19433. *
  19434. * 在插件中使用:不支持
  19435. *
  19436. * 创建 WebAudio 上下文。 */
  19437. createWebAudioContext(): WebAudioContext
  19438. /** [[Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html) wx.createWorker(string scriptPath, object options)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html)
  19439. *
  19440. * 需要基础库: `1.9.90`
  19441. *
  19442. * 在插件中使用:需要基础库 `2.18.1`
  19443. *
  19444. * 创建一个 Worker 线程
  19445. *
  19446. * **示例代码**
  19447. *
  19448. * ```js
  19449. // 创建普通worker
  19450. wx.createWorker('workers/index.js')
  19451. ```
  19452. * ```js
  19453. function createNewWorker() {
  19454. const worker = wx.createWorker('workers/index.js', {
  19455. useExperimentalWorker: true
  19456. })
  19457. // 监听worker被系统回收事件
  19458. worker.onProcessKilled(() => {
  19459. // 重新创建一个worker
  19460. createNewWorker()
  19461. })
  19462. }
  19463. // 创建实验worker
  19464. createNewWorker()
  19465. ``` */
  19466. createWorker(
  19467. /** worker 入口文件的**绝对路径** */
  19468. scriptPath: string,
  19469. /** 可选参数 */
  19470. options?: CreateWorkerOption
  19471. ): Worker
  19472. /** [any wx.getStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageSync.html)
  19473. *
  19474. * 在插件中使用:需要基础库 `1.9.6`
  19475. *
  19476. * 从本地缓存中同步获取指定 key 的内容。
  19477. *
  19478. * **注意**
  19479. *
  19480. * storage 应只用来进行数据的持久化存储,不应用于运行时的数据传递或全局状态管理。启动过程中过多的同步读写存储,会显著影响启动耗时。
  19481. *
  19482. * **示例代码**
  19483. *
  19484. * ```js
  19485. try {
  19486. var value = wx.getStorageSync('key')
  19487. if (value) {
  19488. // Do something with return value
  19489. }
  19490. } catch (e) {
  19491. // Do something when catch error
  19492. }
  19493. ``` */
  19494. getStorageSync<T = any>(
  19495. /** 本地缓存中指定的 key */
  19496. key: string
  19497. ): T
  19498. /** [boolean wx.canIUse(string schema)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html)
  19499. *
  19500. * 需要基础库: `1.1.1`
  19501. *
  19502. * 在插件中使用:不支持
  19503. *
  19504. * 判断小程序的API,回调,参数,组件等是否在当前版本可用。
  19505. *
  19506. * **参数说明**
  19507. *
  19508. * - `${API}` 代表 API 名字
  19509. * - `${method}` 代表调用方式,有效值为return, success, object, callback
  19510. * - `${param}` 代表参数或者返回值
  19511. * - `${option}` 代表参数的可选值或者返回值的属性
  19512. * - `${component}` 代表组件名字
  19513. * - `${attribute}` 代表组件属性
  19514. * - `${option}` 代表组件属性的可选值
  19515. *
  19516. * **示例代码**
  19517. *
  19518. * ```js
  19519. // 对象的属性或方法
  19520. wx.canIUse('console.log')
  19521. wx.canIUse('CameraContext.onCameraFrame')
  19522. wx.canIUse('CameraFrameListener.start')
  19523. wx.canIUse('Image.src')
  19524. // wx接口参数、回调或者返回值
  19525. wx.canIUse('openBluetoothAdapter')
  19526. wx.canIUse('getSystemInfoSync.return.safeArea.left')
  19527. wx.canIUse('getSystemInfo.success.screenWidth')
  19528. wx.canIUse('showToast.object.image')
  19529. wx.canIUse('onCompassChange.callback.direction')
  19530. wx.canIUse('request.object.method.GET')
  19531. // 组件的属性
  19532. wx.canIUse('live-player')
  19533. wx.canIUse('text.selectable')
  19534. wx.canIUse('button.open-type.contact')
  19535. ``` */
  19536. canIUse(
  19537. /** 使用 `${API}.${method}.${param}.${option}` 或者 `${component}.${attribute}.${option}` 方式来调用 */
  19538. schema: string
  19539. ): boolean
  19540. /** [boolean wx.isVKSupport(string version)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.isVKSupport.html)
  19541. *
  19542. * 需要基础库: `2.22.0`
  19543. *
  19544. * 在插件中使用:需要基础库 `2.22.0`
  19545. *
  19546. * 判断支持版本
  19547. *
  19548. * **示例代码**
  19549. *
  19550. * ```js
  19551. const isSupportV2 = wx.isVKSupport('v2')
  19552. ``` */
  19553. isVKSupport(
  19554. /** 参数 version 可选值:
  19555. * - 'v1': 旧版本;
  19556. * - 'v2': v2 版本,目前只有 iOS 基础库 2.22.0 以上支持; */
  19557. version: 'v1' | 'v2'
  19558. ): boolean
  19559. /** [string wx.arrayBufferToBase64(ArrayBuffer arrayBuffer)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.arrayBufferToBase64.html)
  19560. *
  19561. * 需要基础库: `1.1.0`
  19562. *
  19563. * 在插件中使用:支持
  19564. * @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  19565. *
  19566. * 将 ArrayBuffer 对象转成 Base64 字符串 */
  19567. arrayBufferToBase64(
  19568. /** 要转换成 Base64 字符串的 ArrayBuffer 对象 */
  19569. arrayBuffer: ArrayBuffer
  19570. ): string
  19571. /** [string wx.createBufferURL(ArrayBuffer|TypedArray buffer)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.createBufferURL.html)
  19572. *
  19573. * 需要基础库: `2.14.0`
  19574. *
  19575. * 在插件中使用:不支持
  19576. *
  19577. * 根据传入的 buffer 创建一个唯一的 URL 存在内存中 */
  19578. createBufferURL(
  19579. /** 需要存入内存的二进制数据 */
  19580. buffer:
  19581. | ArrayBuffer
  19582. | Int8Array
  19583. | Uint8Array
  19584. | Uint8ClampedArray
  19585. | Int16Array
  19586. | Uint16Array
  19587. | Int32Array
  19588. | Uint32Array
  19589. | Float32Array
  19590. | Float64Array
  19591. ): string
  19592. /** [wx.addCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html)
  19593. *
  19594. * 需要基础库: `1.1.0`
  19595. *
  19596. * 在插件中使用:不支持
  19597. *
  19598. * 批量添加卡券。只有通过 [认证](https://developers.weixin.qq.com/miniprogram/product/renzheng.html) 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 [微信卡券接口文档](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1490190158&version=1&lang=zh_CN&platform=2)。
  19599. *
  19600. * **cardExt 说明**
  19601. *
  19602. * cardExt 是卡券的扩展参数,其值是一个 JSON 字符串。
  19603. *
  19604. * **示例代码**
  19605. *
  19606. * ```js
  19607. wx.addCard({
  19608. cardList: [
  19609. {
  19610. cardId: '',
  19611. cardExt: '{"code": "", "openid": "", "timestamp": "", "signature":""}'
  19612. }, {
  19613. cardId: '',
  19614. cardExt: '{"code": "", "openid": "", "timestamp": "", "signature":""}'
  19615. }
  19616. ],
  19617. success (res) {
  19618. console.log(res.cardList) // 卡券添加结果
  19619. }
  19620. })
  19621. ``` */
  19622. addCard<T extends AddCardOption = AddCardOption>(
  19623. option: T
  19624. ): PromisifySuccessResult<T, AddCardOption>
  19625. /** [wx.addFileToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addFileToFavorites.html)
  19626. *
  19627. * 需要基础库: `2.16.1`
  19628. *
  19629. * 在插件中使用:不支持
  19630. *
  19631. * 收藏文件 */
  19632. addFileToFavorites<
  19633. T extends AddFileToFavoritesOption = AddFileToFavoritesOption
  19634. >(
  19635. option: T
  19636. ): PromisifySuccessResult<T, AddFileToFavoritesOption>
  19637. /** [wx.addPhoneCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html)
  19638. *
  19639. * 需要基础库: `2.15.0`
  19640. *
  19641. * 在插件中使用:不支持
  19642. *
  19643. * 向系统日历添加事件 */
  19644. addPhoneCalendar<
  19645. T extends AddPhoneCalendarOption = AddPhoneCalendarOption
  19646. >(
  19647. option: T
  19648. ): PromisifySuccessResult<T, AddPhoneCalendarOption>
  19649. /** [wx.addPhoneContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html)
  19650. *
  19651. * 需要基础库: `1.2.0`
  19652. *
  19653. * 在插件中使用:需要基础库 `1.9.6`
  19654. *
  19655. * 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。 */
  19656. addPhoneContact<
  19657. T extends AddPhoneContactOption = AddPhoneContactOption
  19658. >(
  19659. option: T
  19660. ): PromisifySuccessResult<T, AddPhoneContactOption>
  19661. /** [wx.addPhoneRepeatCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html)
  19662. *
  19663. * 需要基础库: `2.15.0`
  19664. *
  19665. * 在插件中使用:不支持
  19666. *
  19667. * 向系统日历添加重复事件 */
  19668. addPhoneRepeatCalendar<
  19669. T extends AddPhoneRepeatCalendarOption = AddPhoneRepeatCalendarOption
  19670. >(
  19671. option: T
  19672. ): PromisifySuccessResult<T, AddPhoneRepeatCalendarOption>
  19673. /** [wx.addVideoToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addVideoToFavorites.html)
  19674. *
  19675. * 需要基础库: `2.16.1`
  19676. *
  19677. * 在插件中使用:不支持
  19678. *
  19679. * 收藏视频 */
  19680. addVideoToFavorites<
  19681. T extends AddVideoToFavoritesOption = AddVideoToFavoritesOption
  19682. >(
  19683. option: T
  19684. ): PromisifySuccessResult<T, AddVideoToFavoritesOption>
  19685. /** [wx.authPrivateMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.authPrivateMessage.html)
  19686. *
  19687. * 需要基础库: `2.13.0`
  19688. *
  19689. * 在插件中使用:不支持
  19690. *
  19691. * 验证私密消息。用法详情见 [小程序私密消息使用指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html)
  19692. *
  19693. * **示例代码**
  19694. *
  19695. * ```js
  19696. wx.authPrivateMessage({
  19697. shareTicket: 'xxxxxx',
  19698. success(res) {
  19699. console.log('authPrivateMessage success', res)
  19700. // res
  19701. // {
  19702. // errMsg: 'authPrivateMessage:ok'
  19703. // valid: true
  19704. // iv: 'xxxx',
  19705. // encryptedData: 'xxxxxx'
  19706. // }
  19707. },
  19708. fail(res) {
  19709. console.log('authPrivateMessage fail', res)
  19710. }
  19711. })
  19712. ``` */
  19713. authPrivateMessage(option?: AuthPrivateMessageOption): void
  19714. /** [wx.authorize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)
  19715. *
  19716. * 需要基础库: `1.2.0`
  19717. *
  19718. * 在插件中使用:不支持
  19719. *
  19720. * 提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。更多用法详见 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)。
  19721. * > 小程序插件可以使用 [wx.authorizeForMiniProgram](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
  19722. *
  19723. * **示例代码**
  19724. *
  19725. * ```js
  19726. // 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
  19727. wx.getSetting({
  19728. success(res) {
  19729. if (!res.authSetting['scope.record']) {
  19730. wx.authorize({
  19731. scope: 'scope.record',
  19732. success () {
  19733. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  19734. wx.startRecord()
  19735. }
  19736. })
  19737. }
  19738. }
  19739. })
  19740. ``` */
  19741. authorize<T extends AuthorizeOption = AuthorizeOption>(
  19742. option: T
  19743. ): PromisifySuccessResult<T, AuthorizeOption>
  19744. /** [wx.authorizeForMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
  19745. *
  19746. * 需要基础库: `2.14.4`
  19747. *
  19748. * 在插件中使用:需要基础库 `2.14.4`
  19749. *
  19750. * **仅小程序插件中能调用该接口**,用法同 [wx.authorize](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)。目前仅支持三种 scope(见下)
  19751. *
  19752. * **示例代码**
  19753. *
  19754. * ```js
  19755. wx.authorizeForMiniProgram({
  19756. scope: 'scope.record',
  19757. success () {
  19758. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  19759. wx.startRecord()
  19760. }
  19761. })
  19762. ``` */
  19763. authorizeForMiniProgram(option: AuthorizeForMiniProgramOption): void
  19764. /** [wx.batchGetStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html)
  19765. *
  19766. * 需要基础库: `2.25.0`
  19767. *
  19768. * 在插件中使用:不支持
  19769. *
  19770. * 从本地缓存中异步批量获取指定 key 的内容。
  19771. *
  19772. * **示例代码**
  19773. *
  19774. * ```js
  19775. wx.batchGetStorage({
  19776. keyList: ['key'],
  19777. success (res) {
  19778. console.log(res)
  19779. }
  19780. })
  19781. ``` */
  19782. batchGetStorage<
  19783. T extends BatchGetStorageOption = BatchGetStorageOption
  19784. >(
  19785. option: T
  19786. ): PromisifySuccessResult<T, BatchGetStorageOption>
  19787. /** [wx.batchSetStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchSetStorage.html)
  19788. *
  19789. * 需要基础库: `2.25.0`
  19790. *
  19791. * 在插件中使用:需要基础库 `1.9.6`
  19792. *
  19793. * 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  19794. *
  19795. * **示例代码**
  19796. *
  19797. * ```js
  19798. wx.setStorage({
  19799. key:"key",
  19800. data:"value"
  19801. })
  19802. ```
  19803. *
  19804. * ```js
  19805. // 开启加密存储
  19806. wx.batchSetStorage({
  19807. kvList: [{
  19808. key: 'key',
  19809. value: 'value',
  19810. }],
  19811. })
  19812. ``` */
  19813. batchSetStorage<
  19814. T extends BatchSetStorageOption = BatchSetStorageOption
  19815. >(
  19816. option: T
  19817. ): PromisifySuccessResult<T, BatchSetStorageOption>
  19818. /** [wx.batchSetStorageSync(Array.&lt;Object&gt; kvList)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchSetStorageSync.html)
  19819. *
  19820. * 需要基础库: `2.25.0`
  19821. *
  19822. * 在插件中使用:需要基础库 `1.9.6`
  19823. *
  19824. * 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  19825. *
  19826. * **示例代码**
  19827. *
  19828. * ```js
  19829. try {
  19830. wx.batchSetStorageSync([{key: 'key', value: 'value'}])
  19831. } catch (e) { }
  19832. ``` */
  19833. batchSetStorageSync(kvList: KvList[]): void
  19834. /** [wx.canvasGetImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html)
  19835. *
  19836. * 需要基础库: `1.9.0`
  19837. *
  19838. * 在插件中使用:需要基础库 `1.9.6`
  19839. *
  19840. * 获取 canvas 区域隐含的像素数据。
  19841. *
  19842. * **示例代码**
  19843. *
  19844. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/yufmRjmZ7W8f)
  19845. *
  19846. * ```js
  19847. wx.canvasGetImageData({
  19848. canvasId: 'myCanvas',
  19849. x: 0,
  19850. y: 0,
  19851. width: 100,
  19852. height: 100,
  19853. success(res) {
  19854. console.log(res.width) // 100
  19855. console.log(res.height) // 100
  19856. console.log(res.data instanceof Uint8ClampedArray) // true
  19857. console.log(res.data.length) // 100 * 100 * 4
  19858. }
  19859. })
  19860. ``` */
  19861. canvasGetImageData<
  19862. T extends CanvasGetImageDataOption = CanvasGetImageDataOption
  19863. >(
  19864. option: T,
  19865. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  19866. component?: Component.TrivialInstance | Page.TrivialInstance
  19867. ): PromisifySuccessResult<T, CanvasGetImageDataOption>
  19868. /** [wx.canvasPutImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasPutImageData.html)
  19869. *
  19870. * 需要基础库: `1.9.0`
  19871. *
  19872. * 在插件中使用:需要基础库 `1.9.6`
  19873. *
  19874. * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 <canvas> 组件 */
  19875. canvasPutImageData<
  19876. T extends CanvasPutImageDataOption = CanvasPutImageDataOption
  19877. >(
  19878. option: T,
  19879. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  19880. component?: Component.TrivialInstance | Page.TrivialInstance
  19881. ): PromisifySuccessResult<T, CanvasPutImageDataOption>
  19882. /** [wx.canvasToTempFilePath(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html)
  19883. *
  19884. * 在插件中使用:需要基础库 `1.9.6`
  19885. *
  19886. * 把当前画布指定区域的内容导出生成指定大小的图片。在 `draw()` 回调里调用该方法才能保证图片导出成功。 */
  19887. canvasToTempFilePath<
  19888. T extends CanvasToTempFilePathOption = CanvasToTempFilePathOption
  19889. >(
  19890. option: T,
  19891. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  19892. component?: Component.TrivialInstance | Page.TrivialInstance
  19893. ): PromisifySuccessResult<T, CanvasToTempFilePathOption>
  19894. /** [wx.checkIsAddedToMyMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html)
  19895. *
  19896. * 需要基础库: `2.29.1`
  19897. *
  19898. * 在插件中使用:不支持
  19899. *
  19900. * 检查小程序是否被添加至 「我的小程序」 */
  19901. checkIsAddedToMyMiniProgram(
  19902. option: CheckIsAddedToMyMiniProgramOption
  19903. ): void
  19904. /** [wx.checkIsOpenAccessibility(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html)
  19905. *
  19906. * 需要基础库: `2.13.0`
  19907. *
  19908. * 在插件中使用:不支持
  19909. *
  19910. * 检测是否开启视觉无障碍功能。 */
  19911. checkIsOpenAccessibility<
  19912. T extends CheckIsOpenAccessibilityOption = CheckIsOpenAccessibilityOption
  19913. >(
  19914. option?: T
  19915. ): PromisifySuccessResult<T, CheckIsOpenAccessibilityOption>
  19916. /** [wx.checkIsSoterEnrolledInDevice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html)
  19917. *
  19918. * 需要基础库: `1.6.0`
  19919. *
  19920. * 在插件中使用:不支持
  19921. *
  19922. * 获取设备内是否录入如指纹等生物信息的接口
  19923. *
  19924. * **示例代码**
  19925. *
  19926. * ```js
  19927. wx.checkIsSoterEnrolledInDevice({
  19928. checkAuthMode: 'fingerPrint',
  19929. success(res) {
  19930. console.log(res.isEnrolled)
  19931. }
  19932. })
  19933. ``` */
  19934. checkIsSoterEnrolledInDevice<
  19935. T extends CheckIsSoterEnrolledInDeviceOption = CheckIsSoterEnrolledInDeviceOption
  19936. >(
  19937. option: T
  19938. ): PromisifySuccessResult<T, CheckIsSoterEnrolledInDeviceOption>
  19939. /** [wx.checkIsSupportSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html)
  19940. *
  19941. * 需要基础库: `1.5.0`
  19942. *
  19943. * 在插件中使用:不支持
  19944. *
  19945. * 获取本机支持的 SOTER 生物认证方式
  19946. *
  19947. * **示例代码**
  19948. *
  19949. * ```js
  19950. wx.checkIsSupportSoterAuthentication({
  19951. success(res) {
  19952. // res.supportMode = [] 不具备任何被SOTER支持的生物识别方式
  19953. // res.supportMode = ['fingerPrint'] 只支持指纹识别
  19954. // res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
  19955. }
  19956. })
  19957. ``` */
  19958. checkIsSupportSoterAuthentication<
  19959. T extends CheckIsSupportSoterAuthenticationOption = CheckIsSupportSoterAuthenticationOption
  19960. >(
  19961. option?: T
  19962. ): PromisifySuccessResult<T, CheckIsSupportSoterAuthenticationOption>
  19963. /** [wx.checkSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html)
  19964. *
  19965. * 在插件中使用:不支持
  19966. *
  19967. * 检查登录态是否过期。
  19968. * 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 wx.checkSession 接口检测当前用户登录态是否有效。
  19969. *
  19970. * 登录态过期后开发者可以再调用 wx.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。
  19971. *
  19972. * **示例代码**
  19973. *
  19974. * ```js
  19975. wx.checkSession({
  19976. success () {
  19977. //session_key 未过期,并且在本生命周期一直有效
  19978. },
  19979. fail () {
  19980. // session_key 已经失效,需要重新执行登录流程
  19981. wx.login() //重新登录
  19982. }
  19983. })
  19984. ``` */
  19985. checkSession<T extends CheckSessionOption = CheckSessionOption>(
  19986. option?: T
  19987. ): PromisifySuccessResult<T, CheckSessionOption>
  19988. /** [wx.chooseAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html)
  19989. *
  19990. * 需要基础库: `1.1.0`
  19991. *
  19992. * 在插件中使用:需要基础库 `2.16.1`
  19993. *
  19994. * 获取用户收货地址。调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
  19995. * ## 使用方法
  19996. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  19997. * ## 申请开通
  19998. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  19999. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  20000. *
  20001. * **示例代码**
  20002. *
  20003. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/024hHnmd772y)
  20004. * ```js
  20005. wx.chooseAddress({
  20006. success (res) {
  20007. console.log(res.userName)
  20008. console.log(res.postalCode)
  20009. console.log(res.provinceName)
  20010. console.log(res.cityName)
  20011. console.log(res.countyName)
  20012. console.log(res.detailInfo)
  20013. console.log(res.nationalCode)
  20014. console.log(res.telNumber)
  20015. }
  20016. })
  20017. ``` */
  20018. chooseAddress<T extends ChooseAddressOption = ChooseAddressOption>(
  20019. option?: T
  20020. ): PromisifySuccessResult<T, ChooseAddressOption>
  20021. /** [wx.chooseContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.chooseContact.html)
  20022. *
  20023. * 需要基础库: `2.8.0`
  20024. *
  20025. * 在插件中使用:不支持
  20026. *
  20027. * 拉起手机通讯录,选择联系人。 */
  20028. chooseContact(option?: ChooseContactOption): void
  20029. /** [wx.chooseImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)
  20030. *
  20031. * 在插件中使用:需要基础库 `1.9.6`
  20032. * @deprecated 基础库版本 [2.21.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.chooseMedia](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) 替换
  20033. *
  20034. * 从本地相册选择图片或使用相机拍照。
  20035. *
  20036. * ****
  20037. *
  20038. * ```js
  20039. wx.chooseImage({
  20040. count: 1,
  20041. sizeType: ['original', 'compressed'],
  20042. sourceType: ['album', 'camera'],
  20043. success (res) {
  20044. // tempFilePath可以作为img标签的src属性显示图片
  20045. const tempFilePaths = res.tempFilePaths
  20046. }
  20047. })
  20048. ``` */
  20049. chooseImage<T extends ChooseImageOption = ChooseImageOption>(
  20050. option?: T
  20051. ): PromisifySuccessResult<T, ChooseImageOption>
  20052. /** [wx.chooseInvoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html)
  20053. *
  20054. * 需要基础库: `2.3.0`
  20055. *
  20056. * 在插件中使用:需要基础库 `2.16.1`
  20057. *
  20058. * 选择用户已有的发票。
  20059. *
  20060. * **通过 cardId 和 encryptCode 获得报销发票的信息**
  20061. *
  20062. * 请参考[微信电子发票文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21517918939oae3U)中,「查询报销发票信息」部分。
  20063. * 其中 `access_token` 的获取请参考[auth.getAccessToken](#)文档 */
  20064. chooseInvoice<T extends ChooseInvoiceOption = ChooseInvoiceOption>(
  20065. option?: T
  20066. ): PromisifySuccessResult<T, ChooseInvoiceOption>
  20067. /** [wx.chooseInvoiceTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html)
  20068. *
  20069. * 需要基础库: `1.5.0`
  20070. *
  20071. * 在插件中使用:需要基础库 `2.16.1`
  20072. *
  20073. * 选择用户的发票抬头。当前小程序必须关联一个公众号,且这个公众号是完成了[微信认证](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1496554031_RD4xe)的,才能调用 chooseInvoiceTitle。
  20074. *
  20075. * **示例代码**
  20076. *
  20077. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/GJ4S9nmQ7x2E)
  20078. *
  20079. * ```js
  20080. wx.chooseInvoiceTitle({
  20081. success(res) {}
  20082. })
  20083. ``` */
  20084. chooseInvoiceTitle<
  20085. T extends ChooseInvoiceTitleOption = ChooseInvoiceTitleOption
  20086. >(
  20087. option?: T
  20088. ): PromisifySuccessResult<T, ChooseInvoiceTitleOption>
  20089. /** [wx.chooseLicensePlate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/license-plate/wx.chooseLicensePlate.html)
  20090. *
  20091. * 需要基础库: `2.19.0`
  20092. *
  20093. * 在插件中使用:不支持
  20094. *
  20095. * 选择车牌号 */
  20096. chooseLicensePlate<
  20097. T extends ChooseLicensePlateOption = ChooseLicensePlateOption
  20098. >(
  20099. option?: T
  20100. ): PromisifySuccessResult<T, ChooseLicensePlateOption>
  20101. /** [wx.chooseLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html)
  20102. *
  20103. * 在插件中使用:需要基础库 `1.9.6`
  20104. *
  20105. * @warning **为确保选择地理位置接口的合理使用,位置接口调整参考 [选择地理位置接口调整公告](https://developers.weixin.qq.com/community/develop/doc/0006e45df2cac030e6edf367c56001)**
  20106. *
  20107. * 打开地图选择位置。
  20108. * ## 使用方法
  20109. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  20110. * ## 申请开通
  20111. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  20112. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  20113. *
  20114. * **示例**
  20115. *
  20116. * ![](https://res.wx.qq.com/op_res/WDFC8aB4FI8rJ9oEmbYfbH_Fl3EIv91471YVxezVfLRESkUuCgfODZcbOoyteKU4j-OLZa2EFKY9BDPd3g-tfg#width:260px) */
  20117. chooseLocation<T extends ChooseLocationOption = ChooseLocationOption>(
  20118. option: T
  20119. ): PromisifySuccessResult<T, ChooseLocationOption>
  20120. /** [wx.chooseMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html)
  20121. *
  20122. * 需要基础库: `2.10.0`
  20123. *
  20124. * 在插件中使用:需要基础库 `2.11.1`
  20125. *
  20126. * 拍摄或从手机相册中选择图片或视频。
  20127. *
  20128. * **示例代码**
  20129. *
  20130. * ```js
  20131. wx.chooseMedia({
  20132. count: 9,
  20133. mediaType: ['image','video'],
  20134. sourceType: ['album', 'camera'],
  20135. maxDuration: 30,
  20136. camera: 'back',
  20137. success(res) {
  20138. console.log(res.tempFiles.tempFilePath)
  20139. console.log(res.tempFiles.size)
  20140. }
  20141. })
  20142. ``` */
  20143. chooseMedia<T extends ChooseMediaOption = ChooseMediaOption>(
  20144. option: T
  20145. ): PromisifySuccessResult<T, ChooseMediaOption>
  20146. /** [wx.chooseMessageFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html)
  20147. *
  20148. * 需要基础库: `2.5.0`
  20149. *
  20150. * 在插件中使用:不支持
  20151. *
  20152. * 从客户端会话选择文件。
  20153. *
  20154. * ****
  20155. *
  20156. * ```js
  20157. wx.chooseMessageFile({
  20158. count: 10,
  20159. type: 'image',
  20160. success (res) {
  20161. // tempFilePath可以作为img标签的src属性显示图片
  20162. const tempFilePaths = res.tempFiles
  20163. }
  20164. })
  20165. ``` */
  20166. chooseMessageFile<
  20167. T extends ChooseMessageFileOption = ChooseMessageFileOption
  20168. >(
  20169. option: T
  20170. ): PromisifySuccessResult<T, ChooseMessageFileOption>
  20171. /** [wx.choosePoi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.choosePoi.html)
  20172. *
  20173. * 在插件中使用:不支持
  20174. *
  20175. * @warning **为确保选择地理位置接口的合理使用,位置接口调整参考 [选择地理位置接口调整公告](https://developers.weixin.qq.com/community/develop/doc/0006e45df2cac030e6edf367c56001)**
  20176. *
  20177. * 打开POI列表选择位置,支持模糊定位(精确到市)和精确定位混选。
  20178. * ## 使用方法
  20179. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  20180. * ## 申请开通
  20181. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  20182. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  20183. *
  20184. * **示例**
  20185. *
  20186. * ![](https://res.wx.qq.com/op_res/lzDsNyBNifLczyLX0ms7ZpPQysgAgdhrQTGzzTQPiXkAB2HJIf1Slvl4rnN9I1q0AT3xqoGTg98jMsNexDLbbA#width:260px) */
  20187. choosePoi<T extends ChoosePoiOption = ChoosePoiOption>(
  20188. option: T
  20189. ): PromisifySuccessResult<T, ChoosePoiOption>
  20190. /** [wx.chooseVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)
  20191. *
  20192. * 在插件中使用:需要基础库 `1.9.6`
  20193. * @deprecated 基础库版本 [2.21.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.chooseMedia](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) 替换
  20194. *
  20195. * 拍摄视频或从手机相册中选视频。
  20196. *
  20197. * **示例代码**
  20198. *
  20199. * ```js
  20200. wx.chooseVideo({
  20201. sourceType: ['album','camera'],
  20202. maxDuration: 60,
  20203. camera: 'back',
  20204. success(res) {
  20205. console.log(res.tempFilePath)
  20206. }
  20207. })
  20208. ``` */
  20209. chooseVideo<T extends ChooseVideoOption = ChooseVideoOption>(
  20210. option: T
  20211. ): PromisifySuccessResult<T, ChooseVideoOption>
  20212. /** [wx.clearStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html)
  20213. *
  20214. * 在插件中使用:不支持
  20215. *
  20216. * 清理本地数据缓存。
  20217. *
  20218. * **示例代码**
  20219. *
  20220. * ```js
  20221. wx.clearStorage()
  20222. ```
  20223. *
  20224. * ```js
  20225. try {
  20226. wx.clearStorageSync()
  20227. } catch(e) {
  20228. // Do something when catch error
  20229. }
  20230. ``` */
  20231. clearStorage<T extends ClearStorageOption = ClearStorageOption>(
  20232. option?: T
  20233. ): PromisifySuccessResult<T, ClearStorageOption>
  20234. /** [wx.clearStorageSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html)
  20235. *
  20236. * 在插件中使用:不支持
  20237. *
  20238. * [wx.clearStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) 的同步版本
  20239. *
  20240. * **示例代码**
  20241. *
  20242. * ```js
  20243. wx.clearStorage()
  20244. ```
  20245. *
  20246. * ```js
  20247. try {
  20248. wx.clearStorageSync()
  20249. } catch(e) {
  20250. // Do something when catch error
  20251. }
  20252. ``` */
  20253. clearStorageSync(): void
  20254. /** [wx.closeBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.closeBLEConnection.html)
  20255. *
  20256. * 需要基础库: `1.1.0`
  20257. *
  20258. * 在插件中使用:需要基础库 `1.9.6`
  20259. *
  20260. * 断开与蓝牙低功耗设备的连接。
  20261. *
  20262. * **示例代码**
  20263. *
  20264. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20265. * ```js
  20266. wx.closeBLEConnection({
  20267. deviceId,
  20268. success (res) {
  20269. console.log(res)
  20270. }
  20271. })
  20272. ``` */
  20273. closeBLEConnection<
  20274. T extends CloseBLEConnectionOption = CloseBLEConnectionOption
  20275. >(
  20276. option: T
  20277. ): PromisifySuccessResult<T, CloseBLEConnectionOption>
  20278. /** [wx.closeBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html)
  20279. *
  20280. * 需要基础库: `1.1.0`
  20281. *
  20282. * 在插件中使用:需要基础库 `1.9.6`
  20283. *
  20284. * 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 成对调用。
  20285. *
  20286. * **示例代码**
  20287. *
  20288. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20289. * ```js
  20290. wx.closeBluetoothAdapter({
  20291. success (res) {
  20292. console.log(res)
  20293. }
  20294. })
  20295. ``` */
  20296. closeBluetoothAdapter<
  20297. T extends CloseBluetoothAdapterOption = CloseBluetoothAdapterOption
  20298. >(
  20299. option?: T
  20300. ): PromisifySuccessResult<T, CloseBluetoothAdapterOption>
  20301. /** [wx.closeSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html)
  20302. *
  20303. * 在插件中使用:不支持
  20304. *
  20305. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  20306. *
  20307. * 关闭 WebSocket 连接。
  20308. *
  20309. * **示例代码**
  20310. *
  20311. * ```js
  20312. wx.connectSocket({
  20313. url: 'test.php'
  20314. })
  20315. //注意这里有时序问题,
  20316. //如果 wx.connectSocket 还没回调 wx.onSocketOpen,而先调用 wx.closeSocket,那么就做不到关闭 WebSocket 的目的。
  20317. //必须在 WebSocket 打开期间调用 wx.closeSocket 才能关闭。
  20318. wx.onSocketOpen(function() {
  20319. wx.closeSocket()
  20320. })
  20321. wx.onSocketClose(function(res) {
  20322. console.log('WebSocket 已关闭!')
  20323. })
  20324. ``` */
  20325. closeSocket<T extends CloseSocketOption = CloseSocketOption>(
  20326. option?: T
  20327. ): PromisifySuccessResult<T, CloseSocketOption>
  20328. /** [wx.compressImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html)
  20329. *
  20330. * 需要基础库: `2.4.0`
  20331. *
  20332. * 在插件中使用:需要基础库 `2.12.0`
  20333. *
  20334. * 压缩图片接口,可选压缩质量
  20335. *
  20336. * **示例代码**
  20337. *
  20338. * ```js
  20339. wx.compressImage({
  20340. src: '', // 图片路径
  20341. quality: 80 // 压缩质量
  20342. })
  20343. ``` */
  20344. compressImage<T extends CompressImageOption = CompressImageOption>(
  20345. option: T
  20346. ): PromisifySuccessResult<T, CompressImageOption>
  20347. /** [wx.compressVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html)
  20348. *
  20349. * 需要基础库: `2.11.0`
  20350. *
  20351. * 在插件中使用:需要基础库 `2.11.1`
  20352. *
  20353. * 压缩视频接口。开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html) 获取。 */
  20354. compressVideo<T extends CompressVideoOption = CompressVideoOption>(
  20355. option: T
  20356. ): PromisifySuccessResult<T, CompressVideoOption>
  20357. /** [wx.connectWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html)
  20358. *
  20359. * 需要基础库: `1.6.0`
  20360. *
  20361. * 在插件中使用:需要基础库 `2.9.1`
  20362. *
  20363. * 连接 Wi-Fi。若已知 Wi-Fi 信息,可以直接利用该接口连接。仅 Android 与 iOS 11 以上版本支持。
  20364. *
  20365. * **示例代码**
  20366. *
  20367. * ```js
  20368. wx.connectWifi({
  20369. SSID: '',
  20370. password: '',
  20371. success (res) {
  20372. console.log(res.errMsg)
  20373. }
  20374. })
  20375. ```
  20376. *
  20377. * **注意**
  20378. *
  20379. * - Android 微信客户端 7.0.22 以上版本,connectWifi 的实现在 Android 10 及以上的手机无法生效,对于 Android 10 及以上版本,设备连接 wifi 之后,(受系统能力限制)其他进程无法使用当前连接的 wifi ;即连接上的 wifi 只对当前小程序有效,如果想要对整个系统生效,需要配置 maunal 来连接 wifi。
  20380. * - iOS 系统底层没有给开发者提供因 wifi 密码错误而连接失败的事件,但用户可以收到密码错误的系统弹窗。建议开发者通过 onWifiConnected 事件来判断 wifi 是否连接成功;即设置定时器,若超时后仍没有 onWifiConnected 事件,则认定此次 wifi 连接无效。
  20381. * - Android / iOS 在系统已经连上目标 wifi 的情况下,小程序再次连接目标 wifi,此时无论输入的密码是否正确,系统都会默认此次连接成功,且没有 onWifiConnected 事件。
  20382. * - onWifiConnected 事件可能会返回空对象,此时代表 wifi 断开连接,开发者可忽略这种情况。 */
  20383. connectWifi<T extends ConnectWifiOption = ConnectWifiOption>(
  20384. option: T
  20385. ): PromisifySuccessResult<T, ConnectWifiOption>
  20386. /** [wx.createBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html)
  20387. *
  20388. * 需要基础库: `1.1.0`
  20389. *
  20390. * 在插件中使用:需要基础库 `1.9.6`
  20391. *
  20392. * 连接蓝牙低功耗设备。
  20393. *
  20394. * 若小程序在之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的 deviceId 直接尝试连接该设备,无需再次进行搜索操作。
  20395. *
  20396. * **注意**
  20397. *
  20398. * - 请保证尽量成对的调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 和 [wx.closeBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.closeBLEConnection.html) 接口。安卓如果重复调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 创建连接,有可能导致系统持有同一设备多个连接的实例,导致调用 `closeBLEConnection` 的时候并不能真正的断开与设备的连接。
  20399. * - 蓝牙连接随时可能断开,建议监听 [wx.onBLEConnectionStateChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html) 回调事件,当蓝牙设备断开时按需执行重连操作
  20400. * - 若对未连接的设备或已断开连接的设备调用数据读写操作的接口,会返回 10006 错误,建议进行重连操作。
  20401. *
  20402. * **示例代码**
  20403. *
  20404. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20405. * ```js
  20406. wx.createBLEConnection({
  20407. deviceId,
  20408. success (res) {
  20409. console.log(res)
  20410. }
  20411. })
  20412. ``` */
  20413. createBLEConnection<
  20414. T extends CreateBLEConnectionOption = CreateBLEConnectionOption
  20415. >(
  20416. option: T
  20417. ): PromisifySuccessResult<T, CreateBLEConnectionOption>
  20418. /** [wx.createBLEPeripheralServer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html)
  20419. *
  20420. * 需要基础库: `2.10.3`
  20421. *
  20422. * 在插件中使用:需要基础库 `2.22.1`
  20423. *
  20424. * 建立本地作为蓝牙低功耗外围设备的服务端,可创建多个。 */
  20425. createBLEPeripheralServer<
  20426. T extends CreateBLEPeripheralServerOption = CreateBLEPeripheralServerOption
  20427. >(
  20428. option?: T
  20429. ): PromisifySuccessResult<T, CreateBLEPeripheralServerOption>
  20430. /** [wx.cropImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.cropImage.html)
  20431. *
  20432. * 需要基础库: `2.26.0`
  20433. *
  20434. * 在插件中使用:不支持
  20435. *
  20436. * 裁剪图片接口
  20437. *
  20438. * **示例代码**
  20439. *
  20440. * ```js
  20441. wx.cropImage({
  20442. src: '', // 图片路径
  20443. cropScale: '16:9', // 裁剪比例
  20444. })
  20445. ``` */
  20446. cropImage(option: CropImageOption): void
  20447. /** [wx.disableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.disableAlertBeforeUnload.html)
  20448. *
  20449. * 需要基础库: `2.12.0`
  20450. *
  20451. * 在插件中使用:不支持
  20452. *
  20453. * 关闭小程序页面返回询问对话框。 */
  20454. disableAlertBeforeUnload(option?: DisableAlertBeforeUnloadOption): void
  20455. /** [wx.editImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.editImage.html)
  20456. *
  20457. * 需要基础库: `2.22.0`
  20458. *
  20459. * 在插件中使用:不支持
  20460. *
  20461. * 编辑图片接口
  20462. *
  20463. * **示例代码**
  20464. *
  20465. * ```js
  20466. wx.editImage({
  20467. src: '', // 图片路径
  20468. })
  20469. ``` */
  20470. editImage(option: EditImageOption): void
  20471. /** [wx.enableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html)
  20472. *
  20473. * 需要基础库: `2.12.0`
  20474. *
  20475. * 在插件中使用:不支持
  20476. *
  20477. * 开启小程序页面返回询问对话框。
  20478. *
  20479. * ## 弹窗条件
  20480. * * 当用户在小程序内非首页页面/最底层页
  20481. * * 官方导航栏上的的返回
  20482. * * 全屏模式下自绘返回键
  20483. * * android 系统 back 键时
  20484. *
  20485. * ## 注意事项
  20486. * * 手势滑动返回时不做拦截
  20487. * * 在任何场景下,此功能都不应拦住用户退出小程序的行为
  20488. *
  20489. * **示例代码**
  20490. *
  20491. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/MTPm9Cmh7VfT) */
  20492. enableAlertBeforeUnload(option: EnableAlertBeforeUnloadOption): void
  20493. /** [wx.exitMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html)
  20494. *
  20495. * 需要基础库: `2.17.3`
  20496. *
  20497. * 在插件中使用:不支持
  20498. *
  20499. * 退出当前小程序。必须有点击行为才能调用成功。 */
  20500. exitMiniProgram<
  20501. T extends ExitMiniProgramOption = ExitMiniProgramOption
  20502. >(
  20503. option?: T
  20504. ): PromisifySuccessResult<T, ExitMiniProgramOption>
  20505. /** [wx.exitVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html)
  20506. *
  20507. * 需要基础库: `2.7.0`
  20508. *
  20509. * 在插件中使用:需要基础库 `2.9.0`
  20510. *
  20511. * 退出(销毁)实时语音通话 */
  20512. exitVoIPChat<T extends ExitVoIPChatOption = ExitVoIPChatOption>(
  20513. option?: T
  20514. ): PromisifySuccessResult<T, ExitVoIPChatOption>
  20515. /** [wx.faceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.faceDetect.html)
  20516. *
  20517. * 需要基础库: `2.18.0`
  20518. *
  20519. * 在插件中使用:需要基础库 `2.21.3`
  20520. *
  20521. * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
  20522. *
  20523. * 人脸检测,使用前需要通过 wx.initFaceDetect 进行一次初始化,推荐使用相机接口返回的帧数据。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)
  20524. *
  20525. * ****
  20526. *
  20527. * ### 特别说明
  20528. * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
  20529. faceDetect(option: FaceDetectOption): void
  20530. /** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html)
  20531. *
  20532. * 需要基础库: `2.1.0`
  20533. *
  20534. * 在插件中使用:需要基础库 `2.15.0`
  20535. *
  20536. * 获取当前支持的音频输入源 */
  20537. getAvailableAudioSources<
  20538. T extends GetAvailableAudioSourcesOption = GetAvailableAudioSourcesOption
  20539. >(
  20540. option?: T
  20541. ): PromisifySuccessResult<T, GetAvailableAudioSourcesOption>
  20542. /** [wx.getBLEDeviceCharacteristics(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceCharacteristics.html)
  20543. *
  20544. * 需要基础库: `1.1.0`
  20545. *
  20546. * 在插件中使用:需要基础库 `1.9.6`
  20547. *
  20548. * 获取蓝牙低功耗设备某个服务中所有特征 (characteristic)。
  20549. *
  20550. * **示例代码**
  20551. *
  20552. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20553. * ```js
  20554. wx.getBLEDeviceCharacteristics({
  20555. // 这里的 deviceId 需要已经通过 wx.createBLEConnection 与对应设备建立链接
  20556. deviceId,
  20557. // 这里的 serviceId 需要在 wx.getBLEDeviceServices 接口中获取
  20558. serviceId,
  20559. success (res) {
  20560. console.log('device getBLEDeviceCharacteristics:', res.characteristics)
  20561. }
  20562. })
  20563. ``` */
  20564. getBLEDeviceCharacteristics<
  20565. T extends GetBLEDeviceCharacteristicsOption = GetBLEDeviceCharacteristicsOption
  20566. >(
  20567. option: T
  20568. ): PromisifySuccessResult<T, GetBLEDeviceCharacteristicsOption>
  20569. /** [wx.getBLEDeviceRSSI(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceRSSI.html)
  20570. *
  20571. * 需要基础库: `2.11.0`
  20572. *
  20573. * 在插件中使用:需要基础库 `2.11.0`
  20574. *
  20575. * 获取蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI)。 */
  20576. getBLEDeviceRSSI<
  20577. T extends GetBLEDeviceRSSIOption = GetBLEDeviceRSSIOption
  20578. >(
  20579. option: T
  20580. ): PromisifySuccessResult<T, GetBLEDeviceRSSIOption>
  20581. /** [wx.getBLEDeviceServices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html)
  20582. *
  20583. * 需要基础库: `1.1.0`
  20584. *
  20585. * 在插件中使用:需要基础库 `1.9.6`
  20586. *
  20587. * 获取蓝牙低功耗设备所有服务 (service)。
  20588. *
  20589. * **示例代码**
  20590. *
  20591. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20592. * ```js
  20593. wx.getBLEDeviceServices({
  20594. // 这里的 deviceId 需要已经通过 wx.createBLEConnection 与对应设备建立连接
  20595. deviceId,
  20596. success (res) {
  20597. console.log('device services:', res.services)
  20598. }
  20599. })
  20600. ``` */
  20601. getBLEDeviceServices<
  20602. T extends GetBLEDeviceServicesOption = GetBLEDeviceServicesOption
  20603. >(
  20604. option: T
  20605. ): PromisifySuccessResult<T, GetBLEDeviceServicesOption>
  20606. /** [wx.getBLEMTU(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEMTU.html)
  20607. *
  20608. * 需要基础库: `2.20.1`
  20609. *
  20610. * 在插件中使用:需要基础库 `2.20.1`
  20611. *
  20612. * 获取蓝牙低功耗的最大传输单元。需在 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 调用成功后调用。
  20613. *
  20614. * **注意**
  20615. *
  20616. * - 小程序中 MTU 为 ATT_MTU,包含 Op-Code 和 Attribute Handle 的长度,实际可以传输的数据长度为 `ATT_MTU - 3`
  20617. * - iOS 系统中 MTU 为固定值;安卓系统中,MTU 会在系统协商成功之后发生改变,建议使用 [wx.onBLEMTUChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEMTUChange.html) 监听。
  20618. *
  20619. * **示例代码**
  20620. *
  20621. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20622. * ```js
  20623. wx.getBLEMTU({
  20624. deviceId: '',
  20625. writeType: 'write',
  20626. success (res) {
  20627. console.log(res)
  20628. }
  20629. })
  20630. ``` */
  20631. getBLEMTU<T extends GetBLEMTUOption = GetBLEMTUOption>(
  20632. option: T
  20633. ): PromisifySuccessResult<T, GetBLEMTUOption>
  20634. /** [wx.getBackgroundAudioPlayerState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioPlayerState.html)
  20635. *
  20636. * 在插件中使用:需要基础库 `1.9.6`
  20637. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  20638. *
  20639. * 获取后台音乐播放状态。
  20640. *
  20641. * **示例代码**
  20642. *
  20643. * ```js
  20644. wx.getBackgroundAudioPlayerState({
  20645. success (res) {
  20646. const status = res.status
  20647. const dataUrl = res.dataUrl
  20648. const currentPosition = res.currentPosition
  20649. const duration = res.duration
  20650. const downloadPercent = res.downloadPercent
  20651. }
  20652. })
  20653. ``` */
  20654. getBackgroundAudioPlayerState<
  20655. T extends GetBackgroundAudioPlayerStateOption = GetBackgroundAudioPlayerStateOption
  20656. >(
  20657. option?: T
  20658. ): PromisifySuccessResult<T, GetBackgroundAudioPlayerStateOption>
  20659. /** [wx.getBackgroundFetchData(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html)
  20660. *
  20661. * 需要基础库: `2.8.0`
  20662. *
  20663. * 在插件中使用:不支持
  20664. *
  20665. * 拉取 backgroundFetch 客户端缓存数据。
  20666. * 当调用接口时,若当次请求未结束,会先返回本地的旧数据(之前打开小程序时请求的),如果本地没有旧数据会返回失败,而不会等待请求完成。 */
  20667. getBackgroundFetchData<
  20668. T extends GetBackgroundFetchDataOption = GetBackgroundFetchDataOption
  20669. >(
  20670. option: T
  20671. ): PromisifySuccessResult<T, GetBackgroundFetchDataOption>
  20672. /** [wx.getBackgroundFetchToken(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html)
  20673. *
  20674. * 需要基础库: `2.8.0`
  20675. *
  20676. * 在插件中使用:不支持
  20677. *
  20678. * 获取设置过的自定义登录态。若无,则返回 fail。 */
  20679. getBackgroundFetchToken<
  20680. T extends GetBackgroundFetchTokenOption = GetBackgroundFetchTokenOption
  20681. >(
  20682. option?: T
  20683. ): PromisifySuccessResult<T, GetBackgroundFetchTokenOption>
  20684. /** [wx.getBatteryInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html)
  20685. *
  20686. * 在插件中使用:需要基础库 `2.15.0`
  20687. *
  20688. * 获取设备电量。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 */
  20689. getBatteryInfo<T extends GetBatteryInfoOption = GetBatteryInfoOption>(
  20690. option?: T
  20691. ): PromisifySuccessResult<T, GetBatteryInfoOption>
  20692. /** [wx.getBeacons(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html)
  20693. *
  20694. * 需要基础库: `1.2.0`
  20695. *
  20696. * 在插件中使用:需要基础库 `1.9.6`
  20697. *
  20698. * 获取所有已搜索到的 Beacon 设备 */
  20699. getBeacons<T extends GetBeaconsOption = GetBeaconsOption>(
  20700. option?: T
  20701. ): PromisifySuccessResult<T, GetBeaconsOption>
  20702. /** [wx.getBluetoothAdapterState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothAdapterState.html)
  20703. *
  20704. * 需要基础库: `1.1.0`
  20705. *
  20706. * 在插件中使用:需要基础库 `1.9.6`
  20707. *
  20708. * 获取本机蓝牙适配器状态。
  20709. *
  20710. * **示例代码**
  20711. *
  20712. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20713. * ```js
  20714. wx.getBluetoothAdapterState({
  20715. success (res) {
  20716. console.log(res)
  20717. }
  20718. })
  20719. ``` */
  20720. getBluetoothAdapterState<
  20721. T extends GetBluetoothAdapterStateOption = GetBluetoothAdapterStateOption
  20722. >(
  20723. option?: T
  20724. ): PromisifySuccessResult<T, GetBluetoothAdapterStateOption>
  20725. /** [wx.getBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html)
  20726. *
  20727. * 需要基础库: `1.1.0`
  20728. *
  20729. * 在插件中使用:需要基础库 `1.9.6`
  20730. *
  20731. * 获取在蓝牙模块生效期间所有搜索到的蓝牙设备。包括已经和本机处于连接状态的设备。
  20732. *
  20733. * **示例代码**
  20734. *
  20735. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20736. *
  20737. * ```js
  20738. // ArrayBuffer转16进度字符串示例
  20739. function ab2hex(buffer) {
  20740. var hexArr = Array.prototype.map.call(
  20741. new Uint8Array(buffer),
  20742. function(bit) {
  20743. return ('00' + bit.toString(16)).slice(-2)
  20744. }
  20745. )
  20746. return hexArr.join('');
  20747. }
  20748. wx.getBluetoothDevices({
  20749. success: function (res) {
  20750. console.log(res)
  20751. if (res.devices[0]) {
  20752. console.log(ab2hex(res.devices[0].advertisData))
  20753. }
  20754. }
  20755. })
  20756. ```
  20757. *
  20758. * **注意**
  20759. *
  20760. * - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 [wx.closeBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html) 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。 */
  20761. getBluetoothDevices<
  20762. T extends GetBluetoothDevicesOption = GetBluetoothDevicesOption
  20763. >(
  20764. option?: T
  20765. ): PromisifySuccessResult<T, GetBluetoothDevicesOption>
  20766. /** [wx.getChannelsLiveInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveInfo.html)
  20767. *
  20768. * 需要基础库: `2.15.0`
  20769. *
  20770. * 在插件中使用:不支持
  20771. *
  20772. * 获取视频号直播信息 */
  20773. getChannelsLiveInfo(option: GetChannelsLiveInfoOption): void
  20774. /** [wx.getChannelsLiveNoticeInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveNoticeInfo.html)
  20775. *
  20776. * 需要基础库: `2.19.0`
  20777. *
  20778. * 在插件中使用:不支持
  20779. *
  20780. * 获取视频号直播预告信息 */
  20781. getChannelsLiveNoticeInfo(option: GetChannelsLiveNoticeInfoOption): void
  20782. /** [wx.getChannelsShareKey(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsShareKey.html)
  20783. *
  20784. * 需要基础库: `2.22.1`
  20785. *
  20786. * 在插件中使用:不支持
  20787. *
  20788. * 获取视频号直播卡片/视频卡片的分享来源,仅当卡片携带了分享信息、同时用户已授权该小程序获取视频号分享信息且启动场景值为 1177、1184、1195、1208 时可用。 */
  20789. getChannelsShareKey(option?: GetChannelsShareKeyOption): void
  20790. /** [wx.getClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html)
  20791. *
  20792. * 需要基础库: `1.1.0`
  20793. *
  20794. * 在插件中使用:需要基础库 `1.9.6`
  20795. *
  20796. * 获取系统剪贴板的内容
  20797. *
  20798. * **示例代码**
  20799. *
  20800. * ```js
  20801. wx.getClipboardData({
  20802. success (res){
  20803. console.log(res.data)
  20804. }
  20805. })
  20806. ``` */
  20807. getClipboardData<
  20808. T extends GetClipboardDataOption = GetClipboardDataOption
  20809. >(
  20810. option?: T
  20811. ): PromisifySuccessResult<T, GetClipboardDataOption>
  20812. /** [wx.getConnectedBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html)
  20813. *
  20814. * 需要基础库: `1.1.0`
  20815. *
  20816. * 在插件中使用:需要基础库 `1.9.6`
  20817. *
  20818. * 根据主服务 UUID 获取已连接的蓝牙设备。
  20819. *
  20820. * **示例代码**
  20821. *
  20822. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  20823. * ```js
  20824. wx.getConnectedBluetoothDevices({
  20825. services: ['FEE7'],
  20826. success (res) {
  20827. console.log(res)
  20828. }
  20829. })
  20830. ``` */
  20831. getConnectedBluetoothDevices<
  20832. T extends GetConnectedBluetoothDevicesOption = GetConnectedBluetoothDevicesOption
  20833. >(
  20834. option: T
  20835. ): PromisifySuccessResult<T, GetConnectedBluetoothDevicesOption>
  20836. /** [wx.getConnectedWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html)
  20837. *
  20838. * 需要基础库: `1.6.0`
  20839. *
  20840. * 在插件中使用:需要基础库 `2.9.1`
  20841. *
  20842. * 获取已连接中的 Wi-Fi 信息。 */
  20843. getConnectedWifi<
  20844. T extends GetConnectedWifiOption = GetConnectedWifiOption
  20845. >(
  20846. option: T
  20847. ): PromisifySuccessResult<T, GetConnectedWifiOption>
  20848. /** [wx.getExtConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html)
  20849. *
  20850. * 需要基础库: `1.1.0`
  20851. *
  20852. * 在插件中使用:不支持
  20853. *
  20854. * 获取[第三方平台](https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html)自定义的数据字段。
  20855. *
  20856. * **Tips**
  20857. *
  20858. * 1. 本接口暂时无法通过 [wx.canIUse](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html) 判断是否兼容,开发者需要自行判断 [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 是否存在来兼容
  20859. *
  20860. * ****
  20861. *
  20862. * ```js
  20863. if (wx.getExtConfig) {
  20864. wx.getExtConfig({
  20865. success (res) {
  20866. console.log(res.extConfig)
  20867. }
  20868. })
  20869. }
  20870. ``` */
  20871. getExtConfig<T extends GetExtConfigOption = GetExtConfigOption>(
  20872. option?: T
  20873. ): PromisifySuccessResult<T, GetExtConfigOption>
  20874. /** [wx.getFuzzyLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html)
  20875. *
  20876. * 需要基础库: `2.25.0`
  20877. *
  20878. * 在插件中使用:支持
  20879. *
  20880. * 获取当前的模糊地理位置。
  20881. * ## 使用方法
  20882. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  20883. * ## 申请开通
  20884. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。 从2022年7月14日开始在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  20885. *
  20886. * **示例代码**
  20887. *
  20888. * ```js
  20889. wx.getFuzzyLocation({
  20890. type: 'wgs84',
  20891. success (res) {
  20892. const latitude = res.latitude
  20893. const longitude = res.longitude
  20894. }
  20895. })
  20896. ``` */
  20897. getFuzzyLocation(option: GetFuzzyLocationOption): void
  20898. /** [wx.getGroupEnterInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html)
  20899. *
  20900. * 需要基础库: `2.10.4`
  20901. *
  20902. * 在插件中使用:不支持
  20903. *
  20904. * 获取微信群聊场景下的小程序启动信息。群聊场景包括群聊小程序消息卡片、群待办、群工具。可用于获取当前群的 opengid。
  20905. * ## 注意事项
  20906. * - 基础库 v2.10.4 开始支持获取群工具小程序启动信息
  20907. * - 基础库 v2.17.3 开始支持获取群聊小程序消息卡片、群待办小程序启动信息
  20908. *
  20909. * **示例代码**
  20910. *
  20911. * ```js
  20912. wx.getGroupEnterInfo({
  20913. success(res) {
  20914. // res
  20915. {
  20916. errMsg: 'getGroupEnterInfo:ok',
  20917. encryptedData: '',
  20918. iv: ''
  20919. }
  20920. },
  20921. fail() {
  20922. }
  20923. })
  20924. ```
  20925. *
  20926. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
  20927. * 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识):
  20928. *
  20929. * ```json
  20930. {
  20931. "opengid": "OPENGID"
  20932. }
  20933. ```
  20934. *
  20935. * **Tips**
  20936. *
  20937. * - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
  20938. * - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称 */
  20939. getGroupEnterInfo(option: GetGroupEnterInfoOption): void
  20940. /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.getHCEState.html)
  20941. *
  20942. * 需要基础库: `1.7.0`
  20943. *
  20944. * 在插件中使用:需要基础库 `2.1.0`
  20945. *
  20946. * 判断当前设备是否支持 HCE 能力。
  20947. *
  20948. * **示例代码**
  20949. *
  20950. * ```js
  20951. wx.getHCEState({
  20952. success (res) {
  20953. console.log(res.errCode)
  20954. }
  20955. })
  20956. ``` */
  20957. getHCEState<T extends GetHCEStateOption = GetHCEStateOption>(
  20958. option?: T
  20959. ): PromisifySuccessResult<T, GetHCEStateOption>
  20960. /** [wx.getImageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html)
  20961. *
  20962. * 在插件中使用:需要基础库 `1.9.6`
  20963. *
  20964. * 获取图片信息。网络图片需先配置download域名才能生效。
  20965. *
  20966. * **示例代码**
  20967. *
  20968. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/Kd47Sbmr6yYu)
  20969. *
  20970. * ```js
  20971. wx.getImageInfo({
  20972. src: 'images/a.jpg',
  20973. success (res) {
  20974. console.log(res.width)
  20975. console.log(res.height)
  20976. }
  20977. })
  20978. wx.chooseImage({
  20979. success (res) {
  20980. wx.getImageInfo({
  20981. src: res.tempFilePaths[0],
  20982. success (res) {
  20983. console.log(res.width)
  20984. console.log(res.height)
  20985. }
  20986. })
  20987. }
  20988. })
  20989. ``` */
  20990. getImageInfo<T extends GetImageInfoOption = GetImageInfoOption>(
  20991. option: T
  20992. ): PromisifySuccessResult<T, GetImageInfoOption>
  20993. /** [wx.getLocalIPAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getLocalIPAddress.html)
  20994. *
  20995. * 需要基础库: `2.20.1`
  20996. *
  20997. * 在插件中使用:需要基础库 `2.21.3`
  20998. *
  20999. * 获取局域网IP地址
  21000. *
  21001. * **示例代码**
  21002. *
  21003. * ```js
  21004. wx.getLocalIPAddress({
  21005. success (res) {
  21006. const localip = res.localip
  21007. }
  21008. })
  21009. ``` */
  21010. getLocalIPAddress(option: GetLocalIPAddressOption): void
  21011. /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html)
  21012. *
  21013. * 在插件中使用:需要基础库 `1.9.6`
  21014. *
  21015. * 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。
  21016. * 高频率调用会导致耗电,如有需要可使用持续定位接口 `wx.onLocationChange`。
  21017. * 基础库 `2.17.0` 版本起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801)。
  21018. *
  21019. * ## 使用方法
  21020. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  21021. *
  21022. * ## 申请开通
  21023. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  21024. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  21025. *
  21026. * ### 国内主体开放类目
  21027. *
  21028. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  21029. * | -------------- | -------| -------- |
  21030. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  21031. * | 商家自营 | / | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  21032. * | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
  21033. * | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
  21034. * | 生活服务 | / | 上门服务作业等线下场景 |
  21035. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
  21036. * | 餐饮服务 | 点餐平台、外卖平台、餐饮服务场所/餐饮服务管理企业 | 线下送餐服务 |
  21037. * | 工具 | 天气、信息查询、办公、设备管理 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询、智能穿戴、智能门禁、与地理位置相关的打卡服务等 |
  21038. * | 金融 | 银行、非金融机构自营小额贷款/融资担保/商业保理、保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
  21039. * | 旅游 | 景区服务、住宿服务 | 提供景区导航、导览服务、酒店导航服务 |
  21040. * | 汽车服务 | 维修保养、汽车用品、汽车经销商/4S店、汽车厂商、汽车预售、二手车 | 提供汽车售卖、维保洗美服务、查找附近的维修点/洗车网点等导航服务 |
  21041. * | IT科技 | 基础电信运营商、电信业务代理商 | 提供运营商线下网点的预约、基于地理位置取号并现场报到、网点导航等服务 |
  21042. * | 房地产服务 | 物业管理、房屋中介、房屋装修 | 提供房地产开发商及物业公司门店导览导航服务 |
  21043. * | 政务民生 | / | 提供政务单位相关业务 |
  21044. * | 政府主体帐号 | / | 提供政务单位相关业务 |
  21045. *
  21046. * ### 海外主体开放类目
  21047. *
  21048. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  21049. * | -------------- | -------| -------- |
  21050. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  21051. * | 快递业与邮政 | / | 快递/货物收发服务 |
  21052. * | 餐饮 | / | 线下送餐服务 |
  21053. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  21054. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  21055. * | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
  21056. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货、超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  21057. * | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
  21058. *
  21059. * **示例代码**
  21060. *
  21061. * ```js
  21062. wx.getLocation({
  21063. type: 'wgs84',
  21064. success (res) {
  21065. const latitude = res.latitude
  21066. const longitude = res.longitude
  21067. const speed = res.speed
  21068. const accuracy = res.accuracy
  21069. }
  21070. })
  21071. ```
  21072. *
  21073. * **注意**
  21074. *
  21075. * - `2.17.0 起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801)
  21076. * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
  21077. * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。 */
  21078. getLocation<T extends GetLocationOption = GetLocationOption>(
  21079. option: T
  21080. ): PromisifySuccessResult<T, GetLocationOption>
  21081. /** [wx.getNetworkType(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html)
  21082. *
  21083. * 在插件中使用:需要基础库 `1.9.6`
  21084. *
  21085. * 获取网络类型
  21086. *
  21087. * **示例代码**
  21088. *
  21089. * ```js
  21090. wx.getNetworkType({
  21091. success (res) {
  21092. const networkType = res.networkType
  21093. }
  21094. })
  21095. ``` */
  21096. getNetworkType<T extends GetNetworkTypeOption = GetNetworkTypeOption>(
  21097. option?: T
  21098. ): PromisifySuccessResult<T, GetNetworkTypeOption>
  21099. /** [wx.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/crypto/wx.getRandomValues.html)
  21100. *
  21101. * 需要基础库: `2.15.0`
  21102. *
  21103. * 在插件中使用:不支持
  21104. *
  21105. * 获取密码学安全随机数
  21106. *
  21107. * **示例代码**
  21108. *
  21109. * ```js
  21110. wx.getRandomValues({
  21111. length: 6 // 生成 6 个字节长度的随机数,
  21112. success: res => {
  21113. console.log(wx.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
  21114. }
  21115. })
  21116. ``` */
  21117. getRandomValues<
  21118. T extends GetRandomValuesOption = GetRandomValuesOption
  21119. >(
  21120. option: T
  21121. ): PromisifySuccessResult<T, GetRandomValuesOption>
  21122. /** [wx.getScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html)
  21123. *
  21124. * 需要基础库: `1.2.0`
  21125. *
  21126. * 在插件中使用:需要基础库 `1.9.6`
  21127. *
  21128. * 获取屏幕亮度
  21129. *
  21130. * **说明**
  21131. *
  21132. * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。 */
  21133. getScreenBrightness<
  21134. T extends GetScreenBrightnessOption = GetScreenBrightnessOption
  21135. >(
  21136. option?: T
  21137. ): PromisifySuccessResult<T, GetScreenBrightnessOption>
  21138. /** [wx.getScreenRecordingState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html)
  21139. *
  21140. * 需要基础库: `2.24.0`
  21141. *
  21142. * 在插件中使用:不支持
  21143. *
  21144. * 查询用户是否在录屏。
  21145. *
  21146. * **示例代码**
  21147. *
  21148. * ```js
  21149. * wx.getScreenRecordingState({
  21150. * success: function (res) {
  21151. * console.log(res.state)
  21152. * },
  21153. * }) */
  21154. getScreenRecordingState(option?: GetScreenRecordingStateOption): void
  21155. /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.getSelectedTextRange.html)
  21156. *
  21157. * 需要基础库: `2.7.0`
  21158. *
  21159. * 在插件中使用:不支持
  21160. *
  21161. * 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。
  21162. *
  21163. * **示例代码**
  21164. *
  21165. * ```js
  21166. wx.getSelectedTextRange({
  21167. complete: res => {
  21168. console.log('getSelectedTextRange res', res.start, res.end)
  21169. }
  21170. })
  21171. ``` */
  21172. getSelectedTextRange<
  21173. T extends GetSelectedTextRangeOption = GetSelectedTextRangeOption
  21174. >(
  21175. option?: T
  21176. ): PromisifySuccessResult<T, GetSelectedTextRangeOption>
  21177. /** [wx.getSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html)
  21178. *
  21179. * 需要基础库: `1.2.0`
  21180. *
  21181. * 在插件中使用:需要基础库 `2.6.3`
  21182. *
  21183. * 在插件中使用时,接口有以下不同:
  21184. * - `withSubscriptions` 无效(插件暂无订阅消息)
  21185. * - 返回值中的 `authSetting` 字段中是插件的权限(如用户信息功能页授权)
  21186. * - [2.14.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起返回值中有 `miniprogramAuthSetting` 字段,内容等于当前小程序 `getSetting` 的结果(不含订阅状态)
  21187. *
  21188. * 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
  21189. *
  21190. * **示例代码**
  21191. *
  21192. * ```js
  21193. wx.getSetting({
  21194. success (res) {
  21195. console.log(res.authSetting)
  21196. // res.authSetting = {
  21197. // "scope.userInfo": true,
  21198. // "scope.userLocation": true
  21199. // }
  21200. }
  21201. })
  21202. ```
  21203. *
  21204. * ```js
  21205. wx.getSetting({
  21206. withSubscriptions: true,
  21207. success (res) {
  21208. console.log(res.authSetting)
  21209. // res.authSetting = {
  21210. // "scope.userInfo": true,
  21211. // "scope.userLocation": true
  21212. // }
  21213. console.log(res.subscriptionsSetting)
  21214. // res.subscriptionsSetting = {
  21215. // mainSwitch: true, // 订阅消息总开关
  21216. // itemSettings: { // 每一项开关
  21217. // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
  21218. // SYS_MSG_TYPE_RANK: 'accept'
  21219. // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
  21220. // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
  21221. // }
  21222. // }
  21223. }
  21224. })
  21225. ``` */
  21226. getSetting<T extends GetSettingOption = GetSettingOption>(
  21227. option?: T
  21228. ): PromisifySuccessResult<T, GetSettingOption>
  21229. /** [wx.getShareInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html)
  21230. *
  21231. * 需要基础库: `1.1.0`
  21232. *
  21233. * 在插件中使用:需要基础库 `2.1.0`
  21234. *
  21235. * 在插件中使用时,只能在当前插件的页面中调用
  21236. *
  21237. * 获取转发详细信息
  21238. *
  21239. * **示例代码**
  21240. *
  21241. * 敏感数据获取方式 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
  21242. * 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识):
  21243. *
  21244. * ```json
  21245. {
  21246. "openGId": "OPENGID"
  21247. }
  21248. ```
  21249. *
  21250. * **Tips**
  21251. *
  21252. * - 如需要展示群名称,小程序可以使用 [开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
  21253. * - 小游戏可以通过 [`wx.getGroupInfo`](#) 接口获取群名称 */
  21254. getShareInfo<T extends GetShareInfoOption = GetShareInfoOption>(
  21255. option: T
  21256. ): PromisifySuccessResult<T, GetShareInfoOption>
  21257. /** [wx.getSkylineInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfo.html)
  21258. *
  21259. * 需要基础库: `2.26.2`
  21260. *
  21261. * 在插件中使用:需要基础库 `2.26.2`
  21262. *
  21263. * 获取当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  21264. getSkylineInfo(option?: GetSkylineInfoOption): void
  21265. /** [wx.getStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html)
  21266. *
  21267. * 在插件中使用:需要基础库 `1.9.6`
  21268. *
  21269. * 从本地缓存中异步获取指定 key 的内容。
  21270. *
  21271. * **示例代码**
  21272. *
  21273. * ```js
  21274. wx.getStorage({
  21275. key: 'key',
  21276. success (res) {
  21277. console.log(res.data)
  21278. }
  21279. })
  21280. ```
  21281. *
  21282. * ```js
  21283. // 开启加密存储
  21284. wx.setStorage({
  21285. key: "key",
  21286. data: "value",
  21287. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  21288. success() {
  21289. wx.getStorage({
  21290. key: "key",
  21291. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  21292. success(res) {
  21293. console.log(res.data)
  21294. }
  21295. })
  21296. }
  21297. })
  21298. ``` */
  21299. getStorage<
  21300. T = any,
  21301. U extends GetStorageOption<T> = GetStorageOption<T>
  21302. >(
  21303. option: U
  21304. ): PromisifySuccessResult<U, GetStorageOption<T>>
  21305. /** [wx.getStorageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html)
  21306. *
  21307. * 在插件中使用:不支持
  21308. *
  21309. * 异步获取当前storage的相关信息。
  21310. *
  21311. * **示例代码**
  21312. *
  21313. * ```js
  21314. wx.getStorageInfo({
  21315. success (res) {
  21316. console.log(res.keys)
  21317. console.log(res.currentSize)
  21318. console.log(res.limitSize)
  21319. }
  21320. })
  21321. ```
  21322. *
  21323. * ```js
  21324. try {
  21325. const res = wx.getStorageInfoSync()
  21326. console.log(res.keys)
  21327. console.log(res.currentSize)
  21328. console.log(res.limitSize)
  21329. } catch (e) {
  21330. // Do something when catch error
  21331. }
  21332. ``` */
  21333. getStorageInfo<T extends GetStorageInfoOption = GetStorageInfoOption>(
  21334. option?: T
  21335. ): PromisifySuccessResult<T, GetStorageInfoOption>
  21336. /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html)
  21337. *
  21338. * 在插件中使用:需要基础库 `1.9.6`
  21339. *
  21340. * 获取系统信息。**由于历史原因,wx.getSystemInfo 是异步的调用格式,但是是同步返回,需要异步获取系统信息请使用 [wx.getSystemInfoAsync](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html)。**
  21341. *
  21342. * **示例代码**
  21343. *
  21344. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
  21345. *
  21346. * ```js
  21347. wx.getSystemInfo({
  21348. success (res) {
  21349. console.log(res.model)
  21350. console.log(res.pixelRatio)
  21351. console.log(res.windowWidth)
  21352. console.log(res.windowHeight)
  21353. console.log(res.language)
  21354. console.log(res.version)
  21355. console.log(res.platform)
  21356. }
  21357. })
  21358. ```
  21359. *
  21360. * ```js
  21361. try {
  21362. const res = wx.getSystemInfoSync()
  21363. console.log(res.model)
  21364. console.log(res.pixelRatio)
  21365. console.log(res.windowWidth)
  21366. console.log(res.windowHeight)
  21367. console.log(res.language)
  21368. console.log(res.version)
  21369. console.log(res.platform)
  21370. } catch (e) {
  21371. // Do something when catch error
  21372. }
  21373. ``` */
  21374. getSystemInfo<T extends GetSystemInfoOption = GetSystemInfoOption>(
  21375. option?: T
  21376. ): PromisifySuccessResult<T, GetSystemInfoOption>
  21377. /** [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html)
  21378. *
  21379. * 需要基础库: `2.14.1`
  21380. *
  21381. * 在插件中使用:不支持
  21382. *
  21383. * 异步获取系统信息。需要一定的微信客户端版本支持,在不支持的客户端上,会使用同步实现来返回。
  21384. *
  21385. * **示例代码**
  21386. *
  21387. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
  21388. *
  21389. * ```js
  21390. wx.getSystemInfoAsync({
  21391. success (res) {
  21392. console.log(res.model)
  21393. console.log(res.pixelRatio)
  21394. console.log(res.windowWidth)
  21395. console.log(res.windowHeight)
  21396. console.log(res.language)
  21397. console.log(res.version)
  21398. console.log(res.platform)
  21399. }
  21400. })
  21401. ``` */
  21402. getSystemInfoAsync(option?: GetSystemInfoAsyncOption): void
  21403. /** [wx.getUserInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html)
  21404. *
  21405. * 在插件中使用:需要基础库 `2.3.1`
  21406. *
  21407. * 在插件中使用时,需要在用户信息功能页中获得用户授权或满足一定条件后调用。否则将返回 fail。详见 [用户信息功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/user-info.html)
  21408. *
  21409. * @warning **用户头像昵称获取规则已调整,参考 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)、[小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
  21410. *
  21411. * 获取用户信息。
  21412. *
  21413. * **示例代码**
  21414. *
  21415. * ```js
  21416. // 必须是在用户已经授权的情况下调用
  21417. wx.getUserInfo({
  21418. success: function(res) {
  21419. var userInfo = res.userInfo
  21420. var nickName = userInfo.nickName
  21421. var avatarUrl = userInfo.avatarUrl
  21422. var gender = userInfo.gender //性别 0:未知、1:男、2:女
  21423. var province = userInfo.province
  21424. var city = userInfo.city
  21425. var country = userInfo.country
  21426. }
  21427. })
  21428. ```
  21429. *
  21430. * 敏感数据有两种获取方式:
  21431. * 1. 使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法)
  21432. * 2. 使用 [云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#云调用直接获取开放数据)
  21433. * 获取得到的开放数据为以下 json 结构:
  21434. *
  21435. * ```json
  21436. {
  21437. "openId": "OPENID",
  21438. "nickName": "NICKNAME",
  21439. "gender": GENDER,
  21440. "city": "CITY",
  21441. "province": "PROVINCE",
  21442. "country": "COUNTRY",
  21443. "avatarUrl": "AVATARURL",
  21444. "unionId": "UNIONID",
  21445. "watermark": {
  21446. "appid":"APPID",
  21447. "timestamp":TIMESTAMP
  21448. }
  21449. }
  21450. ```
  21451. *
  21452. * **小程序用户信息组件示例代码**
  21453. *
  21454. * ```html
  21455. * <!-- 如果只是展示用户头像昵称,可以使用 <open-data /> 组件 -->
  21456. * <open-data type="userAvatarUrl"></open-data>
  21457. * <open-data type="userNickName"></open-data>
  21458. * <!-- 需要使用 button 来授权登录 -->
  21459. * <button wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
  21460. * <view wx:else>请升级微信版本</view>
  21461. * ```
  21462. *
  21463. * ```js
  21464. Page({
  21465. data: {
  21466. canIUse: wx.canIUse('button.open-type.getUserInfo')
  21467. },
  21468. onLoad: function() {
  21469. // 查看是否授权
  21470. wx.getSetting({
  21471. success (res){
  21472. if (res.authSetting['scope.userInfo']) {
  21473. // 已经授权,可以直接调用 getUserInfo 获取头像昵称
  21474. wx.getUserInfo({
  21475. success: function(res) {
  21476. console.log(res.userInfo)
  21477. }
  21478. })
  21479. }
  21480. }
  21481. })
  21482. },
  21483. bindGetUserInfo (e) {
  21484. console.log(e.detail.userInfo)
  21485. }
  21486. })
  21487. ``` */
  21488. getUserInfo<T extends GetUserInfoOption = GetUserInfoOption>(
  21489. option: T
  21490. ): PromisifySuccessResult<T, GetUserInfoOption>
  21491. /** [wx.getUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html)
  21492. *
  21493. * 需要基础库: `2.10.4`
  21494. *
  21495. * 在插件中使用:不支持
  21496. *
  21497. * @warning **用户头像昵称获取规则已调整,参考 [小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
  21498. *
  21499. * 获取用户信息。页面产生点击事件(例如 `button` 上 `bindtap` 的回调中)后才可调用,每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。该接口用于替换 `wx.getUserInfo`,详见 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801?highLine=login)。
  21500. *
  21501. * **示例代码**
  21502. *
  21503. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tsJaq2mP7Mp4)
  21504. *
  21505. * **Bug & Tip**
  21506. *
  21507. * 1. `tip`:仅小程序中 `wx.getUserInfo` 接口进行调整,小游戏中不受影响;
  21508. * 2. `tip`:开发者工具中仅 2.10.4 及以上版本可访问 `wx.getUserProfile` 接口,在真机上可参考示例代码进行判断,无需根据版本号或者 `canIUse` 进行条件。
  21509. * 3. `tip`:`wx.getUserProfile` 返回的加密数据中不包含 `openId` 和 `unionId` 字段。
  21510. * 4. `bug`:开发者工具中 `2.10.4`~`2.16.1` 基础库版本通过 `<button open-type="getUserInfo">` 会返回真实数据,真机上此区间会按照公告返回匿名数据。
  21511. *
  21512. * ```html
  21513. * <view class="container">
  21514. * <view class="userinfo">
  21515. * <block wx:if="{{!hasUserInfo}}">
  21516. * <button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
  21517. * <button wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
  21518. * </block>
  21519. * <block wx:else>
  21520. * <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
  21521. * <text class="userinfo-nickname">{{userInfo.nickName}}</text>
  21522. * </block>
  21523. * </view>
  21524. * </view>
  21525. * ```
  21526. *
  21527. * ```js
  21528. Page({
  21529. data: {
  21530. userInfo: {},
  21531. hasUserInfo: false,
  21532. canIUseGetUserProfile: false,
  21533. },
  21534. onLoad() {
  21535. if (wx.getUserProfile) {
  21536. this.setData({
  21537. canIUseGetUserProfile: true
  21538. })
  21539. }
  21540. },
  21541. getUserProfile(e) {
  21542. // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
  21543. // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
  21544. wx.getUserProfile({
  21545. desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  21546. success: (res) => {
  21547. this.setData({
  21548. userInfo: res.userInfo,
  21549. hasUserInfo: true
  21550. })
  21551. }
  21552. })
  21553. },
  21554. getUserInfo(e) {
  21555. // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
  21556. this.setData({
  21557. userInfo: e.detail.userInfo,
  21558. hasUserInfo: true
  21559. })
  21560. },
  21561. })
  21562. ``` */
  21563. getUserProfile<T extends GetUserProfileOption = GetUserProfileOption>(
  21564. option: T
  21565. ): PromisifySuccessResult<T, GetUserProfileOption>
  21566. /** [wx.getVideoInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html)
  21567. *
  21568. * 需要基础库: `2.11.0`
  21569. *
  21570. * 在插件中使用:支持
  21571. *
  21572. * 获取视频详细信息。 */
  21573. getVideoInfo<T extends GetVideoInfoOption = GetVideoInfoOption>(
  21574. option: T
  21575. ): PromisifySuccessResult<T, GetVideoInfoOption>
  21576. /** [wx.getWeRunData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html)
  21577. *
  21578. * 需要基础库: `1.2.0`
  21579. *
  21580. * 在插件中使用:不支持
  21581. *
  21582. * 获取用户过去三十天微信运动步数。需要先调用 [wx.login](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) 接口。步数信息会在用户主动进入小程序时更新。
  21583. *
  21584. * **示例代码**
  21585. *
  21586. * ```js
  21587. wx.getWeRunData({
  21588. success (res) {
  21589. // 拿 encryptedData 到开发者后台解密开放数据
  21590. const encryptedData = res.encryptedData
  21591. // 或拿 cloudID 通过云调用直接获取开放数据
  21592. const cloudID = res.cloudID
  21593. }
  21594. })
  21595. ```
  21596. *
  21597. * **开放数据 JSON 结构**
  21598. *
  21599. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
  21600. * 获取得到的开放数据为以下 json 结构:
  21601. *
  21602. * ```json
  21603. {
  21604. "stepInfoList": [
  21605. {
  21606. "timestamp": 1445866601,
  21607. "step": 100
  21608. },
  21609. {
  21610. "timestamp": 1445876601,
  21611. "step": 120
  21612. }
  21613. ]
  21614. }
  21615. ```
  21616. *
  21617. * stepInfoList 中,每一项结构如下:
  21618. *
  21619. * | 属性 | 类型 | 说明 |
  21620. * | --- | ---- | --- |
  21621. * | timestamp | number | 时间戳,表示数据对应的时间 |
  21622. * | step | number | 微信运动步数 | */
  21623. getWeRunData<T extends GetWeRunDataOption = GetWeRunDataOption>(
  21624. option?: T
  21625. ): PromisifySuccessResult<T, GetWeRunDataOption>
  21626. /** [wx.getWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html)
  21627. *
  21628. * 需要基础库: `1.6.0`
  21629. *
  21630. * 在插件中使用:需要基础库 `2.9.1`
  21631. *
  21632. * 请求获取 Wi-Fi 列表。`wifiList` 数据会在 [`onGetWifiList`](#) 注册的回调中返回。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
  21633. *
  21634. * iOS 上将跳转到系统设置中的微信设置页,需要用户手动进入「无线局域网」设置页,并在系统扫描到设备后,小程序才能收到 onGetWifiList 回调。Android 不会跳转。
  21635. *
  21636. * **注意**
  21637. *
  21638. * 因系统问题,本方法在 iOS 11.0 及 11.1 两个版本失效。但在 iOS 11.2 中已修复。 */
  21639. getWifiList<T extends GetWifiListOption = GetWifiListOption>(
  21640. option?: T
  21641. ): PromisifySuccessResult<T, GetWifiListOption>
  21642. /** [wx.hideHomeButton(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html)
  21643. *
  21644. * 需要基础库: `2.8.3`
  21645. *
  21646. * 在插件中使用:不支持
  21647. *
  21648. * 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。 */
  21649. hideHomeButton<T extends HideHomeButtonOption = HideHomeButtonOption>(
  21650. option?: T
  21651. ): PromisifySuccessResult<T, HideHomeButtonOption>
  21652. /** [wx.hideKeyboard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.hideKeyboard.html)
  21653. *
  21654. * 需要基础库: `2.8.2`
  21655. *
  21656. * 在插件中使用:不支持
  21657. *
  21658. * 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
  21659. *
  21660. * **示例代码**
  21661. *
  21662. * ```js
  21663. wx.hideKeyboard({
  21664. complete: res => {
  21665. console.log('hideKeyboard res', res)
  21666. }
  21667. })
  21668. ``` */
  21669. hideKeyboard<T extends HideKeyboardOption = HideKeyboardOption>(
  21670. option?: T
  21671. ): PromisifySuccessResult<T, HideKeyboardOption>
  21672. /** [wx.hideLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html)
  21673. *
  21674. * 需要基础库: `1.1.0`
  21675. *
  21676. * 在插件中使用:需要基础库 `1.9.6`
  21677. *
  21678. * 隐藏 loading 提示框 */
  21679. hideLoading<T extends HideLoadingOption = HideLoadingOption>(
  21680. option?: T
  21681. ): PromisifySuccessResult<T, HideLoadingOption>
  21682. /** [wx.hideNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html)
  21683. *
  21684. * 在插件中使用:需要基础库 `2.1.0`
  21685. *
  21686. * 在插件中使用时,只能在当前插件的页面中调用
  21687. *
  21688. * 在当前页面隐藏导航条加载动画 */
  21689. hideNavigationBarLoading<
  21690. T extends HideNavigationBarLoadingOption = HideNavigationBarLoadingOption
  21691. >(
  21692. option?: T
  21693. ): PromisifySuccessResult<T, HideNavigationBarLoadingOption>
  21694. /** [wx.hideShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html)
  21695. *
  21696. * 需要基础库: `1.1.0`
  21697. *
  21698. * 在插件中使用:需要基础库 `2.1.0`
  21699. *
  21700. * 在插件中使用时,只能在当前插件的页面中调用
  21701. *
  21702. * 隐藏当前页面的转发按钮
  21703. *
  21704. * ****
  21705. *
  21706. * ## 注意事项
  21707. * - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
  21708. * - 隐藏“发送给朋友”按钮时必须同时隐藏“分享到朋友圈”按钮,隐藏“分享到朋友圈”按钮时则允许不隐藏“发送给朋友”按钮
  21709. *
  21710. * **示例代码**
  21711. *
  21712. * ```js
  21713. wx.hideShareMenu({
  21714. menus: ['shareAppMessage', 'shareTimeline']
  21715. })
  21716. ``` */
  21717. hideShareMenu<T extends HideShareMenuOption = HideShareMenuOption>(
  21718. option?: T
  21719. ): PromisifySuccessResult<T, HideShareMenuOption>
  21720. /** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html)
  21721. *
  21722. * 需要基础库: `1.9.0`
  21723. *
  21724. * 在插件中使用:不支持
  21725. *
  21726. * 隐藏 tabBar */
  21727. hideTabBar<T extends HideTabBarOption = HideTabBarOption>(
  21728. option: T
  21729. ): PromisifySuccessResult<T, HideTabBarOption>
  21730. /** [wx.hideTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html)
  21731. *
  21732. * 需要基础库: `1.9.0`
  21733. *
  21734. * 在插件中使用:不支持
  21735. *
  21736. * 隐藏 tabBar 某一项的右上角的红点 */
  21737. hideTabBarRedDot<
  21738. T extends HideTabBarRedDotOption = HideTabBarRedDotOption
  21739. >(
  21740. option: T
  21741. ): PromisifySuccessResult<T, HideTabBarRedDotOption>
  21742. /** [wx.hideToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html)
  21743. *
  21744. * 在插件中使用:需要基础库 `1.9.6`
  21745. *
  21746. * 隐藏消息提示框 */
  21747. hideToast<T extends HideToastOption = HideToastOption>(
  21748. option?: T
  21749. ): PromisifySuccessResult<T, HideToastOption>
  21750. /** [wx.initFaceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.initFaceDetect.html)
  21751. *
  21752. * 需要基础库: `2.18.0`
  21753. *
  21754. * 在插件中使用:需要基础库 `2.21.3`
  21755. *
  21756. * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
  21757. *
  21758. * 初始化人脸检测。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)
  21759. *
  21760. * ****
  21761. *
  21762. * ### 特别说明
  21763. * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
  21764. initFaceDetect(option?: InitFaceDetectOption): void
  21765. /** [wx.isBluetoothDevicePaired(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.isBluetoothDevicePaired.html)
  21766. *
  21767. * 需要基础库: `2.20.1`
  21768. *
  21769. * 在插件中使用:需要基础库 `2.19.1`
  21770. *
  21771. * 查询蓝牙设备是否配对,仅安卓支持。 */
  21772. isBluetoothDevicePaired<
  21773. T extends IsBluetoothDevicePairedOption = IsBluetoothDevicePairedOption
  21774. >(
  21775. option: T
  21776. ): PromisifySuccessResult<T, IsBluetoothDevicePairedOption>
  21777. /** [wx.join1v1Chat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.join1v1Chat.html)
  21778. *
  21779. * 需要基础库: `2.20.1`
  21780. *
  21781. * 在插件中使用:不支持
  21782. *
  21783. * 加入(创建)双人通话。 */
  21784. join1v1Chat(option: Join1v1ChatOption): void
  21785. /** [wx.joinVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html)
  21786. *
  21787. * 需要基础库: `2.7.0`
  21788. *
  21789. * 在插件中使用:需要基础库 `2.9.0`
  21790. *
  21791. * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html)。调用前需要用户授权 `scope.record`,若房间类型为视频房间需要用户授权 `scope.camera`。 */
  21792. joinVoIPChat<T extends JoinVoIPChatOption = JoinVoIPChatOption>(
  21793. option: T
  21794. ): PromisifySuccessResult<T, JoinVoIPChatOption>
  21795. /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html)
  21796. *
  21797. * 需要基础库: `2.1.0`
  21798. *
  21799. * 在插件中使用:需要基础库 `2.15.0`
  21800. *
  21801. * 动态加载网络字体,文件地址需为下载类型。[2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)起支持全局生效,需在 `app.js` 中调用。
  21802. *
  21803. * 注意:
  21804. * 1. 字体文件返回的 contet-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
  21805. * 2. 字体链接必须是https(ios不支持http)
  21806. * 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
  21807. * 4. 工具里提示 Faild to load font可以忽略
  21808. * 5. [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 以前仅在调用页面生效。
  21809. *
  21810. * **示例代码**
  21811. *
  21812. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/b6Zrajm67R2x)
  21813. * ```js
  21814. wx.loadFontFace({
  21815. family: 'Bitstream Vera Serif Bold',
  21816. source: 'url("https://sungd.github.io/Pacifico.ttf")',
  21817. success: console.log
  21818. })
  21819. ``` */
  21820. loadFontFace<T extends LoadFontFaceOption = LoadFontFaceOption>(
  21821. option: T
  21822. ): PromisifySuccessResult<T, LoadFontFaceOption>
  21823. /** [wx.login(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html)
  21824. *
  21825. * 在插件中使用:需要基础库 `2.3.1`
  21826. *
  21827. * 在插件中使用时,需要在用户信息功能页中获得用户授权或满足一定条件后调用。否则将返回 fail。详见 [用户信息功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/user-info.html)
  21828. *
  21829. * 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台帐号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台帐号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。
  21830. *
  21831. * **示例代码**
  21832. *
  21833. * ```js
  21834. wx.login({
  21835. success (res) {
  21836. if (res.code) {
  21837. //发起网络请求
  21838. wx.request({
  21839. url: 'https://example.com/onLogin',
  21840. data: {
  21841. code: res.code
  21842. }
  21843. })
  21844. } else {
  21845. console.log('登录失败!' + res.errMsg)
  21846. }
  21847. }
  21848. })
  21849. ``` */
  21850. login<T extends LoginOption = LoginOption>(
  21851. option?: T
  21852. ): PromisifySuccessResult<T, LoginOption>
  21853. /** [wx.makeBluetoothPair(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.makeBluetoothPair.html)
  21854. *
  21855. * 需要基础库: `2.12.0`
  21856. *
  21857. * 在插件中使用:需要基础库 `2.12.0`
  21858. *
  21859. * 蓝牙配对接口,仅安卓支持。
  21860. *
  21861. * 通常情况下(需要指定 `pin` 码或者密码时)系统会接管配对流程,直接调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 即可。该接口只应当在开发者不想让用户手动输入 `pin` 码且真机验证确认可以正常生效情况下用。 */
  21862. makeBluetoothPair<
  21863. T extends MakeBluetoothPairOption = MakeBluetoothPairOption
  21864. >(
  21865. option: T
  21866. ): PromisifySuccessResult<T, MakeBluetoothPairOption>
  21867. /** [wx.makePhoneCall(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html)
  21868. *
  21869. * 在插件中使用:需要基础库 `1.9.6`
  21870. *
  21871. * 拨打电话
  21872. *
  21873. * **示例代码**
  21874. *
  21875. * ```js
  21876. wx.makePhoneCall({
  21877. phoneNumber: '1340000' //仅为示例,并非真实的电话号码
  21878. })
  21879. ``` */
  21880. makePhoneCall<T extends MakePhoneCallOption = MakePhoneCallOption>(
  21881. option: T
  21882. ): PromisifySuccessResult<T, MakePhoneCallOption>
  21883. /** [wx.navigateBack(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html)
  21884. *
  21885. * 在插件中使用:需要基础库 `2.1.0`
  21886. *
  21887. * 在插件中使用时,只能在当前插件的页面中调用
  21888. *
  21889. * 关闭当前页面,返回上一页面或多级页面。可通过 [getCurrentPages](https://developers.weixin.qq.com/miniprogram/dev/reference/api/getCurrentPages.html) 获取当前的页面栈,决定需要返回几层。 */
  21890. navigateBack<T extends NavigateBackOption = NavigateBackOption>(
  21891. option?: T
  21892. ): PromisifySuccessResult<T, NavigateBackOption>
  21893. /** [wx.navigateBackMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.navigateBackMiniProgram.html)
  21894. *
  21895. * 需要基础库: `1.3.0`
  21896. *
  21897. * 在插件中使用:不支持
  21898. *
  21899. * 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
  21900. *
  21901. * 注意:**微信客户端 iOS 6.5.9,Android 6.5.10 及以上版本支持**
  21902. *
  21903. * **示例代码**
  21904. *
  21905. * ```js
  21906. wx.navigateBackMiniProgram({
  21907. extraData: {
  21908. foo: 'bar'
  21909. },
  21910. success(res) {
  21911. // 返回成功
  21912. }
  21913. })
  21914. ``` */
  21915. navigateBackMiniProgram<
  21916. T extends NavigateBackMiniProgramOption = NavigateBackMiniProgramOption
  21917. >(
  21918. option: T
  21919. ): PromisifySuccessResult<T, NavigateBackMiniProgramOption>
  21920. /** [wx.navigateTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html)
  21921. *
  21922. * 在插件中使用:需要基础库 `2.2.2`
  21923. *
  21924. * 在插件中使用时,只能在当前插件的页面中调用
  21925. *
  21926. * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html) 可以返回到原页面。小程序中页面栈最多十层。
  21927. *
  21928. * **示例代码**
  21929. *
  21930. * ```js
  21931. wx.navigateTo({
  21932. url: 'test?id=1',
  21933. events: {
  21934. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  21935. acceptDataFromOpenedPage: function(data) {
  21936. console.log(data)
  21937. },
  21938. someEvent: function(data) {
  21939. console.log(data)
  21940. }
  21941. ...
  21942. },
  21943. success: function(res) {
  21944. // 通过eventChannel向被打开页面传送数据
  21945. res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'test' })
  21946. }
  21947. })
  21948. ```
  21949. *
  21950. * ```javascript
  21951. //test.js
  21952. Page({
  21953. onLoad: function(option){
  21954. console.log(option.query)
  21955. const eventChannel = this.getOpenerEventChannel()
  21956. eventChannel.emit('acceptDataFromOpenedPage', {data: 'test'});
  21957. eventChannel.emit('someEvent', {data: 'test'});
  21958. // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
  21959. eventChannel.on('acceptDataFromOpenerPage', function(data) {
  21960. console.log(data)
  21961. })
  21962. }
  21963. })
  21964. ``` */
  21965. navigateTo<T extends NavigateToOption = NavigateToOption>(
  21966. option: T
  21967. ): PromisifySuccessResult<T, NavigateToOption>
  21968. /** [wx.navigateToMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.navigateToMiniProgram.html)
  21969. *
  21970. * 需要基础库: `1.3.0`
  21971. *
  21972. * 在插件中使用:需要基础库 `2.18.1`
  21973. *
  21974. * 打开另一个小程序
  21975. *
  21976. * **使用限制**
  21977. *
  21978. * ##### 需要用户触发跳转
  21979. * 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
  21980. * ##### 需要用户确认跳转
  21981. * 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。
  21982. * ##### 无需声明跳转名单,不限跳转数量(众测中)
  21983. * 1. 从2020年4月24日起,使用跳转其他小程序功能将无需在全局配置中声明跳转名单,调用此接口时将不再校验所跳转的 AppID 是否在 navigateToMiniProgramAppIdList 中。
  21984. * 2. 从2020年4月24日起,跳转其他小程序将不再受数量限制,使用此功能时请注意遵守运营规范。
  21985. *
  21986. * **运营规范**
  21987. *
  21988. * 平台将坚决打击小程序盒子等互推行为,使用此功能时请严格遵守[《微信小程序平台运营规范》](https://developers.weixin.qq.com/miniprogram/product/#_5-10-%E4%BA%92%E6%8E%A8%E8%A1%8C%E4%B8%BA),若发现小程序违反运营规范将被下架处理。
  21989. *
  21990. * **关于调试**
  21991. *
  21992. * - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
  21993. * - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
  21994. *
  21995. * **示例代码**
  21996. *
  21997. * ```js
  21998. wx.navigateToMiniProgram({
  21999. appId: '',
  22000. path: 'page/index/index?id=123',
  22001. extraData: {
  22002. foo: 'bar'
  22003. },
  22004. envVersion: 'develop',
  22005. success(res) {
  22006. // 打开成功
  22007. }
  22008. })
  22009. ``` */
  22010. navigateToMiniProgram<
  22011. T extends NavigateToMiniProgramOption = NavigateToMiniProgramOption
  22012. >(
  22013. option: T
  22014. ): PromisifySuccessResult<T, NavigateToMiniProgramOption>
  22015. /** [wx.nextTick(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html)
  22016. *
  22017. * 需要基础库: `2.2.3`
  22018. *
  22019. * 在插件中使用:需要基础库 `2.7.1`
  22020. *
  22021. * 延迟一部分操作到下一个时间片再执行。(类似于 setTimeout)
  22022. *
  22023. * **说明**
  22024. *
  22025. * 因为自定义组件中的 setData 和 triggerEvent 等接口本身是同步的操作,当这几个接口被连续调用时,都是在一个同步流程中执行完的,因此若逻辑不当可能会导致出错。
  22026. *
  22027. * 一个极端的案例:当父组件的 setData 引发了子组件的 triggerEvent,进而使得父组件又进行了一次 setData,期间有通过 wx:if 语句对子组件进行卸载,就有可能引发奇怪的错误,所以对于不需要在一个同步流程内完成的逻辑,可以使用此接口延迟到下一个时间片再执行。
  22028. *
  22029. * **示例代码**
  22030. *
  22031. * ```js
  22032. Component({
  22033. doSth() {
  22034. this.setData({ number: 1 }) // 直接在当前同步流程中执行
  22035. wx.nextTick(() => {
  22036. this.setData({ number: 3 }) // 在当前同步流程结束后,下一个时间片执行
  22037. })
  22038. this.setData({ number: 2 }) // 直接在当前同步流程中执行
  22039. }
  22040. })
  22041. ``` */
  22042. nextTick(callback: (...args: any[]) => any): void
  22043. /** [wx.notifyBLECharacteristicValueChange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html)
  22044. *
  22045. * 需要基础库: `1.1.0`
  22046. *
  22047. * 在插件中使用:需要基础库 `1.9.6`
  22048. *
  22049. * 启用蓝牙低功耗设备特征值变化时的 notify 功能,订阅特征。注意:必须设备的特征支持 notify 或者 indicate 才可以成功调用。
  22050. *
  22051. * 另外,必须先启用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 才能监听到设备 `characteristicValueChange` 事件
  22052. *
  22053. * **注意**
  22054. *
  22055. * - 订阅操作成功后需要设备主动更新特征的 value,才会触发 [wx.onBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) 回调。
  22056. * - 安卓平台上,在本接口调用成功后立即调用 [wx.writeBLECharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html) 接口,在部分机型上会发生 10008 系统错误
  22057. *
  22058. * **示例代码**
  22059. *
  22060. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22061. * ```js
  22062. wx.notifyBLECharacteristicValueChange({
  22063. state: true, // 启用 notify 功能
  22064. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  22065. deviceId,
  22066. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  22067. serviceId,
  22068. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  22069. characteristicId,
  22070. success (res) {
  22071. console.log('notifyBLECharacteristicValueChange success', res.errMsg)
  22072. }
  22073. })
  22074. ``` */
  22075. notifyBLECharacteristicValueChange<
  22076. T extends NotifyBLECharacteristicValueChangeOption = NotifyBLECharacteristicValueChangeOption
  22077. >(
  22078. option: T
  22079. ): PromisifySuccessResult<T, NotifyBLECharacteristicValueChangeOption>
  22080. /** [wx.offAccelerometerChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html)
  22081. *
  22082. * 需要基础库: `2.9.3`
  22083. *
  22084. * 在插件中使用:需要基础库 `2.9.1`
  22085. *
  22086. * 移除加速度数据事件的监听函数
  22087. *
  22088. * **示例代码**
  22089. *
  22090. * ```js
  22091. const listener = function (res) { console.log(res) }
  22092. wx.onAccelerometerChange(listener)
  22093. wx.offAccelerometerChange(listener) // 需传入与监听时同一个的函数对象
  22094. ``` */
  22095. offAccelerometerChange(
  22096. /** onAccelerometerChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22097. listener?: OffAccelerometerChangeCallback
  22098. ): void
  22099. /** [wx.offAppHide(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html)
  22100. *
  22101. * 需要基础库: `2.1.2`
  22102. *
  22103. * 在插件中使用:不支持
  22104. *
  22105. * 移除小程序切后台事件的监听函数
  22106. *
  22107. * **示例代码**
  22108. *
  22109. * ```js
  22110. const listener = function (res) { console.log(res) }
  22111. wx.onAppHide(listener)
  22112. wx.offAppHide(listener) // 需传入与监听时同一个的函数对象
  22113. ``` */
  22114. offAppHide(
  22115. /** onAppHide 传入的监听函数。不传此参数则移除所有监听函数。 */
  22116. listener?: OffAppHideCallback
  22117. ): void
  22118. /** [wx.offAppShow(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html)
  22119. *
  22120. * 需要基础库: `2.1.2`
  22121. *
  22122. * 在插件中使用:不支持
  22123. *
  22124. * 移除小程序切前台事件的监听函数
  22125. *
  22126. * **示例代码**
  22127. *
  22128. * ```js
  22129. const listener = function (res) { console.log(res) }
  22130. wx.onAppShow(listener)
  22131. wx.offAppShow(listener) // 需传入与监听时同一个的函数对象
  22132. ``` */
  22133. offAppShow(
  22134. /** onAppShow 传入的监听函数。不传此参数则移除所有监听函数。 */
  22135. listener?: OffAppShowCallback
  22136. ): void
  22137. /** [wx.offAudioInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionBegin.html)
  22138. *
  22139. * 需要基础库: `2.6.2`
  22140. *
  22141. * 在插件中使用:需要基础库 `2.15.0`
  22142. *
  22143. * 移除音频因为受到系统占用而被中断开始事件的监听函数
  22144. *
  22145. * **示例代码**
  22146. *
  22147. * ```js
  22148. const listener = function (res) { console.log(res) }
  22149. wx.onAudioInterruptionBegin(listener)
  22150. wx.offAudioInterruptionBegin(listener) // 需传入与监听时同一个的函数对象
  22151. ``` */
  22152. offAudioInterruptionBegin(
  22153. /** onAudioInterruptionBegin 传入的监听函数。不传此参数则移除所有监听函数。 */
  22154. listener?: OffAudioInterruptionBeginCallback
  22155. ): void
  22156. /** [wx.offAudioInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionEnd.html)
  22157. *
  22158. * 需要基础库: `2.6.2`
  22159. *
  22160. * 在插件中使用:需要基础库 `2.15.0`
  22161. *
  22162. * 移除音频中断结束事件的监听函数
  22163. *
  22164. * **示例代码**
  22165. *
  22166. * ```js
  22167. const listener = function (res) { console.log(res) }
  22168. wx.onAudioInterruptionEnd(listener)
  22169. wx.offAudioInterruptionEnd(listener) // 需传入与监听时同一个的函数对象
  22170. ``` */
  22171. offAudioInterruptionEnd(
  22172. /** onAudioInterruptionEnd 传入的监听函数。不传此参数则移除所有监听函数。 */
  22173. listener?: OffAudioInterruptionEndCallback
  22174. ): void
  22175. /** [wx.offBLECharacteristicValueChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html)
  22176. *
  22177. * 需要基础库: `2.9.0`
  22178. *
  22179. * 在插件中使用:需要基础库 `2.9.1`
  22180. *
  22181. * 移除蓝牙低功耗设备的特征值变化事件的监听函数
  22182. *
  22183. * **示例代码**
  22184. *
  22185. * ```js
  22186. const listener = function (res) { console.log(res) }
  22187. wx.onBLECharacteristicValueChange(listener)
  22188. wx.offBLECharacteristicValueChange(listener) // 需传入与监听时同一个的函数对象
  22189. ``` */
  22190. offBLECharacteristicValueChange(
  22191. /** onBLECharacteristicValueChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22192. listener?: OffBLECharacteristicValueChangeCallback
  22193. ): void
  22194. /** [wx.offBLEConnectionStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEConnectionStateChange.html)
  22195. *
  22196. * 需要基础库: `2.9.0`
  22197. *
  22198. * 在插件中使用:需要基础库 `2.9.1`
  22199. *
  22200. * 移除蓝牙低功耗连接状态改变事件的监听函数
  22201. *
  22202. * **示例代码**
  22203. *
  22204. * ```js
  22205. const listener = function (res) { console.log(res) }
  22206. wx.onBLEConnectionStateChange(listener)
  22207. wx.offBLEConnectionStateChange(listener) // 需传入与监听时同一个的函数对象
  22208. ``` */
  22209. offBLEConnectionStateChange(
  22210. /** onBLEConnectionStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22211. listener?: OffBLEConnectionStateChangeCallback
  22212. ): void
  22213. /** [wx.offBLEMTUChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEMTUChange.html)
  22214. *
  22215. * 需要基础库: `2.20.1`
  22216. *
  22217. * 在插件中使用:需要基础库 `2.20.1`
  22218. *
  22219. * 移除蓝牙低功耗的最大传输单元变化事件的监听函数
  22220. *
  22221. * **示例代码**
  22222. *
  22223. * ```js
  22224. const listener = function (res) { console.log(res) }
  22225. wx.onBLEMTUChange(listener)
  22226. wx.offBLEMTUChange(listener) // 需传入与监听时同一个的函数对象
  22227. ``` */
  22228. offBLEMTUChange(
  22229. /** onBLEMTUChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22230. listener?: OffBLEMTUChangeCallback
  22231. ): void
  22232. /** [wx.offBLEPeripheralConnectionStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html)
  22233. *
  22234. * 需要基础库: `2.10.3`
  22235. *
  22236. * 在插件中使用:需要基础库 `2.22.1`
  22237. *
  22238. * 移除当前外围设备被连接或断开连接事件的监听函数
  22239. *
  22240. * **示例代码**
  22241. *
  22242. * ```js
  22243. const listener = function (res) { console.log(res) }
  22244. wx.onBLEPeripheralConnectionStateChanged(listener)
  22245. wx.offBLEPeripheralConnectionStateChanged(listener) // 需传入与监听时同一个的函数对象
  22246. ``` */
  22247. offBLEPeripheralConnectionStateChanged(
  22248. /** onBLEPeripheralConnectionStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  22249. listener?: OffBLEPeripheralConnectionStateChangedCallback
  22250. ): void
  22251. /** [wx.offBeaconServiceChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html)
  22252. *
  22253. * 需要基础库: `2.8.1`
  22254. *
  22255. * 在插件中使用:需要基础库 `2.9.1`
  22256. *
  22257. * 移除 Beacon 服务状态变化事件的监听函数
  22258. *
  22259. * **示例代码**
  22260. *
  22261. * ```js
  22262. const listener = function (res) { console.log(res) }
  22263. wx.onBeaconServiceChange(listener)
  22264. wx.offBeaconServiceChange(listener) // 需传入与监听时同一个的函数对象
  22265. ``` */
  22266. offBeaconServiceChange(
  22267. /** onBeaconServiceChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22268. listener?: OffBeaconServiceChangeCallback
  22269. ): void
  22270. /** [wx.offBeaconUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html)
  22271. *
  22272. * 需要基础库: `2.8.1`
  22273. *
  22274. * 在插件中使用:需要基础库 `2.9.1`
  22275. *
  22276. * 移除 Beacon 设备更新事件的监听函数
  22277. *
  22278. * **示例代码**
  22279. *
  22280. * ```js
  22281. const listener = function (res) { console.log(res) }
  22282. wx.onBeaconUpdate(listener)
  22283. wx.offBeaconUpdate(listener) // 需传入与监听时同一个的函数对象
  22284. ``` */
  22285. offBeaconUpdate(
  22286. /** onBeaconUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  22287. listener?: OffBeaconUpdateCallback
  22288. ): void
  22289. /** [wx.offBluetoothAdapterStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html)
  22290. *
  22291. * 需要基础库: `2.9.0`
  22292. *
  22293. * 在插件中使用:需要基础库 `2.9.1`
  22294. *
  22295. * 移除蓝牙适配器状态变化事件的监听函数
  22296. *
  22297. * **示例代码**
  22298. *
  22299. * ```js
  22300. const listener = function (res) { console.log(res) }
  22301. wx.onBluetoothAdapterStateChange(listener)
  22302. wx.offBluetoothAdapterStateChange(listener) // 需传入与监听时同一个的函数对象
  22303. ``` */
  22304. offBluetoothAdapterStateChange(
  22305. /** onBluetoothAdapterStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22306. listener?: OffBluetoothAdapterStateChangeCallback
  22307. ): void
  22308. /** [wx.offBluetoothDeviceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html)
  22309. *
  22310. * 需要基础库: `2.9.0`
  22311. *
  22312. * 在插件中使用:需要基础库 `2.9.1`
  22313. *
  22314. * 移除搜索到新设备的事件的监听函数
  22315. *
  22316. * **示例代码**
  22317. *
  22318. * ```js
  22319. const listener = function (res) { console.log(res) }
  22320. wx.onBluetoothDeviceFound(listener)
  22321. wx.offBluetoothDeviceFound(listener) // 需传入与监听时同一个的函数对象
  22322. ``` */
  22323. offBluetoothDeviceFound(
  22324. /** onBluetoothDeviceFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  22325. listener?: OffBluetoothDeviceFoundCallback
  22326. ): void
  22327. /** [wx.offCompassChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html)
  22328. *
  22329. * 需要基础库: `2.9.3`
  22330. *
  22331. * 在插件中使用:需要基础库 `2.9.1`
  22332. *
  22333. * 移除罗盘数据变化事件的监听函数
  22334. *
  22335. * **示例代码**
  22336. *
  22337. * ```js
  22338. const listener = function (res) { console.log(res) }
  22339. wx.onCompassChange(listener)
  22340. wx.offCompassChange(listener) // 需传入与监听时同一个的函数对象
  22341. ``` */
  22342. offCompassChange(
  22343. /** onCompassChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22344. listener?: OffCompassChangeCallback
  22345. ): void
  22346. /** [wx.offCopyUrl(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.offCopyUrl.html)
  22347. *
  22348. * 需要基础库: `2.14.3`
  22349. *
  22350. * 在插件中使用:不支持
  22351. *
  22352. * 移除用户点击右上角菜单的「复制链接」按钮时触发的事件的监听函数
  22353. *
  22354. * **示例代码**
  22355. *
  22356. * ```js
  22357. const listener = function (res) { console.log(res) }
  22358. wx.onCopyUrl(listener)
  22359. wx.offCopyUrl(listener) // 需传入与监听时同一个的函数对象
  22360. ``` */
  22361. offCopyUrl(
  22362. /** onCopyUrl 传入的监听函数。不传此参数则移除所有监听函数。 */
  22363. listener?: OffCopyUrlCallback
  22364. ): void
  22365. /** [wx.offDeviceMotionChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html)
  22366. *
  22367. * 需要基础库: `2.9.3`
  22368. *
  22369. * 在插件中使用:需要基础库 `2.9.1`
  22370. *
  22371. * 移除设备方向变化事件的监听函数
  22372. *
  22373. * **示例代码**
  22374. *
  22375. * ```js
  22376. const listener = function (res) { console.log(res) }
  22377. wx.onDeviceMotionChange(listener)
  22378. wx.offDeviceMotionChange(listener) // 需传入与监听时同一个的函数对象
  22379. ``` */
  22380. offDeviceMotionChange(
  22381. /** onDeviceMotionChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22382. listener?: OffDeviceMotionChangeCallback
  22383. ): void
  22384. /** [wx.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html)
  22385. *
  22386. * 需要基础库: `2.1.2`
  22387. *
  22388. * 在插件中使用:不支持
  22389. *
  22390. * 移除小程序错误事件的监听函数
  22391. *
  22392. * **示例代码**
  22393. *
  22394. * ```js
  22395. const listener = function (res) { console.log(res) }
  22396. wx.onError(listener)
  22397. wx.offError(listener) // 需传入与监听时同一个的函数对象
  22398. ``` */
  22399. offError(
  22400. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  22401. listener?: WxOffErrorCallback
  22402. ): void
  22403. /** [wx.offGetWifiList(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html)
  22404. *
  22405. * 需要基础库: `2.9.0`
  22406. *
  22407. * 在插件中使用:需要基础库 `2.9.1`
  22408. *
  22409. * 移除获取到 Wi-Fi 列表数据事件的监听函数
  22410. *
  22411. * **示例代码**
  22412. *
  22413. * ```js
  22414. const listener = function (res) { console.log(res) }
  22415. wx.onGetWifiList(listener)
  22416. wx.offGetWifiList(listener) // 需传入与监听时同一个的函数对象
  22417. ``` */
  22418. offGetWifiList(
  22419. /** onGetWifiList 传入的监听函数。不传此参数则移除所有监听函数。 */
  22420. listener?: OffGetWifiListCallback
  22421. ): void
  22422. /** [wx.offHCEMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.offHCEMessage.html)
  22423. *
  22424. * 需要基础库: `2.8.1`
  22425. *
  22426. * 在插件中使用:需要基础库 `2.9.1`
  22427. *
  22428. * 移除接收 NFC 设备消息事件的监听函数
  22429. *
  22430. * **示例代码**
  22431. *
  22432. * ```js
  22433. const listener = function (res) { console.log(res) }
  22434. wx.onHCEMessage(listener)
  22435. wx.offHCEMessage(listener) // 需传入与监听时同一个的函数对象
  22436. ``` */
  22437. offHCEMessage(
  22438. /** onHCEMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  22439. listener?: OffHCEMessageCallback
  22440. ): void
  22441. /** [wx.offKeyboardHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html)
  22442. *
  22443. * 需要基础库: `2.9.2`
  22444. *
  22445. * 在插件中使用:不支持
  22446. *
  22447. * 移除键盘高度变化事件的监听函数
  22448. *
  22449. * **示例代码**
  22450. *
  22451. * ```js
  22452. const listener = function (res) { console.log(res) }
  22453. wx.onKeyboardHeightChange(listener)
  22454. wx.offKeyboardHeightChange(listener) // 需传入与监听时同一个的函数对象
  22455. ``` */
  22456. offKeyboardHeightChange(
  22457. /** onKeyboardHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22458. listener?: OffKeyboardHeightChangeCallback
  22459. ): void
  22460. /** [wx.offLazyLoadError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offLazyLoadError.html)
  22461. *
  22462. * 需要基础库: `2.24.3`
  22463. *
  22464. * 在插件中使用:不支持
  22465. *
  22466. * 移除小程序异步组件加载失败事件的监听函数
  22467. *
  22468. * **示例代码**
  22469. *
  22470. * ```js
  22471. const listener = function (res) { console.log(res) }
  22472. wx.onLazyLoadError(listener)
  22473. wx.offLazyLoadError(listener) // 需传入与监听时同一个的函数对象
  22474. ``` */
  22475. offLazyLoadError(
  22476. /** onLazyLoadError 传入的监听函数。不传此参数则移除所有监听函数。 */
  22477. listener?: OffLazyLoadErrorCallback
  22478. ): void
  22479. /** [wx.offLocalServiceDiscoveryStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceDiscoveryStop.html)
  22480. *
  22481. * 需要基础库: `2.4.0`
  22482. *
  22483. * 在插件中使用:需要基础库 `2.15.0`
  22484. *
  22485. * 移除 mDNS 服务停止搜索的事件的监听函数
  22486. *
  22487. * **示例代码**
  22488. *
  22489. * ```js
  22490. const listener = function (res) { console.log(res) }
  22491. wx.onLocalServiceDiscoveryStop(listener)
  22492. wx.offLocalServiceDiscoveryStop(listener) // 需传入与监听时同一个的函数对象
  22493. ``` */
  22494. offLocalServiceDiscoveryStop(
  22495. /** onLocalServiceDiscoveryStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  22496. listener?: OffLocalServiceDiscoveryStopCallback
  22497. ): void
  22498. /** [wx.offLocalServiceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceFound.html)
  22499. *
  22500. * 需要基础库: `2.4.0`
  22501. *
  22502. * 在插件中使用:需要基础库 `2.15.0`
  22503. *
  22504. * 移除 mDNS 服务发现的事件的监听函数
  22505. *
  22506. * **示例代码**
  22507. *
  22508. * ```js
  22509. const listener = function (res) { console.log(res) }
  22510. wx.onLocalServiceFound(listener)
  22511. wx.offLocalServiceFound(listener) // 需传入与监听时同一个的函数对象
  22512. ``` */
  22513. offLocalServiceFound(
  22514. /** onLocalServiceFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  22515. listener?: OffLocalServiceFoundCallback
  22516. ): void
  22517. /** [wx.offLocalServiceLost(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceLost.html)
  22518. *
  22519. * 需要基础库: `2.4.0`
  22520. *
  22521. * 在插件中使用:需要基础库 `2.15.0`
  22522. *
  22523. * 移除 mDNS 服务离开的事件的监听函数
  22524. *
  22525. * **示例代码**
  22526. *
  22527. * ```js
  22528. const listener = function (res) { console.log(res) }
  22529. wx.onLocalServiceLost(listener)
  22530. wx.offLocalServiceLost(listener) // 需传入与监听时同一个的函数对象
  22531. ``` */
  22532. offLocalServiceLost(
  22533. /** onLocalServiceLost 传入的监听函数。不传此参数则移除所有监听函数。 */
  22534. listener?: OffLocalServiceLostCallback
  22535. ): void
  22536. /** [wx.offLocalServiceResolveFail(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceResolveFail.html)
  22537. *
  22538. * 需要基础库: `2.4.0`
  22539. *
  22540. * 在插件中使用:需要基础库 `2.15.0`
  22541. *
  22542. * 移除 mDNS 服务解析失败的事件的监听函数
  22543. *
  22544. * **示例代码**
  22545. *
  22546. * ```js
  22547. const listener = function (res) { console.log(res) }
  22548. wx.onLocalServiceResolveFail(listener)
  22549. wx.offLocalServiceResolveFail(listener) // 需传入与监听时同一个的函数对象
  22550. ``` */
  22551. offLocalServiceResolveFail(
  22552. /** onLocalServiceResolveFail 传入的监听函数。不传此参数则移除所有监听函数。 */
  22553. listener?: OffLocalServiceResolveFailCallback
  22554. ): void
  22555. /** [wx.offLocationChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html)
  22556. *
  22557. * 需要基础库: `2.8.1`
  22558. *
  22559. * 在插件中使用:不支持
  22560. *
  22561. * 移除实时地理位置变化事件的监听函数
  22562. *
  22563. * **示例代码**
  22564. *
  22565. * ```js
  22566. const listener = function (res) { console.log(res) }
  22567. wx.onLocationChange(listener)
  22568. wx.offLocationChange(listener) // 需传入与监听时同一个的函数对象
  22569. ``` */
  22570. offLocationChange(
  22571. /** onLocationChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22572. listener?: OffLocationChangeCallback
  22573. ): void
  22574. /** [wx.offLocationChangeError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChangeError.html)
  22575. *
  22576. * 需要基础库: `2.19.5`
  22577. *
  22578. * 在插件中使用:不支持
  22579. *
  22580. * 移除持续定位接口返回失败时触发。的监听函数
  22581. *
  22582. * **示例代码**
  22583. *
  22584. * ```js
  22585. const listener = function (res) { console.log(res) }
  22586. wx.onLocationChangeError(listener)
  22587. wx.offLocationChangeError(listener) // 需传入与监听时同一个的函数对象
  22588. ``` */
  22589. offLocationChangeError(
  22590. /** onLocationChangeError 传入的监听函数。不传此参数则移除所有监听函数。 */
  22591. listener?: OffLocationChangeErrorCallback
  22592. ): void
  22593. /** [wx.offMemoryWarning(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html)
  22594. *
  22595. * 需要基础库: `2.9.0`
  22596. *
  22597. * 在插件中使用:不支持
  22598. *
  22599. * 移除内存不足告警事件的监听函数
  22600. *
  22601. * **示例代码**
  22602. *
  22603. * ```js
  22604. const listener = function (res) { console.log(res) }
  22605. wx.onMemoryWarning(listener)
  22606. wx.offMemoryWarning(listener) // 需传入与监听时同一个的函数对象
  22607. ``` */
  22608. offMemoryWarning(
  22609. /** onMemoryWarning 传入的监听函数。不传此参数则移除所有监听函数。 */
  22610. listener?: OffMemoryWarningCallback
  22611. ): void
  22612. /** [wx.offNetworkStatusChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html)
  22613. *
  22614. * 需要基础库: `2.9.3`
  22615. *
  22616. * 在插件中使用:需要基础库 `2.9.1`
  22617. *
  22618. * 移除网络状态变化事件的监听函数
  22619. *
  22620. * **示例代码**
  22621. *
  22622. * ```js
  22623. const listener = function (res) { console.log(res) }
  22624. wx.onNetworkStatusChange(listener)
  22625. wx.offNetworkStatusChange(listener) // 需传入与监听时同一个的函数对象
  22626. ``` */
  22627. offNetworkStatusChange(
  22628. /** onNetworkStatusChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22629. listener?: OffNetworkStatusChangeCallback
  22630. ): void
  22631. /** [wx.offNetworkWeakChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkWeakChange.html)
  22632. *
  22633. * 需要基础库: `2.21.0`
  22634. *
  22635. * 在插件中使用:不支持
  22636. *
  22637. * 移除弱网状态变化事件的监听函数
  22638. *
  22639. * **示例代码**
  22640. *
  22641. * ```js
  22642. const listener = function (res) { console.log(res) }
  22643. wx.onNetworkWeakChange(listener)
  22644. wx.offNetworkWeakChange(listener) // 需传入与监听时同一个的函数对象
  22645. ``` */
  22646. offNetworkWeakChange(
  22647. /** onNetworkWeakChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22648. listener?: OffNetworkWeakChangeCallback
  22649. ): void
  22650. /** [wx.offPageNotFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html)
  22651. *
  22652. * 需要基础库: `2.1.2`
  22653. *
  22654. * 在插件中使用:不支持
  22655. *
  22656. * 移除小程序要打开的页面不存在事件的监听函数
  22657. *
  22658. * **示例代码**
  22659. *
  22660. * ```js
  22661. const listener = function (res) { console.log(res) }
  22662. wx.onPageNotFound(listener)
  22663. wx.offPageNotFound(listener) // 需传入与监听时同一个的函数对象
  22664. ``` */
  22665. offPageNotFound(
  22666. /** onPageNotFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  22667. listener?: OffPageNotFoundCallback
  22668. ): void
  22669. /** [wx.offScreenRecordingStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html)
  22670. *
  22671. * 需要基础库: `2.24.0`
  22672. *
  22673. * 在插件中使用:不支持
  22674. *
  22675. * 移除用户录屏事件的监听函数
  22676. *
  22677. * **示例代码**
  22678. *
  22679. * ```js
  22680. const listener = function (res) { console.log(res) }
  22681. wx.onScreenRecordingStateChanged(listener)
  22682. wx.offScreenRecordingStateChanged(listener) // 需传入与监听时同一个的函数对象
  22683. ``` */
  22684. offScreenRecordingStateChanged(
  22685. /** onScreenRecordingStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  22686. listener?: OffScreenRecordingStateChangedCallback
  22687. ): void
  22688. /** [wx.offThemeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html)
  22689. *
  22690. * 需要基础库: `2.11.0`
  22691. *
  22692. * 在插件中使用:不支持
  22693. *
  22694. * 移除系统主题改变事件的监听函数
  22695. *
  22696. * **示例代码**
  22697. *
  22698. * ```js
  22699. const listener = function (res) { console.log(res) }
  22700. wx.onThemeChange(listener)
  22701. wx.offThemeChange(listener) // 需传入与监听时同一个的函数对象
  22702. ``` */
  22703. offThemeChange(
  22704. /** onThemeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  22705. listener?: OffThemeChangeCallback
  22706. ): void
  22707. /** [wx.offUnhandledRejection(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html)
  22708. *
  22709. * 需要基础库: `2.10.0`
  22710. *
  22711. * 在插件中使用:不支持
  22712. *
  22713. * 移除未处理的 Promise 拒绝事件的监听函数
  22714. *
  22715. * **示例代码**
  22716. *
  22717. * ```js
  22718. const listener = function (res) { console.log(res) }
  22719. wx.onUnhandledRejection(listener)
  22720. wx.offUnhandledRejection(listener) // 需传入与监听时同一个的函数对象
  22721. ``` */
  22722. offUnhandledRejection(
  22723. /** onUnhandledRejection 传入的监听函数。不传此参数则移除所有监听函数。 */
  22724. listener?: OffUnhandledRejectionCallback
  22725. ): void
  22726. /** [wx.offUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html)
  22727. *
  22728. * 需要基础库: `2.9.3`
  22729. *
  22730. * 在插件中使用:需要基础库 `2.9.1`
  22731. *
  22732. * 在插件中使用时,只能在当前插件的页面中调用
  22733. *
  22734. * 用户主动截屏事件。取消事件监听。 */
  22735. offUserCaptureScreen(
  22736. /** 用户主动截屏事件的回调函数 */
  22737. callback?: (...args: any[]) => any
  22738. ): void
  22739. /** [wx.offVoIPChatInterrupted(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html)
  22740. *
  22741. * 需要基础库: `2.9.0`
  22742. *
  22743. * 在插件中使用:需要基础库 `2.9.1`
  22744. *
  22745. * 移除被动断开实时语音通话事件的监听函数
  22746. *
  22747. * **示例代码**
  22748. *
  22749. * ```js
  22750. const listener = function (res) { console.log(res) }
  22751. wx.onVoIPChatInterrupted(listener)
  22752. wx.offVoIPChatInterrupted(listener) // 需传入与监听时同一个的函数对象
  22753. ``` */
  22754. offVoIPChatInterrupted(
  22755. /** onVoIPChatInterrupted 传入的监听函数。不传此参数则移除所有监听函数。 */
  22756. listener?: OffVoIPChatInterruptedCallback
  22757. ): void
  22758. /** [wx.offVoIPChatMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html)
  22759. *
  22760. * 需要基础库: `2.9.0`
  22761. *
  22762. * 在插件中使用:需要基础库 `2.9.1`
  22763. *
  22764. * 移除实时语音通话成员在线状态变化事件的监听函数
  22765. *
  22766. * **示例代码**
  22767. *
  22768. * ```js
  22769. const listener = function (res) { console.log(res) }
  22770. wx.onVoIPChatMembersChanged(listener)
  22771. wx.offVoIPChatMembersChanged(listener) // 需传入与监听时同一个的函数对象
  22772. ``` */
  22773. offVoIPChatMembersChanged(
  22774. /** onVoIPChatMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  22775. listener?: OffVoIPChatMembersChangedCallback
  22776. ): void
  22777. /** [wx.offVoIPChatSpeakersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatSpeakersChanged.html)
  22778. *
  22779. * 需要基础库: `2.9.0`
  22780. *
  22781. * 在插件中使用:需要基础库 `2.9.1`
  22782. *
  22783. * 移除实时语音通话成员通话状态变化事件的监听函数
  22784. *
  22785. * **示例代码**
  22786. *
  22787. * ```js
  22788. const listener = function (res) { console.log(res) }
  22789. wx.onVoIPChatSpeakersChanged(listener)
  22790. wx.offVoIPChatSpeakersChanged(listener) // 需传入与监听时同一个的函数对象
  22791. ``` */
  22792. offVoIPChatSpeakersChanged(
  22793. /** onVoIPChatSpeakersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  22794. listener?: OffVoIPChatSpeakersChangedCallback
  22795. ): void
  22796. /** [wx.offVoIPChatStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatStateChanged.html)
  22797. *
  22798. * 需要基础库: `2.16.0`
  22799. *
  22800. * 在插件中使用:不支持
  22801. *
  22802. * 移除房间状态变化事件的监听函数
  22803. *
  22804. * **示例代码**
  22805. *
  22806. * ```js
  22807. const listener = function (res) { console.log(res) }
  22808. wx.onVoIPChatStateChanged(listener)
  22809. wx.offVoIPChatStateChanged(listener) // 需传入与监听时同一个的函数对象
  22810. ``` */
  22811. offVoIPChatStateChanged(
  22812. /** onVoIPChatStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  22813. listener?: OffVoIPChatStateChangedCallback
  22814. ): void
  22815. /** [wx.offVoIPVideoMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPVideoMembersChanged.html)
  22816. *
  22817. * 需要基础库: `2.11.0`
  22818. *
  22819. * 在插件中使用:不支持
  22820. *
  22821. * 移除实时语音通话成员视频状态变化事件的监听函数
  22822. *
  22823. * **示例代码**
  22824. *
  22825. * ```js
  22826. const listener = function (res) { console.log(res) }
  22827. wx.onVoIPVideoMembersChanged(listener)
  22828. wx.offVoIPVideoMembersChanged(listener) // 需传入与监听时同一个的函数对象
  22829. ``` */
  22830. offVoIPVideoMembersChanged(
  22831. /** onVoIPVideoMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  22832. listener?: OffVoIPVideoMembersChangedCallback
  22833. ): void
  22834. /** [wx.offWifiConnected(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html)
  22835. *
  22836. * 需要基础库: `2.9.0`
  22837. *
  22838. * 在插件中使用:需要基础库 `2.9.1`
  22839. *
  22840. * 移除连接上 Wi-Fi 的事件的监听函数
  22841. *
  22842. * **示例代码**
  22843. *
  22844. * ```js
  22845. const listener = function (res) { console.log(res) }
  22846. wx.onWifiConnected(listener)
  22847. wx.offWifiConnected(listener) // 需传入与监听时同一个的函数对象
  22848. ``` */
  22849. offWifiConnected(
  22850. /** onWifiConnected 传入的监听函数。不传此参数则移除所有监听函数。 */
  22851. listener?: OffWifiConnectedCallback
  22852. ): void
  22853. /** [wx.offWifiConnectedWithPartialInfo(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnectedWithPartialInfo.html)
  22854. *
  22855. * 需要基础库: `2.22.0`
  22856. *
  22857. * 在插件中使用:需要基础库 `2.22.1`
  22858. *
  22859. * 移除连接上 Wi-Fi 的事件的监听函数
  22860. *
  22861. * **示例代码**
  22862. *
  22863. * ```js
  22864. const listener = function (res) { console.log(res) }
  22865. wx.onWifiConnectedWithPartialInfo(listener)
  22866. wx.offWifiConnectedWithPartialInfo(listener) // 需传入与监听时同一个的函数对象
  22867. ``` */
  22868. offWifiConnectedWithPartialInfo(
  22869. /** onWifiConnectedWithPartialInfo 传入的监听函数。不传此参数则移除所有监听函数。 */
  22870. listener?: OffWifiConnectedWithPartialInfoCallback
  22871. ): void
  22872. /** [wx.offWindowResize(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowResize.html)
  22873. *
  22874. * 需要基础库: `2.3.0`
  22875. *
  22876. * 在插件中使用:不支持
  22877. *
  22878. * 移除窗口尺寸变化事件的监听函数
  22879. *
  22880. * **示例代码**
  22881. *
  22882. * ```js
  22883. const listener = function (res) { console.log(res) }
  22884. wx.onWindowResize(listener)
  22885. wx.offWindowResize(listener) // 需传入与监听时同一个的函数对象
  22886. ``` */
  22887. offWindowResize(
  22888. /** onWindowResize 传入的监听函数。不传此参数则移除所有监听函数。 */
  22889. listener?: OffWindowResizeCallback
  22890. ): void
  22891. /** [wx.onAccelerometerChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html)
  22892. *
  22893. * 在插件中使用:不支持
  22894. *
  22895. * 监听加速度数据事件。频率根据 [wx.startAccelerometer()](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html) 的 interval 参数, 接口调用后会自动开始监听。
  22896. *
  22897. * **示例代码**
  22898. *
  22899. * ```js
  22900. wx.onAccelerometerChange(callback)
  22901. ``` */
  22902. onAccelerometerChange(
  22903. /** 加速度数据事件的监听函数 */
  22904. listener: OnAccelerometerChangeCallback
  22905. ): void
  22906. /** [wx.onAppHide(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html)
  22907. *
  22908. * 需要基础库: `2.1.2`
  22909. *
  22910. * 在插件中使用:不支持
  22911. *
  22912. * 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。 */
  22913. onAppHide(
  22914. /** 小程序切后台事件的监听函数 */
  22915. listener: OnAppHideCallback
  22916. ): void
  22917. /** [wx.onAppShow(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html)
  22918. *
  22919. * 需要基础库: `2.1.2`
  22920. *
  22921. * 在插件中使用:不支持
  22922. *
  22923. * 监听小程序切前台事件。该事件与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onshowobject-object) 的回调参数一致。
  22924. *
  22925. * **返回有效 referrerInfo 的场景**
  22926. *
  22927. * | 场景值 | 场景 | appId含义 |
  22928. * | ------ | ------------------------------- | ---------- |
  22929. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  22930. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  22931. * | 1036 | App 分享消息卡片 | 来源App |
  22932. * | 1037 | 小程序打开小程序 | 来源小程序 |
  22933. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  22934. * | 1043 | 公众号模板消息 | 来源公众号 |
  22935. *
  22936. * **不同 apiCategory 场景下的 API 限制**
  22937. *
  22938. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  22939. *
  22940. * | | default | nativeFunctionalized | browseOnly | embedded |
  22941. * |-|-|-|-|-|
  22942. * |navigateToMiniProgram | | `X` | `X` | |
  22943. * |openSetting | | | `X` | |
  22944. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  22945. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  22946. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  22947. * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
  22948. *
  22949. * **注意**
  22950. *
  22951. * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
  22952. onAppShow(
  22953. /** 小程序切前台事件的监听函数 */
  22954. listener: OnAppShowCallback
  22955. ): void
  22956. /** [wx.onAudioInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)
  22957. *
  22958. * 需要基础库: `2.6.2`
  22959. *
  22960. * 在插件中使用:需要基础库 `2.15.0`
  22961. *
  22962. * 监听音频因为受到系统占用而被中断开始事件。以下场景会触发此事件:闹钟、电话、FaceTime 通话、微信语音聊天、微信视频聊天、有声广告开始播放、实名认证页面弹出等。此事件触发后,小程序内所有音频会暂停。 */
  22963. onAudioInterruptionBegin(
  22964. /** 音频因为受到系统占用而被中断开始事件的监听函数 */
  22965. listener: OnAudioInterruptionBeginCallback
  22966. ): void
  22967. /** [wx.onAudioInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)
  22968. *
  22969. * 需要基础库: `2.6.2`
  22970. *
  22971. * 在插件中使用:需要基础库 `2.15.0`
  22972. *
  22973. * 监听音频中断结束事件。在收到 onAudioInterruptionBegin 事件之后,小程序内所有音频会暂停,收到此事件之后才可再次播放成功 */
  22974. onAudioInterruptionEnd(
  22975. /** 音频中断结束事件的监听函数 */
  22976. listener: OnAudioInterruptionEndCallback
  22977. ): void
  22978. /** [wx.onBLECharacteristicValueChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html)
  22979. *
  22980. * 需要基础库: `1.1.0`
  22981. *
  22982. * 在插件中使用:需要基础库 `2.9.1`
  22983. *
  22984. * 监听蓝牙低功耗设备的特征值变化事件。必须先调用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 接口才能接收到设备推送的 notification。
  22985. *
  22986. * **示例代码**
  22987. *
  22988. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22989. *
  22990. * ```js
  22991. // ArrayBuffer转16进制字符串示例
  22992. function ab2hex(buffer) {
  22993. let hexArr = Array.prototype.map.call(
  22994. new Uint8Array(buffer),
  22995. function(bit) {
  22996. return ('00' + bit.toString(16)).slice(-2)
  22997. }
  22998. )
  22999. return hexArr.join('');
  23000. }
  23001. wx.onBLECharacteristicValueChange(function(res) {
  23002. console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
  23003. console.log(ab2hex(res.value))
  23004. })
  23005. ``` */
  23006. onBLECharacteristicValueChange(
  23007. /** 蓝牙低功耗设备的特征值变化事件的监听函数 */
  23008. listener: OnBLECharacteristicValueChangeCallback
  23009. ): void
  23010. /** [wx.onBLEConnectionStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html)
  23011. *
  23012. * 需要基础库: `1.1.0`
  23013. *
  23014. * 在插件中使用:需要基础库 `2.9.1`
  23015. *
  23016. * 监听蓝牙低功耗连接状态改变事件。包括开发者主动连接或断开连接,设备丢失,连接异常断开等等
  23017. *
  23018. * **示例代码**
  23019. *
  23020. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  23021. * ```js
  23022. wx.onBLEConnectionStateChange(function(res) {
  23023. // 该方法回调中可以用于处理连接意外断开等异常情况
  23024. console.log(`device ${res.deviceId} state has changed, connected: ${res.connected}`)
  23025. })
  23026. ``` */
  23027. onBLEConnectionStateChange(
  23028. /** 蓝牙低功耗连接状态改变事件的监听函数 */
  23029. listener: OnBLEConnectionStateChangeCallback
  23030. ): void
  23031. /** [wx.onBLEMTUChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEMTUChange.html)
  23032. *
  23033. * 需要基础库: `2.20.1`
  23034. *
  23035. * 在插件中使用:需要基础库 `2.20.1`
  23036. *
  23037. * 监听蓝牙低功耗的最大传输单元变化事件(仅安卓触发)。
  23038. *
  23039. * **示例代码**
  23040. *
  23041. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  23042. * ```js
  23043. wx.onBLEMTUChange(function (res) {
  23044. console.log('bluetooth mtu is', res.mtu)
  23045. })
  23046. ``` */
  23047. onBLEMTUChange(
  23048. /** 蓝牙低功耗的最大传输单元变化事件的监听函数 */
  23049. listener: OnBLEMTUChangeCallback
  23050. ): void
  23051. /** [wx.onBLEPeripheralConnectionStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html)
  23052. *
  23053. * 需要基础库: `2.10.3`
  23054. *
  23055. * 在插件中使用:需要基础库 `2.22.1`
  23056. *
  23057. * 监听当前外围设备被连接或断开连接事件 */
  23058. onBLEPeripheralConnectionStateChanged(
  23059. /** 当前外围设备被连接或断开连接事件的监听函数 */
  23060. listener: OnBLEPeripheralConnectionStateChangedCallback
  23061. ): void
  23062. /** [wx.onBackgroundAudioPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html)
  23063. *
  23064. * 在插件中使用:不支持
  23065. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  23066. *
  23067. * 监听音乐暂停事件。 */
  23068. onBackgroundAudioPause(
  23069. /** 音乐暂停事件的监听函数 */
  23070. listener: OnBackgroundAudioPauseCallback
  23071. ): void
  23072. /** [wx.onBackgroundAudioPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPlay.html)
  23073. *
  23074. * 在插件中使用:不支持
  23075. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  23076. *
  23077. * 监听音乐播放事件。 */
  23078. onBackgroundAudioPlay(
  23079. /** 音乐播放事件的监听函数 */
  23080. listener: OnBackgroundAudioPlayCallback
  23081. ): void
  23082. /** [wx.onBackgroundAudioStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioStop.html)
  23083. *
  23084. * 在插件中使用:不支持
  23085. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  23086. *
  23087. * 监听音乐停止事件。 */
  23088. onBackgroundAudioStop(
  23089. /** 音乐停止事件的监听函数 */
  23090. listener: OnBackgroundAudioStopCallback
  23091. ): void
  23092. /** [wx.onBackgroundFetchData(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html)
  23093. *
  23094. * 需要基础库: `2.8.0`
  23095. *
  23096. * 在插件中使用:不支持
  23097. *
  23098. * 监听收到 backgroundFetch 数据事件。如果监听时请求已经完成,则事件不会触发。建议和 [wx.getBackgroundFetchData](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html) 配合使用 */
  23099. onBackgroundFetchData(
  23100. /** 收到 backgroundFetch 数据事件的监听函数 */
  23101. listener: OnBackgroundFetchDataCallback
  23102. ): void
  23103. /** [wx.onBeaconServiceChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html)
  23104. *
  23105. * 需要基础库: `1.2.0`
  23106. *
  23107. * 在插件中使用:需要基础库 `1.9.6`
  23108. *
  23109. * 监听 Beacon 服务状态变化事件,仅能注册一个监听 */
  23110. onBeaconServiceChange(
  23111. /** Beacon 服务状态变化事件的监听函数 */
  23112. listener: OnBeaconServiceChangeCallback
  23113. ): void
  23114. /** [wx.onBeaconUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html)
  23115. *
  23116. * 需要基础库: `1.2.0`
  23117. *
  23118. * 在插件中使用:需要基础库 `1.9.6`
  23119. *
  23120. * 监听 Beacon 设备更新事件,仅能注册一个监听 */
  23121. onBeaconUpdate(
  23122. /** Beacon 设备更新事件的监听函数 */
  23123. listener: OnBeaconUpdateCallback
  23124. ): void
  23125. /** [wx.onBluetoothAdapterStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html)
  23126. *
  23127. * 需要基础库: `1.1.0`
  23128. *
  23129. * 在插件中使用:需要基础库 `2.9.1`
  23130. *
  23131. * 监听蓝牙适配器状态变化事件
  23132. *
  23133. * **示例代码**
  23134. *
  23135. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  23136. * ```js
  23137. wx.onBluetoothAdapterStateChange(function (res) {
  23138. console.log('adapterState changed, now is', res)
  23139. })
  23140. ``` */
  23141. onBluetoothAdapterStateChange(
  23142. /** 蓝牙适配器状态变化事件的监听函数 */
  23143. listener: OnBluetoothAdapterStateChangeCallback
  23144. ): void
  23145. /** [wx.onBluetoothDeviceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html)
  23146. *
  23147. * 需要基础库: `1.1.0`
  23148. *
  23149. * 在插件中使用:需要基础库 `2.9.1`
  23150. *
  23151. * 监听搜索到新设备的事件
  23152. *
  23153. * **注意**
  23154. *
  23155. * - 若在 [wx.onBluetoothDeviceFound](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html) 回调了某个设备,则此设备会添加到 [wx.getBluetoothDevices](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html) 接口获取到的数组中。
  23156. *
  23157. * **示例代码**
  23158. *
  23159. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  23160. *
  23161. * ```js
  23162. // ArrayBuffer转16进度字符串示例
  23163. function ab2hex(buffer) {
  23164. var hexArr = Array.prototype.map.call(
  23165. new Uint8Array(buffer),
  23166. function(bit) {
  23167. return ('00' + bit.toString(16)).slice(-2)
  23168. }
  23169. )
  23170. return hexArr.join('');
  23171. }
  23172. wx.onBluetoothDeviceFound(function(res) {
  23173. var devices = res.devices;
  23174. console.log('new device list has founded')
  23175. console.dir(devices)
  23176. console.log(ab2hex(devices[0].advertisData))
  23177. })
  23178. ```
  23179. *
  23180. * **注意**
  23181. *
  23182. * - 蓝牙设备在被搜索到时,系统返回的 `name` 字段一般为广播包中的 `LocalName` 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 `name` 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
  23183. * - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限 */
  23184. onBluetoothDeviceFound(
  23185. /** 搜索到新设备的事件的监听函数 */
  23186. listener: OnBluetoothDeviceFoundCallback
  23187. ): void
  23188. /** [wx.onCompassChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html)
  23189. *
  23190. * 在插件中使用:不支持
  23191. *
  23192. * 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 wx.stopCompass 停止监听。
  23193. *
  23194. * **accuracy 在 iOS/Android 的差异**
  23195. *
  23196. * 由于平台差异,accuracy 在 iOS/Android 的值不同。
  23197. *
  23198. * - iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
  23199. * - Android:accuracy 是一个 string 类型的枚举值。
  23200. *
  23201. * | 值 | 说明 |
  23202. * | --------------- | -------------------------------------------------------------------------------------- |
  23203. * | high | 高精度 |
  23204. * | medium | 中等精度 |
  23205. * | low | 低精度 |
  23206. * | no-contact | 不可信,传感器失去连接 |
  23207. * | unreliable | 不可信,原因未知 |
  23208. * | unknow ${value} | 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值 | */
  23209. onCompassChange(
  23210. /** 罗盘数据变化事件的监听函数 */
  23211. listener: OnCompassChangeCallback
  23212. ): void
  23213. /** [wx.onCopyUrl(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.onCopyUrl.html)
  23214. *
  23215. * 需要基础库: `2.14.3`
  23216. *
  23217. * 在插件中使用:不支持
  23218. *
  23219. * 监听用户点击右上角菜单的「复制链接」按钮时触发的事件。本接口为 Beta 版本,暂只在 Android 平台支持。 */
  23220. onCopyUrl(
  23221. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的监听函数 */
  23222. listener: OnCopyUrlCallback
  23223. ): void
  23224. /** [wx.onDeviceMotionChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html)
  23225. *
  23226. * 需要基础库: `2.3.0`
  23227. *
  23228. * 在插件中使用:不支持
  23229. *
  23230. * 监听设备方向变化事件。频率根据 [wx.startDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html) 的 interval 参数。可以使用 [wx.stopDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html) 停止监听。 */
  23231. onDeviceMotionChange(
  23232. /** 设备方向变化事件的监听函数 */
  23233. listener: OnDeviceMotionChangeCallback
  23234. ): void
  23235. /** [wx.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html)
  23236. *
  23237. * 需要基础库: `2.1.2`
  23238. *
  23239. * 在插件中使用:不支持
  23240. *
  23241. * 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。 */
  23242. onError(
  23243. /** 小程序错误事件的监听函数 */
  23244. listener: WxOnErrorCallback
  23245. ): void
  23246. /** [wx.onGetWifiList(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html)
  23247. *
  23248. * 需要基础库: `1.6.0`
  23249. *
  23250. * 在插件中使用:需要基础库 `2.9.1`
  23251. *
  23252. * 监听获取到 Wi-Fi 列表数据事件 */
  23253. onGetWifiList(
  23254. /** 获取到 Wi-Fi 列表数据事件的监听函数 */
  23255. listener: OnGetWifiListCallback
  23256. ): void
  23257. /** [wx.onGyroscopeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html)
  23258. *
  23259. * 需要基础库: `2.3.0`
  23260. *
  23261. * 在插件中使用:需要基础库 `2.9.1`
  23262. *
  23263. * 监听陀螺仪数据变化事件。频率根据 [wx.startGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html) 的 interval 参数。可以使用 [wx.stopGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html) 停止监听。 */
  23264. onGyroscopeChange(
  23265. /** 陀螺仪数据变化事件的监听函数 */
  23266. listener: OnGyroscopeChangeCallback
  23267. ): void
  23268. /** [wx.onHCEMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.onHCEMessage.html)
  23269. *
  23270. * 需要基础库: `1.7.0`
  23271. *
  23272. * 在插件中使用:需要基础库 `2.9.1`
  23273. *
  23274. * 监听接收 NFC 设备消息事件。仅能注册一个监听 */
  23275. onHCEMessage(
  23276. /** 接收 NFC 设备消息事件的监听函数 */
  23277. listener: OnHCEMessageCallback
  23278. ): void
  23279. /** [wx.onKeyboardHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyboardHeightChange.html)
  23280. *
  23281. * 需要基础库: `2.7.0`
  23282. *
  23283. * 在插件中使用:不支持
  23284. *
  23285. * 监听键盘高度变化事件
  23286. *
  23287. * **示例代码**
  23288. *
  23289. * ```js
  23290. wx.onKeyboardHeightChange(res => {
  23291. console.log(res.height)
  23292. })
  23293. ``` */
  23294. onKeyboardHeightChange(
  23295. /** 键盘高度变化事件的监听函数 */
  23296. listener: OnKeyboardHeightChangeCallback
  23297. ): void
  23298. /** [wx.onLazyLoadError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onLazyLoadError.html)
  23299. *
  23300. * 需要基础库: `2.24.3`
  23301. *
  23302. * 在插件中使用:不支持
  23303. *
  23304. * 监听小程序异步组件加载失败事件。
  23305. *
  23306. * **注意**
  23307. *
  23308. * - 加载异步组件通常需要下载分包,若分包下载超时,则会触发 errMsg 为 "loadSubpackage: timeout" 的回调,默认超时等待时间为 5 秒。
  23309. * - 可以通过第二个参数指定超时时间(单位:ms),该设置全局有效,多次指定超时时间则覆盖前面。
  23310. * - 分包确认下载失败时,会再次触发 errMsg 为 "loadSubpackage: fail" 的回调。
  23311. * - 若在页面中使用该接口进行监听,请确保在必要时手动调用 offLazyLoadError 取消监听,以避免非预期的内存泄漏。 */
  23312. onLazyLoadError(
  23313. /** 小程序异步组件加载失败事件的监听函数 */
  23314. listener: OnLazyLoadErrorCallback
  23315. ): void
  23316. /** [wx.onLocalServiceDiscoveryStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceDiscoveryStop.html)
  23317. *
  23318. * 需要基础库: `2.4.0`
  23319. *
  23320. * 在插件中使用:需要基础库 `2.15.0`
  23321. *
  23322. * 监听 mDNS 服务停止搜索的事件 */
  23323. onLocalServiceDiscoveryStop(
  23324. /** mDNS 服务停止搜索的事件的监听函数 */
  23325. listener: OnLocalServiceDiscoveryStopCallback
  23326. ): void
  23327. /** [wx.onLocalServiceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceFound.html)
  23328. *
  23329. * 需要基础库: `2.4.0`
  23330. *
  23331. * 在插件中使用:需要基础库 `2.15.0`
  23332. *
  23333. * 监听 mDNS 服务发现的事件 */
  23334. onLocalServiceFound(
  23335. /** mDNS 服务发现的事件的监听函数 */
  23336. listener: OnLocalServiceFoundCallback
  23337. ): void
  23338. /** [wx.onLocalServiceLost(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceLost.html)
  23339. *
  23340. * 需要基础库: `2.4.0`
  23341. *
  23342. * 在插件中使用:需要基础库 `2.15.0`
  23343. *
  23344. * 监听 mDNS 服务离开的事件 */
  23345. onLocalServiceLost(
  23346. /** mDNS 服务离开的事件的监听函数 */
  23347. listener: OnLocalServiceLostCallback
  23348. ): void
  23349. /** [wx.onLocalServiceResolveFail(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceResolveFail.html)
  23350. *
  23351. * 需要基础库: `2.4.0`
  23352. *
  23353. * 在插件中使用:需要基础库 `2.15.0`
  23354. *
  23355. * 监听 mDNS 服务解析失败的事件 */
  23356. onLocalServiceResolveFail(
  23357. /** mDNS 服务解析失败的事件的监听函数 */
  23358. listener: OnLocalServiceResolveFailCallback
  23359. ): void
  23360. /** [wx.onLocationChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html)
  23361. *
  23362. * 需要基础库: `2.8.1`
  23363. *
  23364. * 在插件中使用:不支持
  23365. *
  23366. * 监听实时地理位置变化事件,需结合 [wx.startLocationUpdateBackground](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html)、[wx.startLocationUpdate](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html)使用。
  23367. *
  23368. * ## 使用方法
  23369. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  23370. *
  23371. * ## 申请开通
  23372. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  23373. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  23374. *
  23375. * ### 国内主体开放类目
  23376. *
  23377. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  23378. * | -------------- | -------| -------- |
  23379. * | 电商平台 | / | 售卖商品线下发货、收货、送货服务 |
  23380. * | 商家自营 | / | 提供售卖商品线下发货、收货、送货服务、线下商超导览、导航服务 |
  23381. * | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
  23382. * | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
  23383. * | 生活服务 | / | 上门服务作业等线下场景 |
  23384. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
  23385. * | 餐饮服务 | 点餐平台、外卖平台 | 线下送餐服务 |
  23386. * | 工具 | 天气、信息查询 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询等 |
  23387. * | 金融 | 保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
  23388. * | 旅游 | 景区服务 | 提供景区导航、导览服务 |
  23389. * | 政务民生 | / | 提供政务单位相关业务 |
  23390. * | 政府主体帐号 | / | 提供政务单位相关业务 |
  23391. *
  23392. * ### 海外主体开放类目
  23393. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  23394. * | -------------- | -------| -------- |
  23395. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  23396. * | 快递业与邮政 | / | 快递/货物收发服务 |
  23397. * | 餐饮 | / | 线下送餐服务 |
  23398. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  23399. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  23400. * | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
  23401. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货/超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  23402. * | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
  23403. *
  23404. * **示例代码**
  23405. *
  23406. * ```js
  23407. const _locationChangeFn = function(res) {
  23408. console.log('location change', res)
  23409. }
  23410. wx.onLocationChange(_locationChangeFn)
  23411. wx.offLocationChange(_locationChangeFn)
  23412. ``` */
  23413. onLocationChange(
  23414. /** 实时地理位置变化事件的监听函数 */
  23415. listener: OnLocationChangeCallback
  23416. ): void
  23417. /** [wx.onLocationChangeError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChangeError.html)
  23418. *
  23419. * 需要基础库: `2.19.5`
  23420. *
  23421. * 在插件中使用:不支持
  23422. *
  23423. * 监听持续定位接口返回失败时触发。 */
  23424. onLocationChangeError(
  23425. /** 的监听函数 */
  23426. listener: OnLocationChangeErrorCallback
  23427. ): void
  23428. /** [wx.onMemoryWarning(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.onMemoryWarning.html)
  23429. *
  23430. * 需要基础库: `2.0.2`
  23431. *
  23432. * 在插件中使用:不支持
  23433. *
  23434. * 监听内存不足告警事件。
  23435. *
  23436. * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
  23437. *
  23438. * **示例代码**
  23439. *
  23440. * ```js
  23441. * wx.onMemoryWarning(function () {
  23442. * console.log('onMemoryWarningReceive')
  23443. * })
  23444. * `` */
  23445. onMemoryWarning(
  23446. /** 内存不足告警事件的监听函数 */
  23447. listener: OnMemoryWarningCallback
  23448. ): void
  23449. /** [wx.onNetworkStatusChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html)
  23450. *
  23451. * 需要基础库: `1.1.0`
  23452. *
  23453. * 在插件中使用:支持
  23454. *
  23455. * 监听网络状态变化事件
  23456. *
  23457. * **示例代码**
  23458. *
  23459. * ```js
  23460. wx.onNetworkStatusChange(function (res) {
  23461. console.log(res.isConnected)
  23462. console.log(res.networkType)
  23463. })
  23464. ``` */
  23465. onNetworkStatusChange(
  23466. /** 网络状态变化事件的监听函数 */
  23467. listener: OnNetworkStatusChangeCallback
  23468. ): void
  23469. /** [wx.onNetworkWeakChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkWeakChange.html)
  23470. *
  23471. * 需要基础库: `2.21.0`
  23472. *
  23473. * 在插件中使用:不支持
  23474. *
  23475. * 监听弱网状态变化事件
  23476. *
  23477. * **示例代码**
  23478. *
  23479. * ```js
  23480. wx.onNetworkWeakChange(function (res) {
  23481. console.log(res.weakNet)
  23482. console.log(res.networkType)
  23483. })
  23484. // 取消监听
  23485. wx.offNetworkWeakChange()
  23486. ``` */
  23487. onNetworkWeakChange(
  23488. /** 弱网状态变化事件的监听函数 */
  23489. listener: OnNetworkWeakChangeCallback
  23490. ): void
  23491. /** [wx.onPageNotFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html)
  23492. *
  23493. * 需要基础库: `2.1.2`
  23494. *
  23495. * 在插件中使用:不支持
  23496. *
  23497. * 监听小程序要打开的页面不存在事件。该事件与 [`App.onPageNotFound`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onpagenotfoundobject-object) 的回调时机一致。
  23498. *
  23499. * **注意**
  23500. *
  23501. * - 开发者可以在回调中进行页面重定向,但必须在回调中**同步**处理,异步处理(例如 `setTimeout` 异步执行)无效。
  23502. * - 若开发者没有调用 [wx.onPageNotFound](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
  23503. * - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。 */
  23504. onPageNotFound(
  23505. /** 小程序要打开的页面不存在事件的监听函数 */
  23506. listener: OnPageNotFoundCallback
  23507. ): void
  23508. /** [wx.onScreenRecordingStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html)
  23509. *
  23510. * 需要基础库: `2.24.0`
  23511. *
  23512. * 在插件中使用:不支持
  23513. *
  23514. * 监听用户录屏事件。 */
  23515. onScreenRecordingStateChanged(
  23516. /** 用户录屏事件的监听函数 */
  23517. listener: OnScreenRecordingStateChangedCallback
  23518. ): void
  23519. /** [wx.onSocketClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketClose.html)
  23520. *
  23521. * 在插件中使用:不支持
  23522. *
  23523. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  23524. *
  23525. * 监听 WebSocket 连接关闭事件。 */
  23526. onSocketClose(
  23527. /** WebSocket 连接关闭事件的监听函数 */
  23528. listener: OnSocketCloseCallback
  23529. ): void
  23530. /** [wx.onSocketError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketError.html)
  23531. *
  23532. * 在插件中使用:不支持
  23533. *
  23534. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  23535. *
  23536. * 监听 WebSocket 错误事件。 */
  23537. onSocketError(
  23538. /** WebSocket 错误事件的监听函数 */
  23539. listener: OnSocketErrorCallback
  23540. ): void
  23541. /** [wx.onSocketMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketMessage.html)
  23542. *
  23543. * 在插件中使用:不支持
  23544. *
  23545. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  23546. *
  23547. * 监听 WebSocket 接受到服务器的消息事件。 */
  23548. onSocketMessage(
  23549. /** WebSocket 接受到服务器的消息事件的监听函数 */
  23550. listener: OnSocketMessageCallback
  23551. ): void
  23552. /** [wx.onSocketOpen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketOpen.html)
  23553. *
  23554. * 在插件中使用:不支持
  23555. *
  23556. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  23557. *
  23558. * 监听 WebSocket 连接打开事件。 */
  23559. onSocketOpen(
  23560. /** WebSocket 连接打开事件的监听函数 */
  23561. listener: OnSocketOpenCallback
  23562. ): void
  23563. /** [wx.onThemeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html)
  23564. *
  23565. * 需要基础库: `2.11.0`
  23566. *
  23567. * 在插件中使用:不支持
  23568. *
  23569. * 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。
  23570. *
  23571. * **注意**
  23572. *
  23573. * - 只有在全局配置"darkmode": true时才会触发此事件。 */
  23574. onThemeChange(
  23575. /** 系统主题改变事件的监听函数 */
  23576. listener: OnThemeChangeCallback
  23577. ): void
  23578. /** [wx.onUnhandledRejection(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)
  23579. *
  23580. * 需要基础库: `2.10.0`
  23581. *
  23582. * 在插件中使用:不支持
  23583. *
  23584. * 监听未处理的 Promise 拒绝事件。该事件与 [`App.onUnhandledRejection`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onUnhandledRejection-Object-object) 的回调时机与参数一致。
  23585. *
  23586. * **注意**
  23587. *
  23588. * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。 */
  23589. onUnhandledRejection(
  23590. /** 未处理的 Promise 拒绝事件的监听函数 */
  23591. listener: OnUnhandledRejectionCallback
  23592. ): void
  23593. /** [wx.onUserCaptureScreen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onUserCaptureScreen.html)
  23594. *
  23595. * 需要基础库: `1.4.0`
  23596. *
  23597. * 在插件中使用:不支持
  23598. *
  23599. * 监听用户主动截屏事件。用户使用系统截屏按键截屏时触发,只能注册一个监听
  23600. *
  23601. * **示例代码**
  23602. *
  23603. * ```js
  23604. wx.onUserCaptureScreen(function (res) {
  23605. console.log('用户截屏了')
  23606. })
  23607. ``` */
  23608. onUserCaptureScreen(
  23609. /** 用户主动截屏事件的监听函数 */
  23610. listener: OnUserCaptureScreenCallback
  23611. ): void
  23612. /** [wx.onVoIPChatInterrupted(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatInterrupted.html)
  23613. *
  23614. * 需要基础库: `2.7.0`
  23615. *
  23616. * 在插件中使用:需要基础库 `2.9.1`
  23617. *
  23618. * 监听被动断开实时语音通话事件。包括小游戏切入后端时断开 */
  23619. onVoIPChatInterrupted(
  23620. /** 被动断开实时语音通话事件的监听函数 */
  23621. listener: OnVoIPChatInterruptedCallback
  23622. ): void
  23623. /** [wx.onVoIPChatMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatMembersChanged.html)
  23624. *
  23625. * 需要基础库: `2.7.0`
  23626. *
  23627. * 在插件中使用:需要基础库 `2.9.1`
  23628. *
  23629. * 监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调 */
  23630. onVoIPChatMembersChanged(
  23631. /** 实时语音通话成员在线状态变化事件的监听函数 */
  23632. listener: OnVoIPChatMembersChangedCallback
  23633. ): void
  23634. /** [wx.onVoIPChatSpeakersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatSpeakersChanged.html)
  23635. *
  23636. * 需要基础库: `2.7.0`
  23637. *
  23638. * 在插件中使用:需要基础库 `2.9.1`
  23639. *
  23640. * 监听实时语音通话成员通话状态变化事件。有成员开始/停止说话时触发回调 */
  23641. onVoIPChatSpeakersChanged(
  23642. /** 实时语音通话成员通话状态变化事件的监听函数 */
  23643. listener: OnVoIPChatSpeakersChangedCallback
  23644. ): void
  23645. /** [wx.onVoIPChatStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatStateChanged.html)
  23646. *
  23647. * 需要基础库: `2.16.0`
  23648. *
  23649. * 在插件中使用:不支持
  23650. *
  23651. * 监听房间状态变化事件。 */
  23652. onVoIPChatStateChanged(
  23653. /** 房间状态变化事件的监听函数 */
  23654. listener: OnVoIPChatStateChangedCallback
  23655. ): void
  23656. /** [wx.onVoIPVideoMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html)
  23657. *
  23658. * 需要基础库: `2.11.0`
  23659. *
  23660. * 在插件中使用:不支持
  23661. *
  23662. * 监听实时语音通话成员视频状态变化事件。 */
  23663. onVoIPVideoMembersChanged(
  23664. /** 实时语音通话成员视频状态变化事件的监听函数 */
  23665. listener: OnVoIPVideoMembersChangedCallback
  23666. ): void
  23667. /** [wx.onWifiConnected(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html)
  23668. *
  23669. * 需要基础库: `1.6.0`
  23670. *
  23671. * 在插件中使用:需要基础库 `2.9.1`
  23672. *
  23673. * 监听连接上 Wi-Fi 的事件 */
  23674. onWifiConnected(
  23675. /** 连接上 Wi-Fi 的事件的监听函数 */
  23676. listener: OnWifiConnectedCallback
  23677. ): void
  23678. /** [wx.onWifiConnectedWithPartialInfo(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnectedWithPartialInfo.html)
  23679. *
  23680. * 需要基础库: `2.22.0`
  23681. *
  23682. * 在插件中使用:需要基础库 `2.22.1`
  23683. *
  23684. * 监听连接上 Wi-Fi 的事件 */
  23685. onWifiConnectedWithPartialInfo(
  23686. /** 连接上 Wi-Fi 的事件的监听函数 */
  23687. listener: OnWifiConnectedWithPartialInfoCallback
  23688. ): void
  23689. /** [wx.onWindowResize(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowResize.html)
  23690. *
  23691. * 需要基础库: `2.3.0`
  23692. *
  23693. * 在插件中使用:不支持
  23694. *
  23695. * 监听窗口尺寸变化事件 */
  23696. onWindowResize(
  23697. /** 窗口尺寸变化事件的监听函数 */
  23698. listener: OnWindowResizeCallback
  23699. ): void
  23700. /** [wx.openAppAuthorizeSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html)
  23701. *
  23702. * 需要基础库: `2.20.1`
  23703. *
  23704. * 在插件中使用:需要基础库 `2.21.3`
  23705. *
  23706. * 跳转系统微信授权管理页
  23707. *
  23708. * **示例代码**
  23709. *
  23710. * ```js
  23711. wx.openAppAuthorizeSetting({
  23712. success (res) {
  23713. console.log(res)
  23714. }
  23715. })
  23716. ``` */
  23717. openAppAuthorizeSetting<
  23718. T extends OpenAppAuthorizeSettingOption = OpenAppAuthorizeSettingOption
  23719. >(
  23720. option?: T
  23721. ): PromisifySuccessResult<T, OpenAppAuthorizeSettingOption>
  23722. /** [wx.openBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html)
  23723. *
  23724. * 需要基础库: `1.1.0`
  23725. *
  23726. * 在插件中使用:需要基础库 `1.9.6`
  23727. *
  23728. * 初始化蓝牙模块。iOS 上开启主机/从机(外围设备)模式时需分别调用一次,并指定对应的 `mode`。
  23729. *
  23730. * **object.fail 回调函数返回的 state 参数(仅 iOS)**
  23731. *
  23732. * | 状态码 | 说明 |
  23733. * | ------ | ------ |
  23734. * | 0 | 未知 |
  23735. * | 1 | 重置中 |
  23736. * | 2 | 不支持 |
  23737. * | 3 | 未授权 |
  23738. * | 4 | 未开启 |
  23739. *
  23740. * **注意**
  23741. *
  23742. * - 其他蓝牙相关 API 必须在 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 调用之后使用。否则 API 会返回错误(errCode=10000)。
  23743. * - 在用户蓝牙开关未开启或者手机不支持蓝牙功能的情况下,调用 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 会返回错误(errCode=10001),表示手机蓝牙功能不可用。此时小程序蓝牙模块已经初始化完成,可通过 [wx.onBluetoothAdapterStateChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html) 监听手机蓝牙状态的改变,也可以调用蓝牙模块的所有API。
  23744. *
  23745. * **示例代码**
  23746. *
  23747. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  23748. * ```js
  23749. wx.openBluetoothAdapter({
  23750. success (res) {
  23751. console.log(res)
  23752. }
  23753. })
  23754. ``` */
  23755. openBluetoothAdapter<
  23756. T extends OpenBluetoothAdapterOption = OpenBluetoothAdapterOption
  23757. >(
  23758. option?: T
  23759. ): PromisifySuccessResult<T, OpenBluetoothAdapterOption>
  23760. /** [wx.openCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.openCard.html)
  23761. *
  23762. * 需要基础库: `1.1.0`
  23763. *
  23764. * 在插件中使用:不支持
  23765. *
  23766. * 查看微信卡包中的卡券。只有通过 [认证](https://developers.weixin.qq.com/miniprogram/product/renzheng.html) 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 [微信卡券接口文档](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1490190158&version=1&lang=zh_CN&platform=2)。
  23767. *
  23768. * **示例代码**
  23769. *
  23770. * ```js
  23771. wx.openCard({
  23772. cardList: [{
  23773. cardId: '',
  23774. code: ''
  23775. }, {
  23776. cardId: '',
  23777. code: ''
  23778. }],
  23779. success (res) { }
  23780. })
  23781. ``` */
  23782. openCard<T extends OpenCardOption = OpenCardOption>(
  23783. option: T
  23784. ): PromisifySuccessResult<T, OpenCardOption>
  23785. /** [wx.openChannelsActivity(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsActivity.html)
  23786. *
  23787. * 需要基础库: `2.19.2`
  23788. *
  23789. * 在插件中使用:不支持
  23790. *
  23791. * 打开视频号视频 */
  23792. openChannelsActivity(option: OpenChannelsActivityOption): void
  23793. /** [wx.openChannelsEvent(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsEvent.html)
  23794. *
  23795. * 需要基础库: `2.21.0`
  23796. *
  23797. * 在插件中使用:不支持
  23798. *
  23799. * 打开视频号活动页 */
  23800. openChannelsEvent(option: OpenChannelsEventOption): void
  23801. /** [wx.openChannelsLive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsLive.html)
  23802. *
  23803. * 需要基础库: `2.15.0`
  23804. *
  23805. * 在插件中使用:不支持
  23806. *
  23807. * 打开视频号直播 */
  23808. openChannelsLive(option: OpenChannelsLiveOption): void
  23809. /** [wx.openChannelsUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsUserProfile.html)
  23810. *
  23811. * 需要基础库: `2.21.2`
  23812. *
  23813. * 在插件中使用:不支持
  23814. *
  23815. * 打开视频号主页 */
  23816. openChannelsUserProfile(option: OpenChannelsUserProfileOption): void
  23817. /** [wx.openCustomerServiceChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/service-chat/wx.openCustomerServiceChat.html)
  23818. *
  23819. * 需要基础库: `2.19.0`
  23820. *
  23821. * 在插件中使用:不支持
  23822. *
  23823. * 打开微信客服,页面产生点击事件(例如 button 上 bindtap 的回调中)后才可调用。了解更多信息,可以参考[微信客服介绍](https://work.weixin.qq.com/kf/)。
  23824. *
  23825. * **示例代码**
  23826. *
  23827. * ```js
  23828. wx.openCustomerServiceChat({
  23829. extInfo: {url: ''},
  23830. corpId: '',
  23831. success(res) {}
  23832. })
  23833. ``` */
  23834. openCustomerServiceChat(option: OpenCustomerServiceChatOption): void
  23835. /** [wx.openDocument(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html)
  23836. *
  23837. * 在插件中使用:需要基础库 `2.15.0`
  23838. *
  23839. * 新开页面打开文档。微信客户端 `7.0.12` 版本前默认显示右上角菜单按钮,之后的版本默认不显示,需主动传入 `showMenu`。 */
  23840. openDocument<T extends OpenDocumentOption = OpenDocumentOption>(
  23841. option: T
  23842. ): PromisifySuccessResult<T, OpenDocumentOption>
  23843. /** [wx.openEmbeddedMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.openEmbeddedMiniProgram.html)
  23844. *
  23845. * 需要基础库: `2.20.1`
  23846. *
  23847. * 在插件中使用:需要基础库 `2.26.2`
  23848. *
  23849. * 打开半屏小程序。接入指引请参考 [半屏小程序能力](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/openEmbeddedMiniProgram.html)。 */
  23850. openEmbeddedMiniProgram<
  23851. T extends OpenEmbeddedMiniProgramOption = OpenEmbeddedMiniProgramOption
  23852. >(
  23853. option: T
  23854. ): PromisifySuccessResult<T, OpenEmbeddedMiniProgramOption>
  23855. /** [wx.openLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html)
  23856. *
  23857. * 在插件中使用:需要基础库 `1.9.6`
  23858. *
  23859. * 使用微信内置地图查看位置
  23860. *
  23861. * **示例代码**
  23862. *
  23863. * ```js
  23864. wx.getLocation({
  23865. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  23866. success (res) {
  23867. const latitude = res.latitude
  23868. const longitude = res.longitude
  23869. wx.openLocation({
  23870. latitude,
  23871. longitude,
  23872. scale: 18
  23873. })
  23874. }
  23875. })
  23876. ``` */
  23877. openLocation<T extends OpenLocationOption = OpenLocationOption>(
  23878. option: T
  23879. ): PromisifySuccessResult<T, OpenLocationOption>
  23880. /** [wx.openSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html)
  23881. *
  23882. * 需要基础库: `1.1.0`
  23883. *
  23884. * 在插件中使用:需要基础库 `2.10.3`
  23885. *
  23886. * 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
  23887. *
  23888. * ****
  23889. *
  23890. * - 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
  23891. *
  23892. * **示例代码**
  23893. *
  23894. * ```js
  23895. wx.openSetting({
  23896. success (res) {
  23897. console.log(res.authSetting)
  23898. // res.authSetting = {
  23899. // "scope.userInfo": true,
  23900. // "scope.userLocation": true
  23901. // }
  23902. }
  23903. })
  23904. ``` */
  23905. openSetting<T extends OpenSettingOption = OpenSettingOption>(
  23906. option?: T
  23907. ): PromisifySuccessResult<T, OpenSettingOption>
  23908. /** [wx.openSystemBluetoothSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openSystemBluetoothSetting.html)
  23909. *
  23910. * 需要基础库: `2.20.1`
  23911. *
  23912. * 在插件中使用:需要基础库 `2.21.3`
  23913. *
  23914. * 跳转系统蓝牙设置页。仅支持安卓。
  23915. *
  23916. * **示例代码**
  23917. *
  23918. * ```js
  23919. wx.openSystemBluetoothSetting({
  23920. success (res) {
  23921. console.log(res)
  23922. }
  23923. })
  23924. ``` */
  23925. openSystemBluetoothSetting<
  23926. T extends OpenSystemBluetoothSettingOption = OpenSystemBluetoothSettingOption
  23927. >(
  23928. option?: T
  23929. ): PromisifySuccessResult<T, OpenSystemBluetoothSettingOption>
  23930. /** [wx.openVideoEditor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.openVideoEditor.html)
  23931. *
  23932. * 需要基础库: `2.12.0`
  23933. *
  23934. * 在插件中使用:需要基础库 `2.15.0`
  23935. *
  23936. * 打开视频编辑器 */
  23937. openVideoEditor(option: OpenVideoEditorOption): void
  23938. /** [wx.pageScrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html)
  23939. *
  23940. * 需要基础库: `1.4.0`
  23941. *
  23942. * 在插件中使用:需要基础库 `2.1.0`
  23943. *
  23944. * 在插件中使用时,只能在当前插件的页面中调用
  23945. *
  23946. * 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
  23947. *
  23948. * **selector 语法**
  23949. *
  23950. * selector类似于 CSS 的选择器,但仅支持下列语法。
  23951. *
  23952. * + ID选择器:#the-id
  23953. * + class选择器(可以连续指定多个):.a-class.another-class
  23954. * + 子元素选择器:.the-parent > .the-child
  23955. * + 后代选择器:.the-ancestor .the-descendant
  23956. * + 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  23957. * + 多选择器的并集:#a-node, .some-other-nodes
  23958. *
  23959. * **示例代码**
  23960. *
  23961. * ```js
  23962. wx.pageScrollTo({
  23963. scrollTop: 0,
  23964. duration: 300
  23965. })
  23966. ``` */
  23967. pageScrollTo<T extends PageScrollToOption = PageScrollToOption>(
  23968. option: T
  23969. ): PromisifySuccessResult<T, PageScrollToOption>
  23970. /** [wx.pauseBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.pauseBackgroundAudio.html)
  23971. *
  23972. * 在插件中使用:需要基础库 `1.9.6`
  23973. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  23974. *
  23975. * 暂停播放音乐。
  23976. *
  23977. * **示例代码**
  23978. *
  23979. * ```js
  23980. wx.pauseBackgroundAudio()
  23981. ``` */
  23982. pauseBackgroundAudio<
  23983. T extends PauseBackgroundAudioOption = PauseBackgroundAudioOption
  23984. >(
  23985. option?: T
  23986. ): PromisifySuccessResult<T, PauseBackgroundAudioOption>
  23987. /** [wx.pauseVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.pauseVoice.html)
  23988. *
  23989. * 在插件中使用:需要基础库 `1.9.6`
  23990. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  23991. *
  23992. * 暂停正在播放的语音。再次调用 [wx.playVoice](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html) 播放同一个文件时,会从暂停处开始播放。如果想从头开始播放,需要先调用 [wx.stopVoice](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html)。
  23993. *
  23994. * **示例代码**
  23995. *
  23996. * ```js
  23997. wx.startRecord({
  23998. success (res) {
  23999. const tempFilePath = res.tempFilePath
  24000. wx.playVoice({
  24001. filePath: tempFilePath
  24002. })
  24003. setTimeout(() => { wx.pauseVoice() }, 5000)
  24004. }
  24005. })
  24006. ``` */
  24007. pauseVoice<T extends PauseVoiceOption = PauseVoiceOption>(
  24008. option?: T
  24009. ): PromisifySuccessResult<T, PauseVoiceOption>
  24010. /** [wx.playBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.playBackgroundAudio.html)
  24011. *
  24012. * 在插件中使用:需要基础库 `1.9.6`
  24013. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  24014. *
  24015. * 使用后台播放器播放音乐。对于微信客户端来说,只能同时有一个后台音乐在播放。当用户离开小程序后,音乐将暂停播放;当用户在其他小程序占用了音乐播放器,原有小程序内的音乐将停止播放。
  24016. *
  24017. * **示例代码**
  24018. *
  24019. * ```js
  24020. wx.playBackgroundAudio({
  24021. dataUrl: '',
  24022. title: '',
  24023. coverImgUrl: ''
  24024. })
  24025. ``` */
  24026. playBackgroundAudio<
  24027. T extends PlayBackgroundAudioOption = PlayBackgroundAudioOption
  24028. >(
  24029. option: T
  24030. ): PromisifySuccessResult<T, PlayBackgroundAudioOption>
  24031. /** [wx.playVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html)
  24032. *
  24033. * 在插件中使用:需要基础库 `1.9.6`
  24034. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  24035. *
  24036. * 开始播放语音。同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。
  24037. *
  24038. * **示例代码**
  24039. *
  24040. * ```js
  24041. wx.startRecord({
  24042. success (res) {
  24043. const tempFilePath = res.tempFilePath
  24044. wx.playVoice({
  24045. filePath: tempFilePath,
  24046. complete () { }
  24047. })
  24048. }
  24049. })
  24050. ``` */
  24051. playVoice<T extends PlayVoiceOption = PlayVoiceOption>(
  24052. option: T
  24053. ): PromisifySuccessResult<T, PlayVoiceOption>
  24054. /** [wx.pluginLogin(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.pluginLogin.html)
  24055. *
  24056. * 需要基础库: `2.20.1`
  24057. *
  24058. * 在插件中使用:需要基础库 `2.20.1`
  24059. *
  24060. * __该接口仅在小程序插件中可调用__,调用接口获得插件用户标志凭证(code)。插件可以此凭证换取用于识别用户的标识 openpid。用户不同、宿主小程序不同或插件不同的情况下,该标识均不相同,即当且仅当同一个用户在同一个宿主小程序中使用同一个插件时,openpid 才会相同。 */
  24061. pluginLogin(args?: PluginLoginOption): void
  24062. /** [wx.preloadAssets(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html)
  24063. *
  24064. * 需要基础库: `2.22.1`
  24065. *
  24066. * 在插件中使用:不支持
  24067. *
  24068. * 为视图层预加载媒体资源文件, 目前支持:font,image
  24069. *
  24070. * **示例代码**
  24071. *
  24072. * ```js
  24073. wx.preloadAssets({
  24074. data: [
  24075. {
  24076. type: 'image',
  24077. src: imgUrl,
  24078. },
  24079. ],
  24080. success(resp) {
  24081. console.log('preloadAssets success', resp)
  24082. },
  24083. fail(err) {
  24084. console.log('preloadAssets fail', err)
  24085. },
  24086. })
  24087. ```
  24088. *
  24089. * ****
  24090. *
  24091. * - 开发过程中,可在开发者工具network面板查看预加载情况。 */
  24092. preloadAssets(option: PreloadAssetsOption): void
  24093. /** [wx.preloadSkylineView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html)
  24094. *
  24095. * 需要基础库: `2.24.7`
  24096. *
  24097. * 在插件中使用:需要基础库 `2.24.7`
  24098. *
  24099. * 预加载下个页面所需要的 [Skyline](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 运行环境。 */
  24100. preloadSkylineView(option?: PreloadSkylineViewOption): void
  24101. /** [wx.preloadWebview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html)
  24102. *
  24103. * 需要基础库: `2.15.0`
  24104. *
  24105. * 在插件中使用:需要基础库 `2.15.0`
  24106. *
  24107. * 预加载下个页面的 WebView。参见[预加载下个页面的时机](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips/runtime_nav.html#_2-4-控制预加载下个页面的时机) */
  24108. preloadWebview(option?: PreloadWebviewOption): void
  24109. /** [wx.previewImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html)
  24110. *
  24111. * 在插件中使用:需要基础库 `1.9.6`
  24112. *
  24113. * 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
  24114. *
  24115. * **支持长按识别的码**
  24116. *
  24117. * | 类型 | 说明 | 最低版本 |
  24118. * |------|------| -------|
  24119. * | 小程序码 | |
  24120. * | 微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24121. * | 企业微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24122. * | 普通群码 | 指仅包含微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24123. * | 互通群码 | 指既有微信用户也有企业微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24124. * | 公众号二维码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24125. *
  24126. * **示例代码**
  24127. *
  24128. * ```js
  24129. wx.previewImage({
  24130. current: '', // 当前显示图片的http链接
  24131. urls: [] // 需要预览的图片http链接列表
  24132. })
  24133. ``` */
  24134. previewImage<T extends PreviewImageOption = PreviewImageOption>(
  24135. option: T
  24136. ): PromisifySuccessResult<T, PreviewImageOption>
  24137. /** [wx.previewMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html)
  24138. *
  24139. * 需要基础库: `2.12.0`
  24140. *
  24141. * 在插件中使用:需要基础库 `2.15.0`
  24142. *
  24143. * 预览图片和视频。
  24144. *
  24145. * **支持长按识别的码**
  24146. *
  24147. * | 类型 | 说明 | 最低版本 |
  24148. * |------|------| -------|
  24149. * | 小程序码 | |
  24150. * | 微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24151. * | 企业微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24152. * | 普通群码 | 指仅包含微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24153. * | 互通群码 | 指既有微信用户也有企业微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  24154. * | 公众号二维码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) | */
  24155. previewMedia<T extends PreviewMediaOption = PreviewMediaOption>(
  24156. option: T
  24157. ): PromisifySuccessResult<T, PreviewMediaOption>
  24158. /** [wx.reLaunch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html)
  24159. *
  24160. * 需要基础库: `1.1.0`
  24161. *
  24162. * 在插件中使用:需要基础库 `2.3.1`
  24163. *
  24164. * 在插件中使用时,只能在当前插件的页面中调用
  24165. *
  24166. * 关闭所有页面,打开到应用内的某个页面
  24167. *
  24168. * **示例代码**
  24169. *
  24170. * ```js
  24171. wx.reLaunch({
  24172. url: 'test?id=1'
  24173. })
  24174. ```
  24175. *
  24176. * ```html
  24177. * // test
  24178. * Page({
  24179. * onLoad (option) {
  24180. * console.log(option.query)
  24181. * }
  24182. * })
  24183. * ``` */
  24184. reLaunch<T extends ReLaunchOption = ReLaunchOption>(
  24185. option: T
  24186. ): PromisifySuccessResult<T, ReLaunchOption>
  24187. /** [wx.readBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.readBLECharacteristicValue.html)
  24188. *
  24189. * 需要基础库: `1.1.0`
  24190. *
  24191. * 在插件中使用:需要基础库 `1.9.6`
  24192. *
  24193. * 读取蓝牙低功耗设备特征值的二进制数据。注意:必须设备的特征支持 read 才可以成功调用。
  24194. *
  24195. * **注意**
  24196. *
  24197. * - 并行调用多次会存在读失败的可能性。
  24198. * - 接口读取到的信息需要在 [wx.onBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) 方法注册的回调中获取。
  24199. *
  24200. * **示例代码**
  24201. *
  24202. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  24203. * ```js
  24204. // 必须在这里的回调才能获取
  24205. wx.onBLECharacteristicValueChange(function(characteristic) {
  24206. console.log('characteristic value comed:', characteristic)
  24207. })
  24208. wx.readBLECharacteristicValue({
  24209. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  24210. deviceId,
  24211. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  24212. serviceId,
  24213. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  24214. characteristicId,
  24215. success (res) {
  24216. console.log('readBLECharacteristicValue:', res.errCode)
  24217. }
  24218. })
  24219. ``` */
  24220. readBLECharacteristicValue<
  24221. T extends ReadBLECharacteristicValueOption = ReadBLECharacteristicValueOption
  24222. >(
  24223. option: T
  24224. ): PromisifySuccessResult<T, ReadBLECharacteristicValueOption>
  24225. /** [wx.redirectTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html)
  24226. *
  24227. * 在插件中使用:需要基础库 `2.2.2`
  24228. *
  24229. * 在插件中使用时,只能在当前插件的页面中调用
  24230. *
  24231. * 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
  24232. *
  24233. * **示例代码**
  24234. *
  24235. * ```js
  24236. wx.redirectTo({
  24237. url: 'test?id=1'
  24238. })
  24239. ``` */
  24240. redirectTo<T extends RedirectToOption = RedirectToOption>(
  24241. option: T
  24242. ): PromisifySuccessResult<T, RedirectToOption>
  24243. /** [wx.removeStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html)
  24244. *
  24245. * 在插件中使用:需要基础库 `1.9.6`
  24246. *
  24247. * 从本地缓存中移除指定 key。
  24248. *
  24249. * **示例代码**
  24250. *
  24251. * ```js
  24252. wx.removeStorage({
  24253. key: 'key',
  24254. success (res) {
  24255. console.log(res)
  24256. }
  24257. })
  24258. ```
  24259. *
  24260. * ```js
  24261. try {
  24262. wx.removeStorageSync('key')
  24263. } catch (e) {
  24264. // Do something when catch error
  24265. }
  24266. ``` */
  24267. removeStorage<T extends RemoveStorageOption = RemoveStorageOption>(
  24268. option: T
  24269. ): PromisifySuccessResult<T, RemoveStorageOption>
  24270. /** [wx.removeStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html)
  24271. *
  24272. * 在插件中使用:需要基础库 `1.9.6`
  24273. *
  24274. * [wx.removeStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html) 的同步版本
  24275. *
  24276. * **示例代码**
  24277. *
  24278. * ```js
  24279. wx.removeStorage({
  24280. key: 'key',
  24281. success (res) {
  24282. console.log(res)
  24283. }
  24284. })
  24285. ```
  24286. *
  24287. * ```js
  24288. try {
  24289. wx.removeStorageSync('key')
  24290. } catch (e) {
  24291. // Do something when catch error
  24292. }
  24293. ``` */
  24294. removeStorageSync(
  24295. /** 本地缓存中指定的 key */
  24296. key: string
  24297. ): void
  24298. /** [wx.removeTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html)
  24299. *
  24300. * 需要基础库: `1.9.0`
  24301. *
  24302. * 在插件中使用:不支持
  24303. *
  24304. * 移除 tabBar 某一项右上角的文本 */
  24305. removeTabBarBadge<
  24306. T extends RemoveTabBarBadgeOption = RemoveTabBarBadgeOption
  24307. >(
  24308. option: T
  24309. ): PromisifySuccessResult<T, RemoveTabBarBadgeOption>
  24310. /** [wx.reportAnalytics(string eventName, Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportAnalytics.html)
  24311. *
  24312. * 在插件中使用:需要基础库 `1.9.6`
  24313. *
  24314. * 在插件中使用时,可以被正常调用,但目前不会进行统计展示
  24315. *
  24316. * 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。
  24317. *
  24318. * **示例代码**
  24319. *
  24320. * ```js
  24321. wx.reportAnalytics('purchase', {
  24322. price: 120,
  24323. color: 'red'
  24324. })
  24325. ``` */
  24326. reportAnalytics(
  24327. /** 事件名 */
  24328. eventName: string,
  24329. /** 上报的自定义数据,key 为配置中的字段名,value 为上报的数据。 */
  24330. data: IAnyObject
  24331. ): void
  24332. /** [wx.reportEvent(string eventId, object data)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportEvent.html)
  24333. *
  24334. * 需要基础库: `2.14.4`
  24335. *
  24336. * 在插件中使用:不支持
  24337. *
  24338. * 事件上报 */
  24339. reportEvent(
  24340. /** 在 mp 实验系统中设置的事件英文名 */
  24341. eventId: string,
  24342. /** 可被 JSON.stringify 的对象,将一起上报至系统 */
  24343. data?: IAnyObject
  24344. ): void
  24345. /** [wx.reportMonitor(string name, number value)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportMonitor.html)
  24346. *
  24347. * 需要基础库: `2.0.1`
  24348. *
  24349. * 在插件中使用:不支持
  24350. *
  24351. * 自定义业务数据监控上报接口。
  24352. *
  24353. * **使用说明**
  24354. *
  24355. * 使用前,需要在「小程序管理后台-运维中心-性能监控-业务数据监控」中新建监控事件,配置监控描述与告警类型。每一个监控事件对应唯一的监控ID,开发者最多可以创建128个监控事件。
  24356. *
  24357. * **示例代码**
  24358. *
  24359. * ```js
  24360. wx.reportMonitor('1', 1)
  24361. ``` */
  24362. reportMonitor(
  24363. /** 监控ID,在「小程序管理后台」新建数据指标后获得 */
  24364. name: string,
  24365. /** 上报数值,经处理后会在「小程序管理后台」上展示每分钟的上报总量 */
  24366. value: number
  24367. ): void
  24368. /** [wx.reportPerformance(Number id, Number value, String|Array dimensions)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.reportPerformance.html)
  24369. *
  24370. * 需要基础库: `2.9.2`
  24371. *
  24372. * 在插件中使用:需要基础库 `2.9.3`
  24373. *
  24374. * 小程序测速上报。使用前,需要在小程序管理后台配置。
  24375. *
  24376. * **示例代码**
  24377. *
  24378. * ```js
  24379. wx.reportPerformance(1101, 680)
  24380. wx.reportPerformance(1101, 680, 'custom')
  24381. ``` */
  24382. reportPerformance(
  24383. /** 指标 id */
  24384. id: number,
  24385. /** 需要上报的数值 */
  24386. value: number,
  24387. /** 自定义维度 (选填) */
  24388. dimensions?: string | any[]
  24389. ): void
  24390. /** [wx.requestOrderPayment(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestOrderPayment.html)
  24391. *
  24392. * 需要基础库: `2.16.0`
  24393. *
  24394. * 在插件中使用:不支持
  24395. *
  24396. * 仅接入了[自定义版交易组件](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/Introduction2)的小程序需要使用,普通小程序可直接使用 [`wx.requestPayment`](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html)。
  24397. *
  24398. * **前置检查**
  24399. *
  24400. * 接入自定义版交易组件之后,若要发起微信支付,请先查询[需要校验的场景](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/check_scene)。
  24401. * 在需要校验的场景中,发起微信支付时,必须使用该接口,需要按照要求传入相关的[订单信息](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/add_order)进行校验,校验通过后用户才可以完成当前订单的支付,非需要校验的场景则可以按照商家要求自行选择传入订单信息或不传入。 */
  24402. requestOrderPayment<
  24403. T extends RequestOrderPaymentOption = RequestOrderPaymentOption
  24404. >(
  24405. args: T
  24406. ): PromisifySuccessResult<T, RequestOrderPaymentOption>
  24407. /** [wx.requestPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html)
  24408. *
  24409. * 在插件中使用:不支持
  24410. *
  24411. * 发起微信支付。调用前需在[小程序微信公众平台](https://mp.weixin.qq.com/) -功能-微信支付入口申请接入微信支付。了解更多信息,可以参考 [微信支付开发文档](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/api.shtml):
  24412. * - [开发指引](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter2_3.shtml)
  24413. * - [下单接口](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_2.shtml)
  24414. * - [支付接口](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_12.shtml)
  24415. * - 旧版本 (v2)
  24416. * - [开发指引](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_3&index=1)
  24417. * - [支付接口](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3)
  24418. *
  24419. * 如果使用[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html),则 `wx.requestPayment` 所需参数可以通过云开发微信支付统一下单接口免鉴权获取、并可免证书、免签名的安全调用微信支付服务端接口、及接收异步支付结果回调,详见[云开发微信支付](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/wechatpay/wechatpay.html)。
  24420. *
  24421. * **示例代码**
  24422. *
  24423. * ```js
  24424. wx.requestPayment({
  24425. timeStamp: '',
  24426. nonceStr: '',
  24427. package: '',
  24428. signType: 'MD5',
  24429. paySign: '',
  24430. success (res) { },
  24431. fail (res) { }
  24432. })
  24433. ```
  24434. *
  24435. * 注:如果服务端有使用云开发,可以通过云开发微信支付[统一下单](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/open/pay/CloudPay.unifiedOrder.html)接口免鉴权获取以上所需所有参数,示例:
  24436. *
  24437. * ```js
  24438. // 云函数代码
  24439. const cloud = require('wx-server-sdk')
  24440. cloud.init({
  24441. env: cloud.DYNAMIC_CURRENT_ENV
  24442. })
  24443. exports.main = async (event, context) => {
  24444. const res = await cloud.cloudPay.unifiedOrder({
  24445. "body" : "小秋TIT店-超市",
  24446. "outTradeNo" : "1217752501201407033233368018",
  24447. "spbillCreateIp" : "127.0.0.1",
  24448. "subMchId" : "1900009231",
  24449. "totalFee" : 1,
  24450. "envId": "test-f0b102",
  24451. "functionName": "pay_cb"
  24452. })
  24453. return res
  24454. }
  24455. // 小程序代码
  24456. wx.cloud.callFunction({
  24457. name: '函数名',
  24458. data: {
  24459. // ...
  24460. },
  24461. success: res => {
  24462. const payment = res.result.payment
  24463. wx.requestPayment({
  24464. ...payment,
  24465. success (res) {
  24466. console.log('pay success', res)
  24467. },
  24468. fail (err) {
  24469. console.error('pay fail', err)
  24470. }
  24471. })
  24472. },
  24473. fail: console.error,
  24474. })
  24475. ``` */
  24476. requestPayment<T extends RequestPaymentOption = RequestPaymentOption>(
  24477. option: T
  24478. ): PromisifySuccessResult<T, RequestPaymentOption>
  24479. /** [wx.requestPluginPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPluginPayment.html)
  24480. *
  24481. * 需要基础库: `2.22.1`
  24482. *
  24483. * 在插件中使用:需要基础库 `2.22.1`
  24484. *
  24485. * 插件中发起支付。
  24486. *
  24487. * **Tip**
  24488. *
  24489. * 1. `tip`: 小程序与插件绑定在同一个open平台账号上且小程序与插件均为open账号的同主体/关联主体时,调用此接口将直接拉起支付收银台。
  24490. * 1. `tip`: 这个接口本身可以在开发者工具中使用,但功能页的跳转目前不支持在开发者工具中调试,请在真机上测试。
  24491. * 1. `tip`: 跳转支付功能页需要在 `app.json` 中配置 `"functionalPages": true`
  24492. *
  24493. * **示例代码**
  24494. *
  24495. * 具体用法及参数说明可参考 [插件支付文档](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/request-payment.html)
  24496. * ```js
  24497. wx.requestPluginPayment({
  24498. version: 'release',
  24499. fee: 1,
  24500. paymentArgs: {},
  24501. currencyType: 'CNY',
  24502. success (res) { },
  24503. fail (res) { }
  24504. })
  24505. ``` */
  24506. requestPluginPayment(option: RequestPluginPaymentOption): void
  24507. /** [wx.requestSubscribeDeviceMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeDeviceMessage.html)
  24508. *
  24509. * 需要基础库: `2.20.0`
  24510. *
  24511. * 在插件中使用:不支持
  24512. *
  24513. * 订阅设备消息接口,调用后弹出授权框,用户同意后会允许开发者给用户发送订阅模版消息。当用户点击“允许”按钮时,模板消息会被添加到用户的小程序设置页,通过 wx.getSetting 接口可获取用户对相关模板消息的订阅状态。
  24514. *
  24515. * **错误码**
  24516. *
  24517. * | errCode | errMsg | 说明 |
  24518. * | ------- | ------------------------------------------------------ | -------------------------------------------------------------- |
  24519. * | 10001 | TmplIds can't be empty | tmplIds 为空 |
  24520. * | 10004 | Invalid template id | tmplId 参数类型错误 |
  24521. * | 20001 | No template data return, verify the template id exist | tmplId 为空 |
  24522. * | 20003 | Templates count out of max bounds | tmplId 数量超过上限 |
  24523. * | 19720726 | check sn_ticket fail | snTicket 不合法 |
  24524. * | 19720727 | sn_ticket expire | snTicket 过期 |
  24525. * | 19720728 | err_not_found_tid | tmplId 不存在 |
  24526. * | 19720736 | template_id do not match model_id | modelId 类型与 tmplId 类型不符 |
  24527. *
  24528. * **示例代码**
  24529. *
  24530. * ```js
  24531. wx.requestSubscribeDeviceMessage({
  24532. tmplIds: ['xxxxx'],
  24533. sn: 'xxxx',
  24534. snTicket: 'xxxxx',
  24535. modelId: 'xxx',
  24536. success(res) {
  24537. console.log(res)
  24538. },
  24539. fail(res) {
  24540. console.log(res)
  24541. }
  24542. })
  24543. ``` */
  24544. requestSubscribeDeviceMessage<
  24545. T extends RequestSubscribeDeviceMessageOption = RequestSubscribeDeviceMessageOption
  24546. >(
  24547. option: T
  24548. ): PromisifySuccessResult<T, RequestSubscribeDeviceMessageOption>
  24549. /** [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html)
  24550. *
  24551. * 需要基础库: `2.4.4`
  24552. *
  24553. * 在插件中使用:不支持
  24554. *
  24555. * 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。
  24556. *
  24557. * ## 注意事项
  24558. * - 一次性模板 id 和永久模板 id 不可同时使用。
  24559. * - 低版本基础库2.4.4~2.8.3 已支持订阅消息接口调用,仅支持传入一个一次性 tmplId / 永久 tmplId。
  24560. * - [2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
  24561. * - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,开发版和体验版小程序将禁止使用模板消息 formId。
  24562. * - 一次授权调用里,每个tmplId对应的模板标题不能存在相同的,若出现相同的,只保留一个。
  24563. * - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,支持订阅语音消息提醒,[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html)
  24564. *
  24565. * **错误码**
  24566. *
  24567. * | errCode | errMsg | 说明 |
  24568. * | ------- | ------------------------------------------------------ | -------------------------------------------------------------- |
  24569. * | 10001 | TmplIds can't be empty | 参数传空了 |
  24570. * | 10002 | Request list fail | 网络问题,请求消息列表失败 |
  24571. * | 10003 | Request subscribe fail | 网络问题,订阅请求发送失败 |
  24572. * | 10004 | Invalid template id | 参数类型错误 |
  24573. * | 10005 | Cannot show subscribe message UI | 无法展示 UI,一般是小程序这个时候退后台了导致的 |
  24574. * | 20001 | No template data return, verify the template id exist | 没有模板数据,一般是模板 ID 不存在 或者和模板类型不对应 导致的 |
  24575. * | 20002 | Templates type must be same | 模板消息类型 既有一次性的又有永久的 |
  24576. * | 20003 | Templates count out of max bounds | 模板消息数量超过上限 |
  24577. * | 20004 | The main switch is switched off | 用户关闭了主开关,无法进行订阅 |
  24578. * | 20005 | This mini program was banned from subscribing messages | 小程序被禁封 |
  24579. * | 20013 | Reject DeviceMsg Template | 不允许通过该接口订阅设备消息 |
  24580. *
  24581. * **示例代码**
  24582. *
  24583. * ```js
  24584. wx.requestSubscribeMessage({
  24585. tmplIds: [''],
  24586. success (res) { }
  24587. })
  24588. ``` */
  24589. requestSubscribeMessage<
  24590. T extends RequestSubscribeMessageOption = RequestSubscribeMessageOption
  24591. >(
  24592. option: T
  24593. ): PromisifySuccessResult<T, RequestSubscribeMessageOption>
  24594. /** [wx.reserveChannelsLive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.reserveChannelsLive.html)
  24595. *
  24596. * 需要基础库: `2.19.0`
  24597. *
  24598. * 在插件中使用:不支持
  24599. *
  24600. * 预约视频号直播 */
  24601. reserveChannelsLive(option: ReserveChannelsLiveOption): void
  24602. /** [wx.revokeBufferURL(string url)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.revokeBufferURL.html)
  24603. *
  24604. * 需要基础库: `2.14.0`
  24605. *
  24606. * 在插件中使用:不支持
  24607. *
  24608. * 根据 URL 销毁存在内存中的数据 */
  24609. revokeBufferURL(
  24610. /** 需要销毁的二进制数据 URL */
  24611. url: string
  24612. ): void
  24613. /** [wx.saveFileToDisk(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFileToDisk.html)
  24614. *
  24615. * 需要基础库: `2.11.0`
  24616. *
  24617. * 在插件中使用:需要基础库 `2.15.0`
  24618. *
  24619. * 保存文件系统的文件到用户磁盘,仅在 PC 端支持
  24620. *
  24621. * **示例代码**
  24622. *
  24623. * ```js
  24624. wx.saveFileToDisk({
  24625. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  24626. success(res) {
  24627. console.log(res)
  24628. },
  24629. fail(res) {
  24630. console.error(res)
  24631. }
  24632. })
  24633. ``` */
  24634. saveFileToDisk(option: SaveFileToDiskOption): void
  24635. /** [wx.saveImageToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html)
  24636. *
  24637. * 需要基础库: `1.2.0`
  24638. *
  24639. * 在插件中使用:需要基础库 `1.9.6`
  24640. *
  24641. * 保存图片到系统相册。
  24642. *
  24643. * **示例代码**
  24644. *
  24645. * ```js
  24646. wx.saveImageToPhotosAlbum({
  24647. success(res) { }
  24648. })
  24649. ``` */
  24650. saveImageToPhotosAlbum<
  24651. T extends SaveImageToPhotosAlbumOption = SaveImageToPhotosAlbumOption
  24652. >(
  24653. option: T
  24654. ): PromisifySuccessResult<T, SaveImageToPhotosAlbumOption>
  24655. /** [wx.saveVideoToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html)
  24656. *
  24657. * 需要基础库: `1.2.0`
  24658. *
  24659. * 在插件中使用:需要基础库 `1.9.6`
  24660. *
  24661. * 保存视频到系统相册。支持mp4视频格式。
  24662. *
  24663. * **示例代码**
  24664. *
  24665. * ```js
  24666. wx.saveVideoToPhotosAlbum({
  24667. filePath: 'wxfile://xxx',
  24668. success (res) {
  24669. console.log(res.errMsg)
  24670. }
  24671. })
  24672. ``` */
  24673. saveVideoToPhotosAlbum<
  24674. T extends SaveVideoToPhotosAlbumOption = SaveVideoToPhotosAlbumOption
  24675. >(
  24676. option: T
  24677. ): PromisifySuccessResult<T, SaveVideoToPhotosAlbumOption>
  24678. /** [wx.scanCode(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html)
  24679. *
  24680. * 需要基础库: `1.0.0`
  24681. *
  24682. * 在插件中使用:需要基础库 `1.9.6`
  24683. *
  24684. * 调起客户端扫码界面进行扫码
  24685. *
  24686. * **示例代码**
  24687. *
  24688. * ```js
  24689. // 允许从相机和相册扫码
  24690. wx.scanCode({
  24691. success (res) {
  24692. console.log(res)
  24693. }
  24694. })
  24695. // 只允许从相机扫码
  24696. wx.scanCode({
  24697. onlyFromCamera: true,
  24698. success (res) {
  24699. console.log(res)
  24700. }
  24701. })
  24702. ``` */
  24703. scanCode<T extends ScanCodeOption = ScanCodeOption>(
  24704. option: T
  24705. ): PromisifySuccessResult<T, ScanCodeOption>
  24706. /** [wx.seekBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.seekBackgroundAudio.html)
  24707. *
  24708. * 在插件中使用:需要基础库 `1.9.6`
  24709. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  24710. *
  24711. * 控制音乐播放进度。
  24712. *
  24713. * **示例代码**
  24714. *
  24715. * ```js
  24716. wx.seekBackgroundAudio({
  24717. position: 30
  24718. })
  24719. ``` */
  24720. seekBackgroundAudio<
  24721. T extends SeekBackgroundAudioOption = SeekBackgroundAudioOption
  24722. >(
  24723. option: T
  24724. ): PromisifySuccessResult<T, SeekBackgroundAudioOption>
  24725. /** [wx.sendHCEMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.sendHCEMessage.html)
  24726. *
  24727. * 需要基础库: `1.7.0`
  24728. *
  24729. * 在插件中使用:需要基础库 `2.1.0`
  24730. *
  24731. * 发送 NFC 消息。仅在安卓系统下有效。
  24732. *
  24733. * **示例代码**
  24734. *
  24735. * ```js
  24736. const buffer = new ArrayBuffer(1)
  24737. const dataView = new DataView(buffer)
  24738. dataView.setUint8(0, 0)
  24739. wx.startHCE({
  24740. success (res) {
  24741. wx.onHCEMessage(function(res) {
  24742. if (res.messageType === 1) {
  24743. wx.sendHCEMessage({data: buffer})
  24744. }
  24745. })
  24746. }
  24747. })
  24748. ``` */
  24749. sendHCEMessage<T extends SendHCEMessageOption = SendHCEMessageOption>(
  24750. option: T
  24751. ): PromisifySuccessResult<T, SendHCEMessageOption>
  24752. /** [wx.sendSms(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/sms/wx.sendSms.html)
  24753. *
  24754. * 需要基础库: `2.25.0`
  24755. *
  24756. * 在插件中使用:不支持
  24757. *
  24758. * 拉起手机发送短信界面。 */
  24759. sendSms(option: SendSmsOption): void
  24760. /** [wx.sendSocketMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.sendSocketMessage.html)
  24761. *
  24762. * 在插件中使用:不支持
  24763. *
  24764. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  24765. *
  24766. * 通过 WebSocket 连接发送数据。需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送。
  24767. *
  24768. * **示例代码**
  24769. *
  24770. * ```js
  24771. let socketOpen = false
  24772. let socketMsgQueue = []
  24773. wx.connectSocket({
  24774. url: 'test.php'
  24775. })
  24776. wx.onSocketOpen(function(res) {
  24777. socketOpen = true
  24778. for (let i = 0; i < socketMsgQueue.length; i++){
  24779. sendSocketMessage(socketMsgQueue[i])
  24780. }
  24781. socketMsgQueue = []
  24782. })
  24783. function sendSocketMessage(msg) {
  24784. if (socketOpen) {
  24785. wx.sendSocketMessage({
  24786. data:msg
  24787. })
  24788. } else {
  24789. socketMsgQueue.push(msg)
  24790. }
  24791. }
  24792. ``` */
  24793. sendSocketMessage<
  24794. T extends SendSocketMessageOption = SendSocketMessageOption
  24795. >(
  24796. option: T
  24797. ): PromisifySuccessResult<T, SendSocketMessageOption>
  24798. /** [wx.setBLEMTU(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.setBLEMTU.html)
  24799. *
  24800. * 需要基础库: `2.11.0`
  24801. *
  24802. * 在插件中使用:需要基础库 `2.11.0`
  24803. *
  24804. * 协商设置蓝牙低功耗的最大传输单元 (Maximum Transmission Unit, MTU)。需在 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 调用成功后调用。仅安卓系统 5.1 以上版本有效,iOS 因系统限制不支持。 */
  24805. setBLEMTU<T extends SetBLEMTUOption = SetBLEMTUOption>(
  24806. option: T
  24807. ): PromisifySuccessResult<T, SetBLEMTUOption>
  24808. /** [wx.setBackgroundColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html)
  24809. *
  24810. * 需要基础库: `2.1.0`
  24811. *
  24812. * 在插件中使用:需要基础库 `2.4.0`
  24813. *
  24814. * 在插件中使用时,只能在当前插件的页面中调用
  24815. *
  24816. * 动态设置窗口的背景色
  24817. *
  24818. * **示例代码**
  24819. *
  24820. * ```js
  24821. wx.setBackgroundColor({
  24822. backgroundColor: '#ffffff', // 窗口的背景色为白色
  24823. })
  24824. wx.setBackgroundColor({
  24825. backgroundColorTop: '#ffffff', // 顶部窗口的背景色为白色
  24826. backgroundColorBottom: '#ffffff', // 底部窗口的背景色为白色
  24827. })
  24828. ``` */
  24829. setBackgroundColor<
  24830. T extends SetBackgroundColorOption = SetBackgroundColorOption
  24831. >(
  24832. option: T
  24833. ): PromisifySuccessResult<T, SetBackgroundColorOption>
  24834. /** [wx.setBackgroundFetchToken(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html)
  24835. *
  24836. * 需要基础库: `2.8.0`
  24837. *
  24838. * 在插件中使用:不支持
  24839. *
  24840. * 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性 */
  24841. setBackgroundFetchToken<
  24842. T extends SetBackgroundFetchTokenOption = SetBackgroundFetchTokenOption
  24843. >(
  24844. option: T
  24845. ): PromisifySuccessResult<T, SetBackgroundFetchTokenOption>
  24846. /** [wx.setBackgroundTextStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundTextStyle.html)
  24847. *
  24848. * 需要基础库: `2.1.0`
  24849. *
  24850. * 在插件中使用:需要基础库 `2.4.0`
  24851. *
  24852. * 在插件中使用时,只能在当前插件的页面中调用
  24853. *
  24854. * 动态设置下拉背景字体、loading 图的样式
  24855. *
  24856. * **示例代码**
  24857. *
  24858. * ```js
  24859. wx.setBackgroundTextStyle({
  24860. textStyle: 'dark' // 下拉背景字体、loading 图的样式为dark
  24861. })
  24862. ``` */
  24863. setBackgroundTextStyle<
  24864. T extends SetBackgroundTextStyleOption = SetBackgroundTextStyleOption
  24865. >(
  24866. option: T
  24867. ): PromisifySuccessResult<T, SetBackgroundTextStyleOption>
  24868. /** [wx.setClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html)
  24869. *
  24870. * 需要基础库: `1.1.0`
  24871. *
  24872. * 在插件中使用:需要基础库 `1.9.6`
  24873. *
  24874. * 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
  24875. *
  24876. * **示例代码**
  24877. *
  24878. * ```js
  24879. wx.setClipboardData({
  24880. data: 'data',
  24881. success (res) {
  24882. wx.getClipboardData({
  24883. success (res) {
  24884. console.log(res.data) // data
  24885. }
  24886. })
  24887. }
  24888. })
  24889. ``` */
  24890. setClipboardData<
  24891. T extends SetClipboardDataOption = SetClipboardDataOption
  24892. >(
  24893. option: T
  24894. ): PromisifySuccessResult<T, SetClipboardDataOption>
  24895. /** [wx.setEnable1v1Chat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.setEnable1v1Chat.html)
  24896. *
  24897. * 需要基础库: `2.20.1`
  24898. *
  24899. * 在插件中使用:不支持
  24900. *
  24901. * 开启双人通话。设置 `enable` 为 `false` 时,无法接听呼叫。 */
  24902. setEnable1v1Chat(option: SetEnable1v1ChatOption): void
  24903. /** [wx.setEnableDebug(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html)
  24904. *
  24905. * 需要基础库: `1.4.0`
  24906. *
  24907. * 在插件中使用:不支持
  24908. *
  24909. * 设置是否打开调试开关。此开关对正式版也能生效。
  24910. *
  24911. * **示例代码**
  24912. *
  24913. * ```javascript
  24914. // 打开调试
  24915. wx.setEnableDebug({
  24916. enableDebug: true
  24917. })
  24918. // 关闭调试
  24919. wx.setEnableDebug({
  24920. enableDebug: false
  24921. })
  24922. ```
  24923. *
  24924. * **Tips**
  24925. *
  24926. * - 在正式版打开调试还有一种方法,就是先在开发版或体验版打开调试,再切到正式版就能看到vConsole。 */
  24927. setEnableDebug<T extends SetEnableDebugOption = SetEnableDebugOption>(
  24928. option: T
  24929. ): PromisifySuccessResult<T, SetEnableDebugOption>
  24930. /** [wx.setInnerAudioOption(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html)
  24931. *
  24932. * 需要基础库: `2.3.0`
  24933. *
  24934. * 在插件中使用:需要基础库 `2.10.0`
  24935. *
  24936. * 设置 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 的播放选项。设置之后对当前小程序全局生效。
  24937. *
  24938. * ****
  24939. *
  24940. * ## 注意事项
  24941. * - 为保证微信整体体验,speakerOn 为 true 时,客户端会忽略 mixWithOthers 参数的内容,强制与其它音频互斥
  24942. * - 不支持在播放音频的过程中切换为扬声器播放,开发者如需切换可以先暂停当前播放的音频并记录下当前暂停的时间点,然后切换后重新从原来暂停的时间点开始播放音频
  24943. * - 目前 wx.setInnerAudioOption 接口不兼容 wx.createWebAudioContext 接口,也不兼容 wx.createInnerAudioContext 开启 useWebAudioImplement 的情况,将在后续版本中支持 */
  24944. setInnerAudioOption<
  24945. T extends SetInnerAudioOption = SetInnerAudioOption
  24946. >(
  24947. option: T
  24948. ): PromisifySuccessResult<T, SetInnerAudioOption>
  24949. /** [wx.setKeepScreenOn(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setKeepScreenOn.html)
  24950. *
  24951. * 需要基础库: `1.4.0`
  24952. *
  24953. * 在插件中使用:需要基础库 `1.9.6`
  24954. *
  24955. * 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
  24956. *
  24957. * **示例代码**
  24958. *
  24959. * ```js
  24960. wx.setKeepScreenOn({
  24961. keepScreenOn: true
  24962. })
  24963. ``` */
  24964. setKeepScreenOn<
  24965. T extends SetKeepScreenOnOption = SetKeepScreenOnOption
  24966. >(
  24967. option: T
  24968. ): PromisifySuccessResult<T, SetKeepScreenOnOption>
  24969. /** [wx.setNavigationBarColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html)
  24970. *
  24971. * 需要基础库: `1.4.0`
  24972. *
  24973. * 在插件中使用:需要基础库 `2.1.0`
  24974. *
  24975. * 在插件中使用时,只能在当前插件的页面中调用
  24976. *
  24977. * 设置页面导航条颜色 */
  24978. setNavigationBarColor<
  24979. T extends SetNavigationBarColorOption = SetNavigationBarColorOption
  24980. >(
  24981. option: T
  24982. ): PromisifySuccessResult<T, SetNavigationBarColorOption>
  24983. /** [wx.setNavigationBarTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html)
  24984. *
  24985. * 在插件中使用:需要基础库 `2.1.0`
  24986. *
  24987. * 在插件中使用时,只能在当前插件的页面中调用
  24988. *
  24989. * 动态设置当前页面的标题
  24990. *
  24991. * **示例代码**
  24992. *
  24993. * ```js
  24994. wx.setNavigationBarTitle({
  24995. title: '当前页面'
  24996. })
  24997. ``` */
  24998. setNavigationBarTitle<
  24999. T extends SetNavigationBarTitleOption = SetNavigationBarTitleOption
  25000. >(
  25001. option: T
  25002. ): PromisifySuccessResult<T, SetNavigationBarTitleOption>
  25003. /** [wx.setScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setScreenBrightness.html)
  25004. *
  25005. * 需要基础库: `1.2.0`
  25006. *
  25007. * 在插件中使用:需要基础库 `1.9.6`
  25008. *
  25009. * 设置屏幕亮度 */
  25010. setScreenBrightness<
  25011. T extends SetScreenBrightnessOption = SetScreenBrightnessOption
  25012. >(
  25013. option: T
  25014. ): PromisifySuccessResult<T, SetScreenBrightnessOption>
  25015. /** [wx.setStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html)
  25016. *
  25017. * 在插件中使用:需要基础库 `1.9.6`
  25018. *
  25019. * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  25020. *
  25021. * **示例代码**
  25022. *
  25023. * ```js
  25024. wx.setStorage({
  25025. key:"key",
  25026. data:"value"
  25027. })
  25028. ```
  25029. *
  25030. * ```js
  25031. // 开启加密存储
  25032. wx.setStorage({
  25033. key: "key",
  25034. data: "value",
  25035. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  25036. success() {
  25037. wx.getStorage({
  25038. key: "key",
  25039. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  25040. success(res) {
  25041. console.log(res.data)
  25042. }
  25043. })
  25044. }
  25045. })
  25046. ``` */
  25047. setStorage<
  25048. T = any,
  25049. U extends SetStorageOption<T> = SetStorageOption<T>
  25050. >(
  25051. option: U
  25052. ): PromisifySuccessResult<U, SetStorageOption<T>>
  25053. /** [wx.setStorageSync(string key, any data)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html)
  25054. *
  25055. * 在插件中使用:需要基础库 `1.9.6`
  25056. *
  25057. * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  25058. *
  25059. * **注意**
  25060. *
  25061. * storage 应只用来进行数据的持久化存储,不应用于运行时的数据传递或全局状态管理。启动过程中过多的同步读写存储,会显著影响启动耗时。
  25062. *
  25063. * **示例代码**
  25064. *
  25065. * ```js
  25066. try {
  25067. wx.setStorageSync('key', 'value')
  25068. } catch (e) { }
  25069. ``` */
  25070. setStorageSync<T = any>(
  25071. /** 本地缓存中指定的 key */
  25072. key: string,
  25073. /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  25074. data: T
  25075. ): void
  25076. /** [wx.setTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarBadge.html)
  25077. *
  25078. * 需要基础库: `1.9.0`
  25079. *
  25080. * 在插件中使用:不支持
  25081. *
  25082. * 为 tabBar 某一项的右上角添加文本
  25083. *
  25084. * **示例代码**
  25085. *
  25086. * ```js
  25087. wx.setTabBarBadge({
  25088. index: 0,
  25089. text: '1'
  25090. })
  25091. ``` */
  25092. setTabBarBadge<T extends SetTabBarBadgeOption = SetTabBarBadgeOption>(
  25093. option: T
  25094. ): PromisifySuccessResult<T, SetTabBarBadgeOption>
  25095. /** [wx.setTabBarItem(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarItem.html)
  25096. *
  25097. * 需要基础库: `1.9.0`
  25098. *
  25099. * 在插件中使用:不支持
  25100. *
  25101. * 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。
  25102. *
  25103. * **示例代码**
  25104. *
  25105. * ```js
  25106. wx.setTabBarItem({
  25107. index: 0,
  25108. text: 'text',
  25109. iconPath: '/path/to/iconPath',
  25110. selectedIconPath: '/path/to/selectedIconPath'
  25111. })
  25112. ``` */
  25113. setTabBarItem<T extends SetTabBarItemOption = SetTabBarItemOption>(
  25114. option: T
  25115. ): PromisifySuccessResult<T, SetTabBarItemOption>
  25116. /** [wx.setTabBarStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarStyle.html)
  25117. *
  25118. * 需要基础库: `1.9.0`
  25119. *
  25120. * 在插件中使用:不支持
  25121. *
  25122. * 动态设置 tabBar 的整体样式
  25123. *
  25124. * **示例代码**
  25125. *
  25126. * ```js
  25127. wx.setTabBarStyle({
  25128. color: '#FF0000',
  25129. selectedColor: '#00FF00',
  25130. backgroundColor: '#0000FF',
  25131. borderStyle: 'white'
  25132. })
  25133. ``` */
  25134. setTabBarStyle<T extends SetTabBarStyleOption = SetTabBarStyleOption>(
  25135. option?: T
  25136. ): PromisifySuccessResult<T, SetTabBarStyleOption>
  25137. /** [wx.setTopBarText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html)
  25138. *
  25139. * 需要基础库: `1.4.3`
  25140. *
  25141. * 在插件中使用:不支持
  25142. * @deprecated 基础库版本 [1.9.9](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  25143. *
  25144. * 动态设置置顶栏文字内容。只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容.
  25145. *
  25146. * **示例代码**
  25147. *
  25148. * ```js
  25149. wx.setTopBarText({
  25150. text: 'hello, world!'
  25151. })
  25152. ```
  25153. *
  25154. * **注意**
  25155. *
  25156. * - 调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently" */
  25157. setTopBarText<T extends SetTopBarTextOption = SetTopBarTextOption>(
  25158. option: T
  25159. ): PromisifySuccessResult<T, SetTopBarTextOption>
  25160. /** [wx.setVisualEffectOnCapture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setVisualEffectOnCapture.html)
  25161. *
  25162. * 需要基础库: `2.20.1`
  25163. *
  25164. * 在插件中使用:需要基础库 `2.21.3`
  25165. *
  25166. * 设置截屏/录屏时屏幕表现,仅支持在 Android 端调用 */
  25167. setVisualEffectOnCapture(option: SetVisualEffectOnCaptureOption): void
  25168. /** [wx.setWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.setWifiList.html)
  25169. *
  25170. * 需要基础库: `1.6.0`
  25171. *
  25172. * 在插件中使用:需要基础库 `2.9.1`
  25173. *
  25174. * 设置 `wifiList` 中 AP 的相关信息。在 `onGetWifiList` 回调后调用,**iOS特有接口**。
  25175. *
  25176. * **注意**
  25177. *
  25178. * - 该接口只能在 `onGetWifiList` 回调之后才能调用。
  25179. * - 此时客户端会挂起,等待小程序设置 Wi-Fi 信息,请务必尽快调用该接口,若无数据请传入一个空数组。
  25180. * - 有可能随着周边 Wi-Fi 列表的刷新,单个流程内收到多次带有存在重复的 Wi-Fi 列表的回调。
  25181. *
  25182. * **示例代码**
  25183. *
  25184. * ```js
  25185. wx.onGetWifiList(function(res) {
  25186. if (res.wifiList.length) {
  25187. wx.setWifiList({
  25188. wifiList: [{
  25189. SSID: res.wifiList[0].SSID,
  25190. BSSID: res.wifiList[0].BSSID,
  25191. password: '123456'
  25192. }]
  25193. })
  25194. } else {
  25195. wx.setWifiList({
  25196. wifiList: []
  25197. })
  25198. }
  25199. })
  25200. wx.getWifiList()
  25201. ``` */
  25202. setWifiList<T extends SetWifiListOption = SetWifiListOption>(
  25203. option: T
  25204. ): PromisifySuccessResult<T, SetWifiListOption>
  25205. /** [wx.setWindowSize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.setWindowSize.html)
  25206. *
  25207. * 需要基础库: `2.10.1`
  25208. *
  25209. * 在插件中使用:不支持
  25210. * @deprecated 基础库版本 [2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  25211. *
  25212. * 设置窗口大小,该接口仅适用于 PC 平台,使用细则请参见指南 */
  25213. setWindowSize(option: SetWindowSizeOption): void
  25214. /** [wx.shareFileMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.shareFileMessage.html)
  25215. *
  25216. * 需要基础库: `2.16.1`
  25217. *
  25218. * 在插件中使用:不支持
  25219. *
  25220. * 转发文件到聊天 */
  25221. shareFileMessage<
  25222. T extends ShareFileMessageOption = ShareFileMessageOption
  25223. >(
  25224. option: T
  25225. ): PromisifySuccessResult<T, ShareFileMessageOption>
  25226. /** [wx.shareToWeRun(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.shareToWeRun.html)
  25227. *
  25228. * 在插件中使用:不支持
  25229. *
  25230. * 分享数据到微信运动。 */
  25231. shareToWeRun<T extends ShareToWeRunOption = ShareToWeRunOption>(
  25232. option: T
  25233. ): PromisifySuccessResult<T, ShareToWeRunOption>
  25234. /** [wx.shareVideoMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.shareVideoMessage.html)
  25235. *
  25236. * 需要基础库: `2.16.1`
  25237. *
  25238. * 在插件中使用:不支持
  25239. *
  25240. * 转发视频到聊天 */
  25241. shareVideoMessage<
  25242. T extends ShareVideoMessageOption = ShareVideoMessageOption
  25243. >(
  25244. option: T
  25245. ): PromisifySuccessResult<T, ShareVideoMessageOption>
  25246. /** [wx.showActionSheet(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html)
  25247. *
  25248. * 在插件中使用:需要基础库 `1.9.6`
  25249. *
  25250. * 显示操作菜单
  25251. *
  25252. * **示例代码**
  25253. *
  25254. * ```js
  25255. wx.showActionSheet({
  25256. itemList: ['A', 'B', 'C'],
  25257. success (res) {
  25258. console.log(res.tapIndex)
  25259. },
  25260. fail (res) {
  25261. console.log(res.errMsg)
  25262. }
  25263. })
  25264. ```
  25265. *
  25266. * **注意**
  25267. *
  25268. * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
  25269. * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */
  25270. showActionSheet<
  25271. T extends ShowActionSheetOption = ShowActionSheetOption
  25272. >(
  25273. option: T
  25274. ): PromisifySuccessResult<T, ShowActionSheetOption>
  25275. /** [wx.showLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html)
  25276. *
  25277. * 需要基础库: `1.1.0`
  25278. *
  25279. * 在插件中使用:需要基础库 `1.9.6`
  25280. *
  25281. * 显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
  25282. *
  25283. * **示例代码**
  25284. *
  25285. * ```js
  25286. wx.showLoading({
  25287. title: '加载中',
  25288. })
  25289. setTimeout(function () {
  25290. wx.hideLoading()
  25291. }, 2000)
  25292. ```
  25293. *
  25294. * **注意**
  25295. *
  25296. * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 和 [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 同时只能显示一个
  25297. * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 应与 [wx.hideLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html) 配对使用 */
  25298. showLoading<T extends ShowLoadingOption = ShowLoadingOption>(
  25299. option: T
  25300. ): PromisifySuccessResult<T, ShowLoadingOption>
  25301. /** [wx.showModal(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showModal.html)
  25302. *
  25303. * 在插件中使用:需要基础库 `1.9.6`
  25304. *
  25305. * 显示模态对话框
  25306. *
  25307. * **示例代码**
  25308. *
  25309. * ```js
  25310. wx.showModal({
  25311. title: '提示',
  25312. content: '这是一个模态弹窗',
  25313. success (res) {
  25314. if (res.confirm) {
  25315. console.log('用户点击确定')
  25316. } else if (res.cancel) {
  25317. console.log('用户点击取消')
  25318. }
  25319. }
  25320. })
  25321. ```
  25322. *
  25323. * **注意**
  25324. *
  25325. * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
  25326. * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
  25327. * - 自基础库 2.17.1 版本起,支持传入 editable 参数,显示带输入框的弹窗 */
  25328. showModal<T extends ShowModalOption = ShowModalOption>(
  25329. option: T
  25330. ): PromisifySuccessResult<T, ShowModalOption>
  25331. /** [wx.showNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html)
  25332. *
  25333. * 在插件中使用:需要基础库 `2.1.0`
  25334. *
  25335. * 在插件中使用时,只能在当前插件的页面中调用
  25336. *
  25337. * 在当前页面显示导航条加载动画 */
  25338. showNavigationBarLoading<
  25339. T extends ShowNavigationBarLoadingOption = ShowNavigationBarLoadingOption
  25340. >(
  25341. option?: T
  25342. ): PromisifySuccessResult<T, ShowNavigationBarLoadingOption>
  25343. /** [wx.showRedPackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html)
  25344. *
  25345. * 需要基础库: `2.10.0`
  25346. *
  25347. * 在插件中使用:不支持
  25348. *
  25349. * 拉取h5领取红包封面页。获取参考红包封面地址参考 [微信红包封面开发平台](https://cover.weixin.qq.com/cgi-bin/mmcover-bin/readtemplate?t=page/index#/doc?page=introduce)。 */
  25350. showRedPackage<T extends ShowRedPackageOption = ShowRedPackageOption>(
  25351. option: T
  25352. ): PromisifySuccessResult<T, ShowRedPackageOption>
  25353. /** [wx.showShareImageMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareImageMenu.html)
  25354. *
  25355. * 需要基础库: `2.14.3`
  25356. *
  25357. * 在插件中使用:需要基础库 `2.16.0`
  25358. *
  25359. * 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载 */
  25360. showShareImageMenu<
  25361. T extends ShowShareImageMenuOption = ShowShareImageMenuOption
  25362. >(
  25363. option: T
  25364. ): PromisifySuccessResult<T, ShowShareImageMenuOption>
  25365. /** [wx.showShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html)
  25366. *
  25367. * 需要基础库: `1.1.0`
  25368. *
  25369. * 在插件中使用:需要基础库 `2.1.0`
  25370. *
  25371. * 在插件中使用时,只能在当前插件的页面中调用
  25372. *
  25373. * 显示当前页面的转发按钮
  25374. *
  25375. * ****
  25376. *
  25377. * ## 注意事项
  25378. * - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
  25379. * - 显示“分享到朋友圈”按钮时必须同时显示“发送给朋友”按钮,显示“发送给朋友”按钮时则允许不显示“分享到朋友圈”按钮
  25380. *
  25381. * **示例代码**
  25382. *
  25383. * ```js
  25384. wx.showShareMenu({
  25385. withShareTicket: true,
  25386. menus: ['shareAppMessage', 'shareTimeline']
  25387. })
  25388. ``` */
  25389. showShareMenu<T extends ShowShareMenuOption = ShowShareMenuOption>(
  25390. option: T
  25391. ): PromisifySuccessResult<T, ShowShareMenuOption>
  25392. /** [wx.showTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html)
  25393. *
  25394. * 需要基础库: `1.9.0`
  25395. *
  25396. * 在插件中使用:不支持
  25397. *
  25398. * 显示 tabBar */
  25399. showTabBar<T extends ShowTabBarOption = ShowTabBarOption>(
  25400. option: T
  25401. ): PromisifySuccessResult<T, ShowTabBarOption>
  25402. /** [wx.showTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html)
  25403. *
  25404. * 需要基础库: `1.9.0`
  25405. *
  25406. * 在插件中使用:不支持
  25407. *
  25408. * 显示 tabBar 某一项的右上角的红点 */
  25409. showTabBarRedDot<
  25410. T extends ShowTabBarRedDotOption = ShowTabBarRedDotOption
  25411. >(
  25412. option: T
  25413. ): PromisifySuccessResult<T, ShowTabBarRedDotOption>
  25414. /** [wx.showToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html)
  25415. *
  25416. * 在插件中使用:需要基础库 `1.9.6`
  25417. *
  25418. * 显示消息提示框
  25419. *
  25420. * **示例代码**
  25421. *
  25422. * ```js
  25423. wx.showToast({
  25424. title: '成功',
  25425. icon: 'success',
  25426. duration: 2000
  25427. })
  25428. ```
  25429. *
  25430. * **注意**
  25431. *
  25432. * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 和 [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 同时只能显示一个
  25433. * - [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 应与 [wx.hideToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html) 配对使用 */
  25434. showToast<T extends ShowToastOption = ShowToastOption>(
  25435. option: T
  25436. ): PromisifySuccessResult<T, ShowToastOption>
  25437. /** [wx.startAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html)
  25438. *
  25439. * 需要基础库: `1.1.0`
  25440. *
  25441. * 在插件中使用:需要基础库 `1.9.6`
  25442. *
  25443. * 开始监听加速度数据。
  25444. *
  25445. * **示例代码**
  25446. *
  25447. * ```js
  25448. wx.startAccelerometer({
  25449. interval: 'game'
  25450. })
  25451. ```
  25452. *
  25453. * **注意**
  25454. *
  25455. * - 根据机型性能、当前 CPU 与内存的占用情况,`interval` 的设置与实际 `wx.onAccelerometerChange()` 回调函数的执行频率会有一些出入。 */
  25456. startAccelerometer<
  25457. T extends StartAccelerometerOption = StartAccelerometerOption
  25458. >(
  25459. option?: T
  25460. ): PromisifySuccessResult<T, StartAccelerometerOption>
  25461. /** [wx.startBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html)
  25462. *
  25463. * 需要基础库: `1.2.0`
  25464. *
  25465. * 在插件中使用:需要基础库 `1.9.6`
  25466. *
  25467. * 开始搜索附近的 Beacon 设备
  25468. *
  25469. * **示例代码**
  25470. *
  25471. * ```js
  25472. wx.startBeaconDiscovery({
  25473. success(res) { }
  25474. })
  25475. ``` */
  25476. startBeaconDiscovery<
  25477. T extends StartBeaconDiscoveryOption = StartBeaconDiscoveryOption
  25478. >(
  25479. option: T
  25480. ): PromisifySuccessResult<T, StartBeaconDiscoveryOption>
  25481. /** [wx.startBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html)
  25482. *
  25483. * 需要基础库: `1.1.0`
  25484. *
  25485. * 在插件中使用:需要基础库 `1.9.6`
  25486. *
  25487. * 开始搜寻附近的蓝牙外围设备。
  25488. *
  25489. * **此操作比较耗费系统资源,请在搜索到需要的设备后及时调用 [wx.stopBluetoothDevicesDiscovery](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html) 停止搜索。**
  25490. *
  25491. * **注意**
  25492. *
  25493. * - 考虑到蓝牙功能可以间接进行定位,安卓 6.0 及以上版本,无定位权限或定位开关未打开时,无法进行设备搜索。这种情况下,安卓 8.0.16 前,接口调用成功但无法扫描设备;8.0.16 及以上版本,会返回错误。
  25494. *
  25495. * **示例代码**
  25496. *
  25497. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/m7klFDmZ72i1)
  25498. *
  25499. * ```js
  25500. // 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备
  25501. wx.startBluetoothDevicesDiscovery({
  25502. services: ['FEE7'],
  25503. success (res) {
  25504. console.log(res)
  25505. }
  25506. })
  25507. ``` */
  25508. startBluetoothDevicesDiscovery<
  25509. T extends StartBluetoothDevicesDiscoveryOption = StartBluetoothDevicesDiscoveryOption
  25510. >(
  25511. option: T
  25512. ): PromisifySuccessResult<T, StartBluetoothDevicesDiscoveryOption>
  25513. /** [wx.startCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html)
  25514. *
  25515. * 需要基础库: `1.1.0`
  25516. *
  25517. * 在插件中使用:需要基础库 `1.9.6`
  25518. *
  25519. * 开始监听罗盘数据
  25520. *
  25521. * **示例代码**
  25522. *
  25523. * ```js
  25524. wx.startCompass()
  25525. ``` */
  25526. startCompass<T extends StartCompassOption = StartCompassOption>(
  25527. option?: T
  25528. ): PromisifySuccessResult<T, StartCompassOption>
  25529. /** [wx.startDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html)
  25530. *
  25531. * 需要基础库: `2.3.0`
  25532. *
  25533. * 在插件中使用:需要基础库 `2.9.1`
  25534. *
  25535. * 开始监听设备方向的变化。 */
  25536. startDeviceMotionListening<
  25537. T extends StartDeviceMotionListeningOption = StartDeviceMotionListeningOption
  25538. >(
  25539. option?: T
  25540. ): PromisifySuccessResult<T, StartDeviceMotionListeningOption>
  25541. /** [wx.startGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html)
  25542. *
  25543. * 需要基础库: `2.3.0`
  25544. *
  25545. * 在插件中使用:需要基础库 `2.9.1`
  25546. *
  25547. * 开始监听陀螺仪数据。 */
  25548. startGyroscope<T extends StartGyroscopeOption = StartGyroscopeOption>(
  25549. option?: T
  25550. ): PromisifySuccessResult<T, StartGyroscopeOption>
  25551. /** [wx.startHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.startHCE.html)
  25552. *
  25553. * 需要基础库: `1.7.0`
  25554. *
  25555. * 在插件中使用:需要基础库 `2.1.0`
  25556. *
  25557. * 初始化 NFC 模块。(HCE 模式仅安卓支持)
  25558. *
  25559. * **示例代码**
  25560. *
  25561. * ```js
  25562. wx.startHCE({
  25563. aid_list: ['F222222222'],
  25564. success (res) {
  25565. console.log(res.errMsg)
  25566. }
  25567. })
  25568. ``` */
  25569. startHCE<T extends StartHCEOption = StartHCEOption>(
  25570. option: T
  25571. ): PromisifySuccessResult<T, StartHCEOption>
  25572. /** [wx.startLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.startLocalServiceDiscovery.html)
  25573. *
  25574. * 需要基础库: `2.4.0`
  25575. *
  25576. * 在插件中使用:需要基础库 `2.15.0`
  25577. *
  25578. * 开始搜索局域网下的 mDNS 服务。搜索的结果会通过 wx.onLocalService* 事件返回。
  25579. *
  25580. * **注意**
  25581. *
  25582. * 1. 由于操作系统相关能力变更,iOS 微信客户端 7.0.18 及以上版本无法使用 mDNS 相关接口,安卓版本不受影响
  25583. * 2. wx.startLocalServiceDiscovery 是一个消耗性能的行为,开始 30 秒后会自动 stop 并执行 wx.onLocalServiceDiscoveryStop 注册的回调函数。
  25584. * 3. 在调用 wx.startLocalServiceDiscovery 后,在这次搜索行为停止后才能发起下次 wx.startLocalServiceDiscovery。停止本次搜索行为的操作包括调用 wx.stopLocalServiceDiscovery 和 30 秒后系统自动 stop 本次搜索。 */
  25585. startLocalServiceDiscovery<
  25586. T extends StartLocalServiceDiscoveryOption = StartLocalServiceDiscoveryOption
  25587. >(
  25588. option: T
  25589. ): PromisifySuccessResult<T, StartLocalServiceDiscoveryOption>
  25590. /** [wx.startLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html)
  25591. *
  25592. * 需要基础库: `2.8.0`
  25593. *
  25594. * 在插件中使用:需要基础库 `2.8.0`
  25595. *
  25596. * 开启小程序进入前台时接收位置消息。
  25597. * ## 使用方法
  25598. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  25599. *
  25600. * ## 申请开通
  25601. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。从2022年7月14日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  25602. *
  25603. * ### 国内主体开放类目
  25604. *
  25605. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  25606. * | -------------- | -------| -------- |
  25607. * | 电商平台 | / | 售卖商品线下发货、收货、送货服务 |
  25608. * | 商家自营 | / | 提供售卖商品线下发货、收货、送货服务、线下商超导览、导航服务 |
  25609. * | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
  25610. * | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
  25611. * | 生活服务 | / | 上门服务作业等线下场景 |
  25612. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
  25613. * | 餐饮服务 | 点餐平台、外卖平台 | 线下送餐服务 |
  25614. * | 工具 | 天气、信息查询 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询等 |
  25615. * | 金融 | 保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
  25616. * | 旅游 | 景区服务 | 提供景区导航、导览服务 |
  25617. * | 政务民生 | / | 提供政务单位相关业务 |
  25618. * | 政府主体帐号 | / | 提供政务单位相关业务 |
  25619. *
  25620. * ### 海外主体开放类目
  25621. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  25622. * | -------------- | -------| -------- |
  25623. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  25624. * | 快递业与邮政 | / | 快递/货物收发服务 |
  25625. * | 餐饮 | / | 线下送餐服务 |
  25626. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  25627. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  25628. * | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
  25629. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货/超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  25630. * | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
  25631. *
  25632. * **注意**
  25633. *
  25634. * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。 */
  25635. startLocationUpdate<
  25636. T extends StartLocationUpdateOption = StartLocationUpdateOption
  25637. >(
  25638. option: T
  25639. ): PromisifySuccessResult<T, StartLocationUpdateOption>
  25640. /** [wx.startLocationUpdateBackground(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html)
  25641. *
  25642. * 需要基础库: `2.8.0`
  25643. *
  25644. * 在插件中使用:不支持
  25645. *
  25646. * 开启小程序进入前后台时均接收位置消息,需引导用户开启[授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#后台定位)。授权以后,小程序在运行中或进入后台均可接受位置消息变化。
  25647. * ## 使用方法
  25648. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  25649. *
  25650. * ## 申请开通
  25651. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。从2022年7月14日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  25652. *
  25653. * ### 国内主体开放类目
  25654. *
  25655. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  25656. * | -------------- | -------| -------- |
  25657. * | 电商平台 | / | 在小程序内提供线下商超导览、导航服务 |
  25658. * | 商家自营 | / | 在小程序内提供线下商超导览、导航服务 |
  25659. * | 交通服务 | / | 代驾服务、打车出行、城市共享交通、实时导航服务等 |
  25660. * | 生活服务 | 跑腿、共享服务 | 含有B端小程序配送服务,基于地理位置共享工具类服务 |
  25661. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 提供B端小程序快递/货物收发服务 |
  25662. * | 餐饮服务 | 点餐平台、外卖平台 | 提供B端小程序餐饮配送服务、线下门店实时导航 |
  25663. * | 工具 | 健康管理 | 基于实时地理位置提供身体管理记录等服务 |
  25664. * | 旅游 | 景区服务、住宿服务 | 在小程序内提供景区导航、导览服务、酒店导航服务 |
  25665. * | 政务民生 | / | 提供政务单位相关业务 |
  25666. * | 政府主体帐号 | / | 提供政务单位相关业务 |
  25667. *
  25668. * ### 海外主体开放类目
  25669. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  25670. * | -------------- | -------| -------- |
  25671. * | 交通服务 | / | 代驾服务、打车出行、城市共享交通、实时导航服务等 |
  25672. * | 生活服务 | 家政、外送 | 含有B端小程序配送服务,基于地理位置导航上门服务 |
  25673. * | 快递业与邮政 | / | 提供B端小程序快递/货物收发服务 |
  25674. * | 餐饮服务 | 外卖点餐 | 提供B端小程序餐饮配送服务、线下门店实时导航 |
  25675. * | 电商平台 | / | 在小程序内提供线下商超导览、导航服务 |
  25676. * | 跨境电商 | / | 在小程序内提供线下商超导览、导航服务 |
  25677. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货/超市/便利店、宠物食品/用品 | 在小程序内提供线下商超导览、导航服务 |
  25678. *
  25679. * **注意**
  25680. *
  25681. * - 安卓微信7.0.6版本,iOS 7.0.5版本起支持该接口
  25682. * - 需在app.json中配置requiredBackgroundModes: ['location']后使用
  25683. * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。 */
  25684. startLocationUpdateBackground<
  25685. T extends StartLocationUpdateBackgroundOption = StartLocationUpdateBackgroundOption
  25686. >(
  25687. option: T
  25688. ): PromisifySuccessResult<T, StartLocationUpdateBackgroundOption>
  25689. /** [wx.startPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html)
  25690. *
  25691. * 需要基础库: `1.5.0`
  25692. *
  25693. * 在插件中使用:需要基础库 `2.1.0`
  25694. *
  25695. * 在插件中使用时,只能在当前插件的页面中调用
  25696. *
  25697. * 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
  25698. *
  25699. * **示例代码**
  25700. *
  25701. * ```js
  25702. wx.startPullDownRefresh()
  25703. ``` */
  25704. startPullDownRefresh<
  25705. T extends StartPullDownRefreshOption = StartPullDownRefreshOption
  25706. >(
  25707. option?: T
  25708. ): PromisifySuccessResult<T, StartPullDownRefreshOption>
  25709. /** [wx.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html)
  25710. *
  25711. * 在插件中使用:需要基础库 `1.9.6`
  25712. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getRecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html) 替换
  25713. *
  25714. * 开始录音。当主动调用 [wx.stopRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html),或者录音超过1分钟时自动结束录音。当用户离开小程序时,此接口无法调用。
  25715. *
  25716. * **示例代码**
  25717. *
  25718. * ```js
  25719. wx.startRecord({
  25720. success (res) {
  25721. const tempFilePath = res.tempFilePath
  25722. }
  25723. })
  25724. setTimeout(function () {
  25725. wx.stopRecord() // 结束录音
  25726. }, 10000)
  25727. ``` */
  25728. startRecord<T extends WxStartRecordOption = WxStartRecordOption>(
  25729. option?: T
  25730. ): PromisifySuccessResult<T, WxStartRecordOption>
  25731. /** [wx.startSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html)
  25732. *
  25733. * 需要基础库: `1.5.0`
  25734. *
  25735. * 在插件中使用:不支持
  25736. *
  25737. * 开始 SOTER 生物认证。验证流程请参考[说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/bio-auth.html)。
  25738. *
  25739. * **resultJSON 说明**
  25740. *
  25741. * 此数据为设备TEE中,将传入的challenge和TEE内其他安全信息组成的数据进行组装而来的JSON,对下述字段的解释如下表。例子如下:
  25742. * | 字段名 | 说明 |
  25743. * |---------|-------------------------------------------------------------------------------------------|
  25744. * | raw | 调用者传入的challenge |
  25745. * | fid | (仅Android支持)本次生物识别认证的生物信息编号(如指纹识别则是指纹信息在本设备内部编号) |
  25746. * | counter | 防重放特征参数 |
  25747. * | tee_n | TEE名称(如高通或者trustonic等) |
  25748. * | tee_v | TEE版本号 |
  25749. * | fp_n | 指纹以及相关逻辑模块提供商(如FPC等) |
  25750. * | fp_v | 指纹以及相关模块版本号 |
  25751. * | cpu_id | 机器唯一识别ID |
  25752. * | uid | 概念同Android系统定义uid,即应用程序编号 |
  25753. *
  25754. * ```json
  25755. {
  25756. "raw":"msg",
  25757. "fid":"2",
  25758. "counter":123,
  25759. "tee_n":"TEE Name",
  25760. "tee_v":"TEE Version",
  25761. "fp_n":"Fingerprint Sensor Name",
  25762. "fp_v":"Fingerprint Sensor Version",
  25763. "cpu_id":"CPU Id",
  25764. "uid":"21"
  25765. }
  25766. ```
  25767. *
  25768. * **示例代码**
  25769. *
  25770. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/q3tCKkmJ7g2e)
  25771. * ```js
  25772. wx.startSoterAuthentication({
  25773. requestAuthModes: ['fingerPrint'],
  25774. challenge: '123456',
  25775. authContent: '请用指纹解锁',
  25776. success(res) {
  25777. }
  25778. })
  25779. ``` */
  25780. startSoterAuthentication<
  25781. T extends StartSoterAuthenticationOption = StartSoterAuthenticationOption
  25782. >(
  25783. option: T
  25784. ): PromisifySuccessResult<T, StartSoterAuthenticationOption>
  25785. /** [wx.startWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.startWifi.html)
  25786. *
  25787. * 需要基础库: `1.6.0`
  25788. *
  25789. * 在插件中使用:需要基础库 `2.9.1`
  25790. *
  25791. * 初始化 Wi-Fi 模块。
  25792. *
  25793. * **示例代码**
  25794. *
  25795. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/8P7zrkmd7r2n)
  25796. * ```js
  25797. wx.startWifi({
  25798. success (res) {
  25799. console.log(res.errMsg)
  25800. }
  25801. })
  25802. ``` */
  25803. startWifi<T extends StartWifiOption = StartWifiOption>(
  25804. option?: T
  25805. ): PromisifySuccessResult<T, StartWifiOption>
  25806. /** [wx.stopAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html)
  25807. *
  25808. * 需要基础库: `1.1.0`
  25809. *
  25810. * 在插件中使用:需要基础库 `1.9.6`
  25811. *
  25812. * 停止监听加速度数据。
  25813. *
  25814. * **示例代码**
  25815. *
  25816. * ```js
  25817. wx.stopAccelerometer()
  25818. ``` */
  25819. stopAccelerometer<
  25820. T extends StopAccelerometerOption = StopAccelerometerOption
  25821. >(
  25822. option?: T
  25823. ): PromisifySuccessResult<T, StopAccelerometerOption>
  25824. /** [wx.stopBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.stopBackgroundAudio.html)
  25825. *
  25826. * 在插件中使用:需要基础库 `1.9.6`
  25827. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  25828. *
  25829. * 停止播放音乐。
  25830. *
  25831. * **示例代码**
  25832. *
  25833. * ```js
  25834. wx.stopBackgroundAudio()
  25835. ``` */
  25836. stopBackgroundAudio<
  25837. T extends StopBackgroundAudioOption = StopBackgroundAudioOption
  25838. >(
  25839. option?: T
  25840. ): PromisifySuccessResult<T, StopBackgroundAudioOption>
  25841. /** [wx.stopBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html)
  25842. *
  25843. * 需要基础库: `1.2.0`
  25844. *
  25845. * 在插件中使用:需要基础库 `1.9.6`
  25846. *
  25847. * 停止搜索附近的 Beacon 设备 */
  25848. stopBeaconDiscovery<
  25849. T extends StopBeaconDiscoveryOption = StopBeaconDiscoveryOption
  25850. >(
  25851. option?: T
  25852. ): PromisifySuccessResult<T, StopBeaconDiscoveryOption>
  25853. /** [wx.stopBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html)
  25854. *
  25855. * 需要基础库: `1.1.0`
  25856. *
  25857. * 在插件中使用:需要基础库 `1.9.6`
  25858. *
  25859. * 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
  25860. *
  25861. * **示例代码**
  25862. *
  25863. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  25864. * ```js
  25865. wx.stopBluetoothDevicesDiscovery({
  25866. success (res) {
  25867. console.log(res)
  25868. }
  25869. })
  25870. ``` */
  25871. stopBluetoothDevicesDiscovery<
  25872. T extends StopBluetoothDevicesDiscoveryOption = StopBluetoothDevicesDiscoveryOption
  25873. >(
  25874. option?: T
  25875. ): PromisifySuccessResult<T, StopBluetoothDevicesDiscoveryOption>
  25876. /** [wx.stopCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html)
  25877. *
  25878. * 需要基础库: `1.1.0`
  25879. *
  25880. * 在插件中使用:需要基础库 `1.9.6`
  25881. *
  25882. * 停止监听罗盘数据
  25883. *
  25884. * **示例代码**
  25885. *
  25886. * ```js
  25887. wx.stopCompass()
  25888. ``` */
  25889. stopCompass<T extends StopCompassOption = StopCompassOption>(
  25890. option?: T
  25891. ): PromisifySuccessResult<T, StopCompassOption>
  25892. /** [wx.stopDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html)
  25893. *
  25894. * 需要基础库: `2.3.0`
  25895. *
  25896. * 在插件中使用:需要基础库 `2.9.1`
  25897. *
  25898. * 停止监听设备方向的变化。 */
  25899. stopDeviceMotionListening<
  25900. T extends StopDeviceMotionListeningOption = StopDeviceMotionListeningOption
  25901. >(
  25902. option?: T
  25903. ): PromisifySuccessResult<T, StopDeviceMotionListeningOption>
  25904. /** [wx.stopFaceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.stopFaceDetect.html)
  25905. *
  25906. * 需要基础库: `2.18.0`
  25907. *
  25908. * 在插件中使用:需要基础库 `2.21.3`
  25909. *
  25910. * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
  25911. *
  25912. * 停止人脸检测。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html) */
  25913. stopFaceDetect(option?: StopFaceDetectOption): void
  25914. /** [wx.stopGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html)
  25915. *
  25916. * 需要基础库: `2.3.0`
  25917. *
  25918. * 在插件中使用:需要基础库 `2.9.1`
  25919. *
  25920. * 停止监听陀螺仪数据。 */
  25921. stopGyroscope<T extends StopGyroscopeOption = StopGyroscopeOption>(
  25922. option?: T
  25923. ): PromisifySuccessResult<T, StopGyroscopeOption>
  25924. /** [wx.stopHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.stopHCE.html)
  25925. *
  25926. * 需要基础库: `1.7.0`
  25927. *
  25928. * 在插件中使用:需要基础库 `2.1.0`
  25929. *
  25930. * 关闭 NFC 模块。仅在安卓系统下有效。
  25931. *
  25932. * **示例代码**
  25933. *
  25934. * ```js
  25935. wx.stopHCE({
  25936. success (res) {
  25937. console.log(res.errMsg)
  25938. }
  25939. })
  25940. ``` */
  25941. stopHCE<T extends StopHCEOption = StopHCEOption>(
  25942. option?: T
  25943. ): PromisifySuccessResult<T, StopHCEOption>
  25944. /** [wx.stopLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.stopLocalServiceDiscovery.html)
  25945. *
  25946. * 需要基础库: `2.4.0`
  25947. *
  25948. * 在插件中使用:需要基础库 `2.15.0`
  25949. *
  25950. * 停止搜索 mDNS 服务 */
  25951. stopLocalServiceDiscovery<
  25952. T extends StopLocalServiceDiscoveryOption = StopLocalServiceDiscoveryOption
  25953. >(
  25954. option?: T
  25955. ): PromisifySuccessResult<T, StopLocalServiceDiscoveryOption>
  25956. /** [wx.stopLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html)
  25957. *
  25958. * 需要基础库: `2.8.0`
  25959. *
  25960. * 在插件中使用:需要基础库 `2.8.0`
  25961. *
  25962. * 关闭监听实时位置变化,前后台都停止消息接收 */
  25963. stopLocationUpdate<
  25964. T extends StopLocationUpdateOption = StopLocationUpdateOption
  25965. >(
  25966. option?: T
  25967. ): PromisifySuccessResult<T, StopLocationUpdateOption>
  25968. /** [wx.stopPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html)
  25969. *
  25970. * 需要基础库: `1.5.0`
  25971. *
  25972. * 在插件中使用:需要基础库 `2.1.0`
  25973. *
  25974. * 在插件中使用时,只能在当前插件的页面中调用
  25975. *
  25976. * 停止当前页面下拉刷新。
  25977. *
  25978. * **示例代码**
  25979. *
  25980. * ```js
  25981. Page({
  25982. onPullDownRefresh () {
  25983. wx.stopPullDownRefresh()
  25984. }
  25985. })
  25986. ``` */
  25987. stopPullDownRefresh<
  25988. T extends StopPullDownRefreshOption = StopPullDownRefreshOption
  25989. >(
  25990. option?: T
  25991. ): PromisifySuccessResult<T, StopPullDownRefreshOption>
  25992. /** [wx.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html)
  25993. *
  25994. * 在插件中使用:需要基础库 `1.9.6`
  25995. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getRecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html) 替换
  25996. *
  25997. * 停止录音。
  25998. *
  25999. * **示例代码**
  26000. *
  26001. * ```js
  26002. wx.startRecord({
  26003. success (res) {
  26004. const tempFilePath = res.tempFilePath
  26005. }
  26006. })
  26007. setTimeout(function () {
  26008. wx.stopRecord() // 结束录音
  26009. }, 10000)
  26010. ``` */
  26011. stopRecord<T extends WxStopRecordOption = WxStopRecordOption>(
  26012. option?: T
  26013. ): PromisifySuccessResult<T, WxStopRecordOption>
  26014. /** [wx.stopVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html)
  26015. *
  26016. * 在插件中使用:需要基础库 `1.9.6`
  26017. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  26018. *
  26019. * 结束播放语音。
  26020. *
  26021. * **示例代码**
  26022. *
  26023. * ```js
  26024. wx.startRecord({
  26025. success (res) {
  26026. const tempFilePath = res.tempFilePath
  26027. wx.playVoice({
  26028. filePath: tempFilePath,
  26029. })
  26030. setTimeout(() => { wx.stopVoice() }, 5000)
  26031. }
  26032. })
  26033. ``` */
  26034. stopVoice<T extends StopVoiceOption = StopVoiceOption>(
  26035. option?: T
  26036. ): PromisifySuccessResult<T, StopVoiceOption>
  26037. /** [wx.stopWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.stopWifi.html)
  26038. *
  26039. * 需要基础库: `1.6.0`
  26040. *
  26041. * 在插件中使用:需要基础库 `2.9.1`
  26042. *
  26043. * 关闭 Wi-Fi 模块。
  26044. *
  26045. * **示例代码**
  26046. *
  26047. * ```js
  26048. wx.stopWifi({
  26049. success (res) {
  26050. console.log(res.errMsg)
  26051. }
  26052. })
  26053. ``` */
  26054. stopWifi<T extends StopWifiOption = StopWifiOption>(
  26055. option?: T
  26056. ): PromisifySuccessResult<T, StopWifiOption>
  26057. /** [wx.subscribeVoIPVideoMembers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.subscribeVoIPVideoMembers.html)
  26058. *
  26059. * 需要基础库: `2.11.0`
  26060. *
  26061. * 在插件中使用:需要基础库 `2.11.0`
  26062. *
  26063. * 订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。 */
  26064. subscribeVoIPVideoMembers<
  26065. T extends SubscribeVoIPVideoMembersOption = SubscribeVoIPVideoMembersOption
  26066. >(
  26067. option: T
  26068. ): PromisifySuccessResult<T, SubscribeVoIPVideoMembersOption>
  26069. /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html)
  26070. *
  26071. * 在插件中使用:需要基础库 `2.3.1`
  26072. *
  26073. * 在插件中使用时,只能在当前插件的页面中调用
  26074. *
  26075. * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
  26076. *
  26077. * **示例代码**
  26078. *
  26079. * ```json
  26080. // app.json
  26081. {
  26082. "tabBar": {
  26083. "list": [{
  26084. "pagePath": "index",
  26085. "text": "首页"
  26086. },{
  26087. "pagePath": "other",
  26088. "text": "其他"
  26089. }]
  26090. }
  26091. }
  26092. ```
  26093. *
  26094. * ```js
  26095. wx.switchTab({
  26096. url: '/index'
  26097. })
  26098. ``` */
  26099. switchTab<T extends SwitchTabOption = SwitchTabOption>(
  26100. option: T
  26101. ): PromisifySuccessResult<T, SwitchTabOption>
  26102. /** [wx.updateShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html)
  26103. *
  26104. * 需要基础库: `1.2.0`
  26105. *
  26106. * 在插件中使用:需要基础库 `2.1.0`
  26107. *
  26108. * 在插件中使用时,只能在当前插件的页面中调用
  26109. *
  26110. * 更新转发属性
  26111. *
  26112. * **示例代码**
  26113. *
  26114. * ```js
  26115. wx.updateShareMenu({
  26116. withShareTicket: true,
  26117. success () { }
  26118. })
  26119. ```
  26120. * ```js
  26121. // 转发私密消息
  26122. wx.updateShareMenu({
  26123. isPrivateMessage: true,
  26124. activityId: 'xxx',
  26125. templateInfo: {},
  26126. success () { },
  26127. fail () {}
  26128. })
  26129. ``` */
  26130. updateShareMenu<
  26131. T extends UpdateShareMenuOption = UpdateShareMenuOption
  26132. >(
  26133. option: T
  26134. ): PromisifySuccessResult<T, UpdateShareMenuOption>
  26135. /** [wx.updateVoIPChatMuteConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.updateVoIPChatMuteConfig.html)
  26136. *
  26137. * 需要基础库: `2.7.0`
  26138. *
  26139. * 在插件中使用:需要基础库 `2.9.0`
  26140. *
  26141. * 更新实时语音静音设置 */
  26142. updateVoIPChatMuteConfig<
  26143. T extends UpdateVoIPChatMuteConfigOption = UpdateVoIPChatMuteConfigOption
  26144. >(
  26145. option: T
  26146. ): PromisifySuccessResult<T, UpdateVoIPChatMuteConfigOption>
  26147. /** [wx.updateWeChatApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.updateWeChatApp.html)
  26148. *
  26149. * 需要基础库: `2.12.0`
  26150. *
  26151. * 在插件中使用:需要基础库 `2.12.0`
  26152. *
  26153. * 更新客户端版本。当判断用户小程序所在客户端版本过低时,可使用该接口跳转到更新微信页面。 */
  26154. updateWeChatApp<
  26155. T extends UpdateWeChatAppOption = UpdateWeChatAppOption
  26156. >(
  26157. option?: T
  26158. ): PromisifySuccessResult<T, UpdateWeChatAppOption>
  26159. /** [wx.vibrateLong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html)
  26160. *
  26161. * 需要基础库: `1.2.0`
  26162. *
  26163. * 在插件中使用:需要基础库 `1.9.6`
  26164. *
  26165. * 使手机发生较长时间的振动(400 ms) */
  26166. vibrateLong<T extends VibrateLongOption = VibrateLongOption>(
  26167. option?: T
  26168. ): PromisifySuccessResult<T, VibrateLongOption>
  26169. /** [wx.vibrateShort(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateShort.html)
  26170. *
  26171. * 需要基础库: `1.2.0`
  26172. *
  26173. * 在插件中使用:需要基础库 `1.9.6`
  26174. *
  26175. * 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效 */
  26176. vibrateShort<T extends VibrateShortOption = VibrateShortOption>(
  26177. option: T
  26178. ): PromisifySuccessResult<T, VibrateShortOption>
  26179. /** [wx.writeBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html)
  26180. *
  26181. * 需要基础库: `1.1.0`
  26182. *
  26183. * 在插件中使用:需要基础库 `1.9.6`
  26184. *
  26185. * 向蓝牙低功耗设备特征值中写入二进制数据。注意:必须设备的特征支持 write 才可以成功调用。
  26186. *
  26187. * **注意**
  26188. *
  26189. * - 并行调用多次会存在写失败的可能性。
  26190. * - 小程序不会对写入数据包大小做限制,但系统与蓝牙设备会限制蓝牙 4.0 单次传输的数据大小,超过最大字节数后会发生写入错误,建议每次写入不超过 20 字节。
  26191. * - 若单次写入数据过长,iOS 上存在系统不会有任何回调的情况(包括错误回调)。
  26192. * - 安卓平台上,在调用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 成功后立即调用本接口,在部分机型上会发生 10008 系统错误
  26193. *
  26194. * **示例代码**
  26195. *
  26196. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  26197. * ```js
  26198. // 向蓝牙设备发送一个0x00的16进制数据
  26199. let buffer = new ArrayBuffer(1)
  26200. let dataView = new DataView(buffer)
  26201. dataView.setUint8(0, 0)
  26202. wx.writeBLECharacteristicValue({
  26203. // 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
  26204. deviceId,
  26205. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  26206. serviceId,
  26207. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  26208. characteristicId,
  26209. // 这里的value是ArrayBuffer类型
  26210. value: buffer,
  26211. success (res) {
  26212. console.log('writeBLECharacteristicValue success', res.errMsg)
  26213. }
  26214. })
  26215. ``` */
  26216. writeBLECharacteristicValue<
  26217. T extends WriteBLECharacteristicValueOption = WriteBLECharacteristicValueOption
  26218. >(
  26219. option: T
  26220. ): PromisifySuccessResult<T, WriteBLECharacteristicValueOption>
  26221. /** 小程序云开发 */
  26222. cloud: WxCloud
  26223. /** 文件系统中的用户目录路径 */
  26224. env: { USER_DATA_PATH: string }
  26225. /** 获得 xr-frame 接口系统 */
  26226. getXrFrameSystem(): import('XrFrame').IXrFrameSystem
  26227. /** 需要基础库: `2.25.2`
  26228. *
  26229. * worklet 对象,可以通过 [wx.worklet](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html) 获取。 */
  26230. worklet: Worklet
  26231. }
  26232. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26233. type AccessCompleteCallback = (res: GeneralCallbackResult) => void
  26234. /** 接口调用失败的回调函数 */
  26235. type AccessFailCallback = (result: AccessFailCallbackResult) => void
  26236. /** 接口调用成功的回调函数 */
  26237. type AccessSuccessCallback = (res: GeneralCallbackResult) => void
  26238. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26239. type AddArcCompleteCallback = (res: GeneralCallbackResult) => void
  26240. /** 接口调用失败的回调函数 */
  26241. type AddArcFailCallback = (res: GeneralCallbackResult) => void
  26242. /** 接口调用成功的回调函数 */
  26243. type AddArcSuccessCallback = (res: GeneralCallbackResult) => void
  26244. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26245. type AddCardCompleteCallback = (res: GeneralCallbackResult) => void
  26246. /** 接口调用失败的回调函数 */
  26247. type AddCardFailCallback = (res: GeneralCallbackResult) => void
  26248. /** 接口调用成功的回调函数 */
  26249. type AddCardSuccessCallback = (result: AddCardSuccessCallbackResult) => void
  26250. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26251. type AddCustomLayerCompleteCallback = (res: GeneralCallbackResult) => void
  26252. /** 接口调用失败的回调函数 */
  26253. type AddCustomLayerFailCallback = (res: GeneralCallbackResult) => void
  26254. /** 接口调用成功的回调函数 */
  26255. type AddCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void
  26256. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26257. type AddFileToFavoritesCompleteCallback = (
  26258. res: GeneralCallbackResult
  26259. ) => void
  26260. /** 接口调用失败的回调函数 */
  26261. type AddFileToFavoritesFailCallback = (res: GeneralCallbackResult) => void
  26262. /** 接口调用成功的回调函数 */
  26263. type AddFileToFavoritesSuccessCallback = (
  26264. res: GeneralCallbackResult
  26265. ) => void
  26266. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26267. type AddGroundOverlayCompleteCallback = (res: GeneralCallbackResult) => void
  26268. /** 接口调用失败的回调函数 */
  26269. type AddGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  26270. /** 接口调用成功的回调函数 */
  26271. type AddGroundOverlaySuccessCallback = (res: GeneralCallbackResult) => void
  26272. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26273. type AddMarkersCompleteCallback = (res: GeneralCallbackResult) => void
  26274. /** 接口调用失败的回调函数 */
  26275. type AddMarkersFailCallback = (res: GeneralCallbackResult) => void
  26276. /** 接口调用成功的回调函数 */
  26277. type AddMarkersSuccessCallback = (res: GeneralCallbackResult) => void
  26278. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26279. type AddPhoneCalendarCompleteCallback = (res: GeneralCallbackResult) => void
  26280. /** 接口调用失败的回调函数 */
  26281. type AddPhoneCalendarFailCallback = (res: GeneralCallbackResult) => void
  26282. /** 接口调用成功的回调函数 */
  26283. type AddPhoneCalendarSuccessCallback = (res: GeneralCallbackResult) => void
  26284. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26285. type AddPhoneContactCompleteCallback = (res: GeneralCallbackResult) => void
  26286. /** 接口调用失败的回调函数 */
  26287. type AddPhoneContactFailCallback = (res: GeneralCallbackResult) => void
  26288. /** 接口调用成功的回调函数 */
  26289. type AddPhoneContactSuccessCallback = (res: GeneralCallbackResult) => void
  26290. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26291. type AddPhoneRepeatCalendarCompleteCallback = (
  26292. res: GeneralCallbackResult
  26293. ) => void
  26294. /** 接口调用失败的回调函数 */
  26295. type AddPhoneRepeatCalendarFailCallback = (
  26296. res: GeneralCallbackResult
  26297. ) => void
  26298. /** 接口调用成功的回调函数 */
  26299. type AddPhoneRepeatCalendarSuccessCallback = (
  26300. res: GeneralCallbackResult
  26301. ) => void
  26302. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26303. type AddServiceCompleteCallback = (res: GeneralCallbackResult) => void
  26304. /** 接口调用失败的回调函数 */
  26305. type AddServiceFailCallback = (res: GeneralCallbackResult) => void
  26306. /** 接口调用成功的回调函数 */
  26307. type AddServiceSuccessCallback = (res: GeneralCallbackResult) => void
  26308. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26309. type AddVideoToFavoritesCompleteCallback = (
  26310. res: GeneralCallbackResult
  26311. ) => void
  26312. /** 接口调用失败的回调函数 */
  26313. type AddVideoToFavoritesFailCallback = (res: GeneralCallbackResult) => void
  26314. /** 接口调用成功的回调函数 */
  26315. type AddVideoToFavoritesSuccessCallback = (
  26316. res: GeneralCallbackResult
  26317. ) => void
  26318. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26319. type AddVisualLayerCompleteCallback = (res: GeneralCallbackResult) => void
  26320. /** 接口调用失败的回调函数 */
  26321. type AddVisualLayerFailCallback = (res: GeneralCallbackResult) => void
  26322. /** 接口调用成功的回调函数 */
  26323. type AddVisualLayerSuccessCallback = (res: GeneralCallbackResult) => void
  26324. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26325. type AppendFileCompleteCallback = (res: GeneralCallbackResult) => void
  26326. /** 接口调用失败的回调函数 */
  26327. type AppendFileFailCallback = (result: AppendFileFailCallbackResult) => void
  26328. /** 接口调用成功的回调函数 */
  26329. type AppendFileSuccessCallback = (res: GeneralCallbackResult) => void
  26330. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26331. type ApplyBlusherStickMakeupCompleteCallback = (
  26332. res: GeneralCallbackResult
  26333. ) => void
  26334. /** 接口调用失败的回调函数 */
  26335. type ApplyBlusherStickMakeupFailCallback = (
  26336. res: GeneralCallbackResult
  26337. ) => void
  26338. /** 接口调用成功的回调函数 */
  26339. type ApplyBlusherStickMakeupSuccessCallback = (
  26340. res: GeneralCallbackResult
  26341. ) => void
  26342. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26343. type ApplyEyeBrowMakeupCompleteCallback = (
  26344. res: GeneralCallbackResult
  26345. ) => void
  26346. /** 接口调用失败的回调函数 */
  26347. type ApplyEyeBrowMakeupFailCallback = (res: GeneralCallbackResult) => void
  26348. /** 接口调用成功的回调函数 */
  26349. type ApplyEyeBrowMakeupSuccessCallback = (
  26350. res: GeneralCallbackResult
  26351. ) => void
  26352. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26353. type ApplyEyeShadowMakeupCompleteCallback = (
  26354. res: GeneralCallbackResult
  26355. ) => void
  26356. /** 接口调用失败的回调函数 */
  26357. type ApplyEyeShadowMakeupFailCallback = (res: GeneralCallbackResult) => void
  26358. /** 接口调用成功的回调函数 */
  26359. type ApplyEyeShadowMakeupSuccessCallback = (
  26360. res: GeneralCallbackResult
  26361. ) => void
  26362. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26363. type ApplyFaceContourMakeupCompleteCallback = (
  26364. res: GeneralCallbackResult
  26365. ) => void
  26366. /** 接口调用失败的回调函数 */
  26367. type ApplyFaceContourMakeupFailCallback = (
  26368. res: GeneralCallbackResult
  26369. ) => void
  26370. /** 接口调用成功的回调函数 */
  26371. type ApplyFaceContourMakeupSuccessCallback = (
  26372. res: GeneralCallbackResult
  26373. ) => void
  26374. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26375. type ApplyFilterCompleteCallback = (res: GeneralCallbackResult) => void
  26376. /** 接口调用失败的回调函数 */
  26377. type ApplyFilterFailCallback = (res: GeneralCallbackResult) => void
  26378. /** 接口调用成功的回调函数 */
  26379. type ApplyFilterSuccessCallback = (res: GeneralCallbackResult) => void
  26380. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26381. type ApplyLipStickMakeupCompleteCallback = (
  26382. res: GeneralCallbackResult
  26383. ) => void
  26384. /** 接口调用失败的回调函数 */
  26385. type ApplyLipStickMakeupFailCallback = (res: GeneralCallbackResult) => void
  26386. /** 接口调用成功的回调函数 */
  26387. type ApplyLipStickMakeupSuccessCallback = (
  26388. res: GeneralCallbackResult
  26389. ) => void
  26390. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26391. type ApplyStickerCompleteCallback = (res: GeneralCallbackResult) => void
  26392. /** 接口调用失败的回调函数 */
  26393. type ApplyStickerFailCallback = (res: GeneralCallbackResult) => void
  26394. /** 接口调用成功的回调函数 */
  26395. type ApplyStickerSuccessCallback = (res: GeneralCallbackResult) => void
  26396. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26397. type AuthPrivateMessageCompleteCallback = (
  26398. res: GeneralCallbackResult
  26399. ) => void
  26400. /** 接口调用失败的回调函数 */
  26401. type AuthPrivateMessageFailCallback = (res: GeneralCallbackResult) => void
  26402. /** 接口调用成功的回调函数 */
  26403. type AuthPrivateMessageSuccessCallback = (
  26404. result: AuthPrivateMessageSuccessCallbackResult
  26405. ) => void
  26406. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26407. type AuthorizeCompleteCallback = (res: GeneralCallbackResult) => void
  26408. /** 接口调用失败的回调函数 */
  26409. type AuthorizeFailCallback = (res: GeneralCallbackResult) => void
  26410. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26411. type AuthorizeForMiniProgramCompleteCallback = (
  26412. res: GeneralCallbackResult
  26413. ) => void
  26414. /** 接口调用失败的回调函数 */
  26415. type AuthorizeForMiniProgramFailCallback = (
  26416. res: GeneralCallbackResult
  26417. ) => void
  26418. /** 接口调用成功的回调函数 */
  26419. type AuthorizeForMiniProgramSuccessCallback = (
  26420. res: GeneralCallbackResult
  26421. ) => void
  26422. /** 接口调用成功的回调函数 */
  26423. type AuthorizeSuccessCallback = (res: GeneralCallbackResult) => void
  26424. /** 背景音频播放错误事件的监听函数 */
  26425. type BackgroundAudioManagerOnErrorCallback = (
  26426. res: GeneralCallbackResult
  26427. ) => void
  26428. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26429. type BatchGetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  26430. /** 接口调用失败的回调函数 */
  26431. type BatchGetStorageFailCallback = (res: GeneralCallbackResult) => void
  26432. /** 接口调用成功的回调函数 */
  26433. type BatchGetStorageSuccessCallback = (res: GeneralCallbackResult) => void
  26434. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26435. type BatchSetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  26436. /** 接口调用失败的回调函数 */
  26437. type BatchSetStorageFailCallback = (res: GeneralCallbackResult) => void
  26438. /** 接口调用成功的回调函数 */
  26439. type BatchSetStorageSuccessCallback = (res: GeneralCallbackResult) => void
  26440. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26441. type BlurCompleteCallback = (res: GeneralCallbackResult) => void
  26442. /** 接口调用失败的回调函数 */
  26443. type BlurFailCallback = (res: GeneralCallbackResult) => void
  26444. /** 接口调用成功的回调函数 */
  26445. type BlurSuccessCallback = (res: GeneralCallbackResult) => void
  26446. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  26447. type BoundingClientRectCallback = (
  26448. result: BoundingClientRectCallbackResult
  26449. ) => void
  26450. /** 接口调用成功的回调函数 */
  26451. type CameraContextStartRecordSuccessCallback = (
  26452. res: GeneralCallbackResult
  26453. ) => void
  26454. /** 接口调用成功的回调函数 */
  26455. type CameraContextStopRecordSuccessCallback = (
  26456. result: StopRecordSuccessCallbackResult
  26457. ) => void
  26458. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26459. type CanvasGetImageDataCompleteCallback = (
  26460. res: GeneralCallbackResult
  26461. ) => void
  26462. /** 接口调用失败的回调函数 */
  26463. type CanvasGetImageDataFailCallback = (res: GeneralCallbackResult) => void
  26464. /** 接口调用成功的回调函数 */
  26465. type CanvasGetImageDataSuccessCallback = (
  26466. result: CanvasGetImageDataSuccessCallbackResult
  26467. ) => void
  26468. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26469. type CanvasPutImageDataCompleteCallback = (
  26470. res: GeneralCallbackResult
  26471. ) => void
  26472. /** 接口调用失败的回调函数 */
  26473. type CanvasPutImageDataFailCallback = (res: GeneralCallbackResult) => void
  26474. /** 接口调用成功的回调函数 */
  26475. type CanvasPutImageDataSuccessCallback = (
  26476. res: GeneralCallbackResult
  26477. ) => void
  26478. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26479. type CanvasToTempFilePathCompleteCallback = (
  26480. res: GeneralCallbackResult
  26481. ) => void
  26482. /** 接口调用失败的回调函数 */
  26483. type CanvasToTempFilePathFailCallback = (res: GeneralCallbackResult) => void
  26484. /** 接口调用成功的回调函数 */
  26485. type CanvasToTempFilePathSuccessCallback = (
  26486. result: CanvasToTempFilePathSuccessCallbackResult
  26487. ) => void
  26488. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26489. type CheckIsAddedToMyMiniProgramCompleteCallback = (
  26490. res: GeneralCallbackResult
  26491. ) => void
  26492. /** 接口调用失败的回调函数 */
  26493. type CheckIsAddedToMyMiniProgramFailCallback = (
  26494. res: GeneralCallbackResult
  26495. ) => void
  26496. /** 接口调用成功的回调函数 */
  26497. type CheckIsAddedToMyMiniProgramSuccessCallback = (
  26498. result: CheckIsAddedToMyMiniProgramSuccessCallbackResult
  26499. ) => void
  26500. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26501. type CheckIsOpenAccessibilityCompleteCallback = (
  26502. res: GeneralCallbackResult
  26503. ) => void
  26504. /** 接口调用失败的回调函数 */
  26505. type CheckIsOpenAccessibilityFailCallback = (
  26506. res: GeneralCallbackResult
  26507. ) => void
  26508. /** 接口调用成功的回调函数 */
  26509. type CheckIsOpenAccessibilitySuccessCallback = (
  26510. option: CheckIsOpenAccessibilitySuccessCallbackOption
  26511. ) => void
  26512. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26513. type CheckIsSoterEnrolledInDeviceCompleteCallback = (
  26514. res: GeneralCallbackResult
  26515. ) => void
  26516. /** 接口调用失败的回调函数 */
  26517. type CheckIsSoterEnrolledInDeviceFailCallback = (
  26518. res: GeneralCallbackResult
  26519. ) => void
  26520. /** 接口调用成功的回调函数 */
  26521. type CheckIsSoterEnrolledInDeviceSuccessCallback = (
  26522. result: CheckIsSoterEnrolledInDeviceSuccessCallbackResult
  26523. ) => void
  26524. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26525. type CheckIsSupportSoterAuthenticationCompleteCallback = (
  26526. res: GeneralCallbackResult
  26527. ) => void
  26528. /** 接口调用失败的回调函数 */
  26529. type CheckIsSupportSoterAuthenticationFailCallback = (
  26530. res: GeneralCallbackResult
  26531. ) => void
  26532. /** 接口调用成功的回调函数 */
  26533. type CheckIsSupportSoterAuthenticationSuccessCallback = (
  26534. result: CheckIsSupportSoterAuthenticationSuccessCallbackResult
  26535. ) => void
  26536. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26537. type CheckSessionCompleteCallback = (res: GeneralCallbackResult) => void
  26538. /** 接口调用失败的回调函数 */
  26539. type CheckSessionFailCallback = (res: GeneralCallbackResult) => void
  26540. /** 接口调用成功的回调函数 */
  26541. type CheckSessionSuccessCallback = (res: GeneralCallbackResult) => void
  26542. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26543. type ChooseAddressCompleteCallback = (res: GeneralCallbackResult) => void
  26544. /** 接口调用失败的回调函数 */
  26545. type ChooseAddressFailCallback = (res: GeneralCallbackResult) => void
  26546. /** 接口调用成功的回调函数 */
  26547. type ChooseAddressSuccessCallback = (
  26548. result: ChooseAddressSuccessCallbackResult
  26549. ) => void
  26550. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26551. type ChooseContactCompleteCallback = (res: GeneralCallbackResult) => void
  26552. /** 接口调用失败的回调函数 */
  26553. type ChooseContactFailCallback = (res: GeneralCallbackResult) => void
  26554. /** 接口调用成功的回调函数 */
  26555. type ChooseContactSuccessCallback = (
  26556. option: ChooseContactSuccessCallbackOption
  26557. ) => void
  26558. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26559. type ChooseImageCompleteCallback = (res: GeneralCallbackResult) => void
  26560. /** 接口调用失败的回调函数 */
  26561. type ChooseImageFailCallback = (res: GeneralCallbackResult) => void
  26562. /** 接口调用成功的回调函数 */
  26563. type ChooseImageSuccessCallback = (
  26564. result: ChooseImageSuccessCallbackResult
  26565. ) => void
  26566. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26567. type ChooseInvoiceCompleteCallback = (res: GeneralCallbackResult) => void
  26568. /** 接口调用失败的回调函数 */
  26569. type ChooseInvoiceFailCallback = (res: GeneralCallbackResult) => void
  26570. /** 接口调用成功的回调函数 */
  26571. type ChooseInvoiceSuccessCallback = (
  26572. result: ChooseInvoiceSuccessCallbackResult
  26573. ) => void
  26574. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26575. type ChooseInvoiceTitleCompleteCallback = (
  26576. res: GeneralCallbackResult
  26577. ) => void
  26578. /** 接口调用失败的回调函数 */
  26579. type ChooseInvoiceTitleFailCallback = (res: GeneralCallbackResult) => void
  26580. /** 接口调用成功的回调函数 */
  26581. type ChooseInvoiceTitleSuccessCallback = (
  26582. result: ChooseInvoiceTitleSuccessCallbackResult
  26583. ) => void
  26584. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26585. type ChooseLicensePlateCompleteCallback = (
  26586. res: GeneralCallbackResult
  26587. ) => void
  26588. /** 接口调用失败的回调函数 */
  26589. type ChooseLicensePlateFailCallback = (res: GeneralCallbackResult) => void
  26590. /** 接口调用成功的回调函数 */
  26591. type ChooseLicensePlateSuccessCallback = (
  26592. result: ChooseLicensePlateSuccessCallbackResult
  26593. ) => void
  26594. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26595. type ChooseLocationCompleteCallback = (res: GeneralCallbackResult) => void
  26596. /** 接口调用失败的回调函数 */
  26597. type ChooseLocationFailCallback = (res: GeneralCallbackResult) => void
  26598. /** 接口调用成功的回调函数 */
  26599. type ChooseLocationSuccessCallback = (
  26600. result: ChooseLocationSuccessCallbackResult
  26601. ) => void
  26602. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26603. type ChooseMediaCompleteCallback = (res: GeneralCallbackResult) => void
  26604. /** 接口调用失败的回调函数 */
  26605. type ChooseMediaFailCallback = (res: GeneralCallbackResult) => void
  26606. /** 接口调用成功的回调函数 */
  26607. type ChooseMediaSuccessCallback = (
  26608. result: ChooseMediaSuccessCallbackResult
  26609. ) => void
  26610. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26611. type ChooseMessageFileCompleteCallback = (
  26612. res: GeneralCallbackResult
  26613. ) => void
  26614. /** 接口调用失败的回调函数 */
  26615. type ChooseMessageFileFailCallback = (res: GeneralCallbackResult) => void
  26616. /** 接口调用成功的回调函数 */
  26617. type ChooseMessageFileSuccessCallback = (
  26618. result: ChooseMessageFileSuccessCallbackResult
  26619. ) => void
  26620. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26621. type ChoosePoiCompleteCallback = (res: GeneralCallbackResult) => void
  26622. /** 接口调用失败的回调函数 */
  26623. type ChoosePoiFailCallback = (res: GeneralCallbackResult) => void
  26624. /** 接口调用成功的回调函数 */
  26625. type ChoosePoiSuccessCallback = (
  26626. result: ChoosePoiSuccessCallbackResult
  26627. ) => void
  26628. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26629. type ChooseVideoCompleteCallback = (res: GeneralCallbackResult) => void
  26630. /** 接口调用失败的回调函数 */
  26631. type ChooseVideoFailCallback = (res: GeneralCallbackResult) => void
  26632. /** 接口调用成功的回调函数 */
  26633. type ChooseVideoSuccessCallback = (
  26634. result: ChooseVideoSuccessCallbackResult
  26635. ) => void
  26636. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26637. type ClearCompleteCallback = (res: GeneralCallbackResult) => void
  26638. /** 接口调用失败的回调函数 */
  26639. type ClearFailCallback = (res: GeneralCallbackResult) => void
  26640. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26641. type ClearFiltersCompleteCallback = (res: GeneralCallbackResult) => void
  26642. /** 接口调用失败的回调函数 */
  26643. type ClearFiltersFailCallback = (res: GeneralCallbackResult) => void
  26644. /** 接口调用成功的回调函数 */
  26645. type ClearFiltersSuccessCallback = (res: GeneralCallbackResult) => void
  26646. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26647. type ClearMakeupsCompleteCallback = (res: GeneralCallbackResult) => void
  26648. /** 接口调用失败的回调函数 */
  26649. type ClearMakeupsFailCallback = (res: GeneralCallbackResult) => void
  26650. /** 接口调用成功的回调函数 */
  26651. type ClearMakeupsSuccessCallback = (res: GeneralCallbackResult) => void
  26652. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26653. type ClearStickersCompleteCallback = (res: GeneralCallbackResult) => void
  26654. /** 接口调用失败的回调函数 */
  26655. type ClearStickersFailCallback = (res: GeneralCallbackResult) => void
  26656. /** 接口调用成功的回调函数 */
  26657. type ClearStickersSuccessCallback = (res: GeneralCallbackResult) => void
  26658. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26659. type ClearStorageCompleteCallback = (res: GeneralCallbackResult) => void
  26660. /** 接口调用失败的回调函数 */
  26661. type ClearStorageFailCallback = (res: GeneralCallbackResult) => void
  26662. /** 接口调用成功的回调函数 */
  26663. type ClearStorageSuccessCallback = (res: GeneralCallbackResult) => void
  26664. /** 接口调用成功的回调函数 */
  26665. type ClearSuccessCallback = (res: GeneralCallbackResult) => void
  26666. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26667. type CloseBLEConnectionCompleteCallback = (res: BluetoothError) => void
  26668. /** 接口调用失败的回调函数 */
  26669. type CloseBLEConnectionFailCallback = (res: BluetoothError) => void
  26670. /** 接口调用成功的回调函数 */
  26671. type CloseBLEConnectionSuccessCallback = (res: BluetoothError) => void
  26672. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26673. type CloseBluetoothAdapterCompleteCallback = (res: BluetoothError) => void
  26674. /** 接口调用失败的回调函数 */
  26675. type CloseBluetoothAdapterFailCallback = (res: BluetoothError) => void
  26676. /** 接口调用成功的回调函数 */
  26677. type CloseBluetoothAdapterSuccessCallback = (res: BluetoothError) => void
  26678. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26679. type CloseSocketCompleteCallback = (res: GeneralCallbackResult) => void
  26680. /** 接口调用失败的回调函数 */
  26681. type CloseSocketFailCallback = (res: GeneralCallbackResult) => void
  26682. /** 接口调用成功的回调函数 */
  26683. type CloseSocketSuccessCallback = (res: GeneralCallbackResult) => void
  26684. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26685. type CompressImageCompleteCallback = (res: GeneralCallbackResult) => void
  26686. /** 接口调用失败的回调函数 */
  26687. type CompressImageFailCallback = (res: GeneralCallbackResult) => void
  26688. /** 接口调用成功的回调函数 */
  26689. type CompressImageSuccessCallback = (
  26690. result: CompressImageSuccessCallbackResult
  26691. ) => void
  26692. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26693. type CompressVideoCompleteCallback = (res: GeneralCallbackResult) => void
  26694. /** 接口调用失败的回调函数 */
  26695. type CompressVideoFailCallback = (res: GeneralCallbackResult) => void
  26696. /** 接口调用成功的回调函数 */
  26697. type CompressVideoSuccessCallback = (
  26698. result: CompressVideoSuccessCallbackResult
  26699. ) => void
  26700. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26701. type ConnectCompleteCallback = (res: Nfcrwerror) => void
  26702. /** 接口调用失败的回调函数 */
  26703. type ConnectFailCallback = (res: Nfcrwerror) => void
  26704. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26705. type ConnectSocketCompleteCallback = (res: GeneralCallbackResult) => void
  26706. /** 接口调用失败的回调函数 */
  26707. type ConnectSocketFailCallback = (res: GeneralCallbackResult) => void
  26708. /** 接口调用成功的回调函数 */
  26709. type ConnectSocketSuccessCallback = (res: GeneralCallbackResult) => void
  26710. /** 接口调用成功的回调函数 */
  26711. type ConnectSuccessCallback = (res: Nfcrwerror) => void
  26712. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26713. type ConnectWifiCompleteCallback = (res: WifiError) => void
  26714. /** 接口调用失败的回调函数 */
  26715. type ConnectWifiFailCallback = (res: WifiError) => void
  26716. /** 接口调用成功的回调函数 */
  26717. type ConnectWifiSuccessCallback = (res: WifiError) => void
  26718. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  26719. type ContextCallback = (result: ContextCallbackResult) => void
  26720. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26721. type CopyFileCompleteCallback = (res: GeneralCallbackResult) => void
  26722. /** 接口调用失败的回调函数 */
  26723. type CopyFileFailCallback = (result: CopyFileFailCallbackResult) => void
  26724. /** 接口调用成功的回调函数 */
  26725. type CopyFileSuccessCallback = (res: GeneralCallbackResult) => void
  26726. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26727. type CreateBLEConnectionCompleteCallback = (res: BluetoothError) => void
  26728. /** 接口调用失败的回调函数 */
  26729. type CreateBLEConnectionFailCallback = (res: BluetoothError) => void
  26730. /** 接口调用成功的回调函数 */
  26731. type CreateBLEConnectionSuccessCallback = (res: BluetoothError) => void
  26732. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26733. type CreateBLEPeripheralServerCompleteCallback = (
  26734. res: GeneralCallbackResult
  26735. ) => void
  26736. /** 接口调用失败的回调函数 */
  26737. type CreateBLEPeripheralServerFailCallback = (
  26738. res: GeneralCallbackResult
  26739. ) => void
  26740. /** 接口调用成功的回调函数 */
  26741. type CreateBLEPeripheralServerSuccessCallback = (
  26742. result: CreateBLEPeripheralServerSuccessCallbackResult
  26743. ) => void
  26744. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26745. type CropImageCompleteCallback = (res: GeneralCallbackResult) => void
  26746. /** 接口调用失败的回调函数 */
  26747. type CropImageFailCallback = (res: GeneralCallbackResult) => void
  26748. /** 接口调用成功的回调函数 */
  26749. type CropImageSuccessCallback = (
  26750. result: EditImageSuccessCallbackResult
  26751. ) => void
  26752. /** 自定义渲染事件处理回调函数 */
  26753. type CustomRendererFrameEventCallback = (
  26754. result: OnCustomRendererEventCallbackResult
  26755. ) => void
  26756. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26757. type DisableAlertBeforeUnloadCompleteCallback = (
  26758. res: GeneralCallbackResult
  26759. ) => void
  26760. /** 接口调用失败的回调函数 */
  26761. type DisableAlertBeforeUnloadFailCallback = (
  26762. res: GeneralCallbackResult
  26763. ) => void
  26764. /** 接口调用成功的回调函数 */
  26765. type DisableAlertBeforeUnloadSuccessCallback = (
  26766. res: GeneralCallbackResult
  26767. ) => void
  26768. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26769. type DownloadFileCompleteCallback = (res: GeneralCallbackResult) => void
  26770. /** 接口调用失败的回调函数 */
  26771. type DownloadFileFailCallback = (res: GeneralCallbackResult) => void
  26772. /** 接口调用成功的回调函数 */
  26773. type DownloadFileSuccessCallback = (
  26774. result: DownloadFileSuccessCallbackResult
  26775. ) => void
  26776. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  26777. type DownloadTaskOffProgressUpdateCallback = (
  26778. result: DownloadTaskOnProgressUpdateListenerResult
  26779. ) => void
  26780. /** 下载进度变化事件的监听函数 */
  26781. type DownloadTaskOnProgressUpdateCallback = (
  26782. result: DownloadTaskOnProgressUpdateListenerResult
  26783. ) => void
  26784. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26785. type EditImageCompleteCallback = (res: GeneralCallbackResult) => void
  26786. /** 接口调用失败的回调函数 */
  26787. type EditImageFailCallback = (res: GeneralCallbackResult) => void
  26788. /** 接口调用成功的回调函数 */
  26789. type EditImageSuccessCallback = (
  26790. result: EditImageSuccessCallbackResult
  26791. ) => void
  26792. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26793. type EnableAlertBeforeUnloadCompleteCallback = (
  26794. res: GeneralCallbackResult
  26795. ) => void
  26796. /** 接口调用失败的回调函数 */
  26797. type EnableAlertBeforeUnloadFailCallback = (
  26798. res: GeneralCallbackResult
  26799. ) => void
  26800. /** 接口调用成功的回调函数 */
  26801. type EnableAlertBeforeUnloadSuccessCallback = (
  26802. res: GeneralCallbackResult
  26803. ) => void
  26804. /** 事件监听函数 */
  26805. type EventCallback = (
  26806. /** 触发事件参数 */
  26807. ...args: any
  26808. ) => void
  26809. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26810. type ExecuteVisualLayerCommandCompleteCallback = (
  26811. res: GeneralCallbackResult
  26812. ) => void
  26813. /** 接口调用失败的回调函数 */
  26814. type ExecuteVisualLayerCommandFailCallback = (
  26815. res: GeneralCallbackResult
  26816. ) => void
  26817. /** 接口调用成功的回调函数 */
  26818. type ExecuteVisualLayerCommandSuccessCallback = (
  26819. result: ExecuteVisualLayerCommandSuccessCallbackResult
  26820. ) => void
  26821. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26822. type ExitFullScreenCompleteCallback = (res: GeneralCallbackResult) => void
  26823. /** 接口调用失败的回调函数 */
  26824. type ExitFullScreenFailCallback = (res: GeneralCallbackResult) => void
  26825. /** 接口调用成功的回调函数 */
  26826. type ExitFullScreenSuccessCallback = (res: GeneralCallbackResult) => void
  26827. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26828. type ExitMiniProgramCompleteCallback = (res: GeneralCallbackResult) => void
  26829. /** 接口调用失败的回调函数 */
  26830. type ExitMiniProgramFailCallback = (res: GeneralCallbackResult) => void
  26831. /** 接口调用成功的回调函数 */
  26832. type ExitMiniProgramSuccessCallback = (res: GeneralCallbackResult) => void
  26833. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26834. type ExitPictureInPictureCompleteCallback = (
  26835. res: GeneralCallbackResult
  26836. ) => void
  26837. /** 接口调用失败的回调函数 */
  26838. type ExitPictureInPictureFailCallback = (res: GeneralCallbackResult) => void
  26839. /** 接口调用成功的回调函数 */
  26840. type ExitPictureInPictureSuccessCallback = (
  26841. res: GeneralCallbackResult
  26842. ) => void
  26843. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26844. type ExitVoIPChatCompleteCallback = (res: GeneralCallbackResult) => void
  26845. /** 接口调用失败的回调函数 */
  26846. type ExitVoIPChatFailCallback = (res: GeneralCallbackResult) => void
  26847. /** 接口调用成功的回调函数 */
  26848. type ExitVoIPChatSuccessCallback = (res: GeneralCallbackResult) => void
  26849. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26850. type FaceDetectCompleteCallback = (res: GeneralCallbackResult) => void
  26851. /** 接口调用失败的回调函数 */
  26852. type FaceDetectFailCallback = (res: GeneralCallbackResult) => void
  26853. /** 接口调用成功的回调函数 */
  26854. type FaceDetectSuccessCallback = (
  26855. result: FaceDetectSuccessCallbackResult
  26856. ) => void
  26857. /** 回调函数 */
  26858. type FieldsCallback = (
  26859. /** 节点的相关信息 */
  26860. res: IAnyObject
  26861. ) => void
  26862. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26863. type FileSystemManagerCloseCompleteCallback = (
  26864. res: GeneralCallbackResult
  26865. ) => void
  26866. /** 接口调用失败的回调函数 */
  26867. type FileSystemManagerCloseFailCallback = (
  26868. result: CloseFailCallbackResult
  26869. ) => void
  26870. /** 接口调用成功的回调函数 */
  26871. type FileSystemManagerCloseSuccessCallback = (
  26872. res: GeneralCallbackResult
  26873. ) => void
  26874. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26875. type FromScreenLocationCompleteCallback = (
  26876. res: GeneralCallbackResult
  26877. ) => void
  26878. /** 接口调用失败的回调函数 */
  26879. type FromScreenLocationFailCallback = (res: GeneralCallbackResult) => void
  26880. /** 接口调用成功的回调函数 */
  26881. type FromScreenLocationSuccessCallback = (
  26882. result: GetCenterLocationSuccessCallbackResult
  26883. ) => void
  26884. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26885. type FstatCompleteCallback = (res: GeneralCallbackResult) => void
  26886. /** 接口调用失败的回调函数 */
  26887. type FstatFailCallback = (result: FstatFailCallbackResult) => void
  26888. /** 接口调用成功的回调函数 */
  26889. type FstatSuccessCallback = (result: FstatSuccessCallbackResult) => void
  26890. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26891. type FtruncateCompleteCallback = (res: GeneralCallbackResult) => void
  26892. /** 接口调用失败的回调函数 */
  26893. type FtruncateFailCallback = (result: FtruncateFailCallbackResult) => void
  26894. /** 接口调用成功的回调函数 */
  26895. type FtruncateSuccessCallback = (res: GeneralCallbackResult) => void
  26896. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26897. type GetAtqaCompleteCallback = (res: Nfcrwerror) => void
  26898. /** 接口调用失败的回调函数 */
  26899. type GetAtqaFailCallback = (res: Nfcrwerror) => void
  26900. /** 接口调用成功的回调函数 */
  26901. type GetAtqaSuccessCallback = (result: GetAtqaSuccessCallbackResult) => void
  26902. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26903. type GetAvailableAudioSourcesCompleteCallback = (
  26904. res: GeneralCallbackResult
  26905. ) => void
  26906. /** 接口调用失败的回调函数 */
  26907. type GetAvailableAudioSourcesFailCallback = (
  26908. res: GeneralCallbackResult
  26909. ) => void
  26910. /** 接口调用成功的回调函数 */
  26911. type GetAvailableAudioSourcesSuccessCallback = (
  26912. result: GetAvailableAudioSourcesSuccessCallbackResult
  26913. ) => void
  26914. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26915. type GetBLEDeviceCharacteristicsCompleteCallback = (
  26916. res: BluetoothError
  26917. ) => void
  26918. /** 接口调用失败的回调函数 */
  26919. type GetBLEDeviceCharacteristicsFailCallback = (res: BluetoothError) => void
  26920. /** 接口调用成功的回调函数 */
  26921. type GetBLEDeviceCharacteristicsSuccessCallback = (
  26922. result: GetBLEDeviceCharacteristicsSuccessCallbackResult
  26923. ) => void
  26924. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26925. type GetBLEDeviceRSSICompleteCallback = (res: GeneralCallbackResult) => void
  26926. /** 接口调用失败的回调函数 */
  26927. type GetBLEDeviceRSSIFailCallback = (res: GeneralCallbackResult) => void
  26928. /** 接口调用成功的回调函数 */
  26929. type GetBLEDeviceRSSISuccessCallback = (
  26930. result: GetBLEDeviceRSSISuccessCallbackResult
  26931. ) => void
  26932. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26933. type GetBLEDeviceServicesCompleteCallback = (res: BluetoothError) => void
  26934. /** 接口调用失败的回调函数 */
  26935. type GetBLEDeviceServicesFailCallback = (res: BluetoothError) => void
  26936. /** 接口调用成功的回调函数 */
  26937. type GetBLEDeviceServicesSuccessCallback = (
  26938. result: GetBLEDeviceServicesSuccessCallbackResult
  26939. ) => void
  26940. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26941. type GetBLEMTUCompleteCallback = (res: BluetoothError) => void
  26942. /** 接口调用失败的回调函数 */
  26943. type GetBLEMTUFailCallback = (res: BluetoothError) => void
  26944. /** 接口调用成功的回调函数 */
  26945. type GetBLEMTUSuccessCallback = (
  26946. result: GetBLEMTUSuccessCallbackResult
  26947. ) => void
  26948. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26949. type GetBackgroundAudioPlayerStateCompleteCallback = (
  26950. res: GeneralCallbackResult
  26951. ) => void
  26952. /** 接口调用失败的回调函数 */
  26953. type GetBackgroundAudioPlayerStateFailCallback = (
  26954. res: GeneralCallbackResult
  26955. ) => void
  26956. /** 接口调用成功的回调函数 */
  26957. type GetBackgroundAudioPlayerStateSuccessCallback = (
  26958. result: GetBackgroundAudioPlayerStateSuccessCallbackResult
  26959. ) => void
  26960. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26961. type GetBackgroundFetchDataCompleteCallback = (
  26962. res: GeneralCallbackResult
  26963. ) => void
  26964. /** 接口调用失败的回调函数 */
  26965. type GetBackgroundFetchDataFailCallback = (
  26966. res: GeneralCallbackResult
  26967. ) => void
  26968. /** 接口调用成功的回调函数 */
  26969. type GetBackgroundFetchDataSuccessCallback = (
  26970. result: GetBackgroundFetchDataSuccessCallbackResult
  26971. ) => void
  26972. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26973. type GetBackgroundFetchTokenCompleteCallback = (
  26974. res: GeneralCallbackResult
  26975. ) => void
  26976. /** 接口调用失败的回调函数 */
  26977. type GetBackgroundFetchTokenFailCallback = (
  26978. res: GeneralCallbackResult
  26979. ) => void
  26980. /** 接口调用成功的回调函数 */
  26981. type GetBackgroundFetchTokenSuccessCallback = (
  26982. result: GetBackgroundFetchTokenSuccessCallbackResult
  26983. ) => void
  26984. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26985. type GetBatteryInfoCompleteCallback = (res: GeneralCallbackResult) => void
  26986. /** 接口调用失败的回调函数 */
  26987. type GetBatteryInfoFailCallback = (res: GeneralCallbackResult) => void
  26988. /** 接口调用成功的回调函数 */
  26989. type GetBatteryInfoSuccessCallback = (
  26990. result: GetBatteryInfoSuccessCallbackResult
  26991. ) => void
  26992. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  26993. type GetBeaconsCompleteCallback = (res: BeaconError) => void
  26994. /** 接口调用失败的回调函数 */
  26995. type GetBeaconsFailCallback = (res: BeaconError) => void
  26996. /** 接口调用成功的回调函数 */
  26997. type GetBeaconsSuccessCallback = (
  26998. result: GetBeaconsSuccessCallbackResult
  26999. ) => void
  27000. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27001. type GetBluetoothAdapterStateCompleteCallback = (
  27002. res: BluetoothError
  27003. ) => void
  27004. /** 接口调用失败的回调函数 */
  27005. type GetBluetoothAdapterStateFailCallback = (res: BluetoothError) => void
  27006. /** 接口调用成功的回调函数 */
  27007. type GetBluetoothAdapterStateSuccessCallback = (
  27008. result: GetBluetoothAdapterStateSuccessCallbackResult
  27009. ) => void
  27010. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27011. type GetBluetoothDevicesCompleteCallback = (res: BluetoothError) => void
  27012. /** 接口调用失败的回调函数 */
  27013. type GetBluetoothDevicesFailCallback = (res: BluetoothError) => void
  27014. /** 接口调用成功的回调函数 */
  27015. type GetBluetoothDevicesSuccessCallback = (
  27016. result: GetBluetoothDevicesSuccessCallbackResult
  27017. ) => void
  27018. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27019. type GetCenterLocationCompleteCallback = (
  27020. res: GeneralCallbackResult
  27021. ) => void
  27022. /** 接口调用失败的回调函数 */
  27023. type GetCenterLocationFailCallback = (res: GeneralCallbackResult) => void
  27024. /** 接口调用成功的回调函数 */
  27025. type GetCenterLocationSuccessCallback = (
  27026. result: GetCenterLocationSuccessCallbackResult
  27027. ) => void
  27028. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27029. type GetChannelsLiveInfoCompleteCallback = (
  27030. res: GeneralCallbackResult
  27031. ) => void
  27032. /** 接口调用失败的回调函数 */
  27033. type GetChannelsLiveInfoFailCallback = (res: GeneralCallbackResult) => void
  27034. /** 接口调用成功的回调函数 */
  27035. type GetChannelsLiveInfoSuccessCallback = (
  27036. result: GetChannelsLiveInfoSuccessCallbackResult
  27037. ) => void
  27038. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27039. type GetChannelsLiveNoticeInfoCompleteCallback = (
  27040. res: GeneralCallbackResult
  27041. ) => void
  27042. /** 接口调用失败的回调函数 */
  27043. type GetChannelsLiveNoticeInfoFailCallback = (
  27044. res: GeneralCallbackResult
  27045. ) => void
  27046. /** 接口调用成功的回调函数 */
  27047. type GetChannelsLiveNoticeInfoSuccessCallback = (
  27048. result: GetChannelsLiveNoticeInfoSuccessCallbackResult
  27049. ) => void
  27050. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27051. type GetChannelsShareKeyCompleteCallback = (
  27052. res: GeneralCallbackResult
  27053. ) => void
  27054. /** 接口调用失败的回调函数 */
  27055. type GetChannelsShareKeyFailCallback = (res: GeneralCallbackResult) => void
  27056. /** 接口调用成功的回调函数 */
  27057. type GetChannelsShareKeySuccessCallback = (
  27058. result: GetChannelsShareKeySuccessCallbackResult
  27059. ) => void
  27060. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27061. type GetClipboardDataCompleteCallback = (res: GeneralCallbackResult) => void
  27062. /** 接口调用失败的回调函数 */
  27063. type GetClipboardDataFailCallback = (res: GeneralCallbackResult) => void
  27064. /** 接口调用成功的回调函数 */
  27065. type GetClipboardDataSuccessCallback = (
  27066. option: GetClipboardDataSuccessCallbackOption
  27067. ) => void
  27068. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27069. type GetConnectedBluetoothDevicesCompleteCallback = (
  27070. res: BluetoothError
  27071. ) => void
  27072. /** 接口调用失败的回调函数 */
  27073. type GetConnectedBluetoothDevicesFailCallback = (
  27074. res: BluetoothError
  27075. ) => void
  27076. /** 接口调用成功的回调函数 */
  27077. type GetConnectedBluetoothDevicesSuccessCallback = (
  27078. result: GetConnectedBluetoothDevicesSuccessCallbackResult
  27079. ) => void
  27080. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27081. type GetConnectedWifiCompleteCallback = (res: WifiError) => void
  27082. /** 接口调用失败的回调函数 */
  27083. type GetConnectedWifiFailCallback = (res: WifiError) => void
  27084. /** 接口调用成功的回调函数 */
  27085. type GetConnectedWifiSuccessCallback = (
  27086. result: GetConnectedWifiSuccessCallbackResult
  27087. ) => void
  27088. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27089. type GetContentsCompleteCallback = (res: GeneralCallbackResult) => void
  27090. /** 接口调用失败的回调函数 */
  27091. type GetContentsFailCallback = (res: GeneralCallbackResult) => void
  27092. /** 接口调用成功的回调函数 */
  27093. type GetContentsSuccessCallback = (
  27094. result: GetContentsSuccessCallbackResult
  27095. ) => void
  27096. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27097. type GetExtConfigCompleteCallback = (res: GeneralCallbackResult) => void
  27098. /** 接口调用失败的回调函数 */
  27099. type GetExtConfigFailCallback = (res: GeneralCallbackResult) => void
  27100. /** 接口调用成功的回调函数 */
  27101. type GetExtConfigSuccessCallback = (
  27102. result: GetExtConfigSuccessCallbackResult
  27103. ) => void
  27104. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27105. type GetFileInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27106. /** 接口调用失败的回调函数 */
  27107. type GetFileInfoFailCallback = (
  27108. result: GetFileInfoFailCallbackResult
  27109. ) => void
  27110. /** 接口调用成功的回调函数 */
  27111. type GetFileInfoSuccessCallback = (
  27112. result: GetFileInfoSuccessCallbackResult
  27113. ) => void
  27114. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27115. type GetFuzzyLocationCompleteCallback = (res: GeneralCallbackResult) => void
  27116. /** 接口调用失败的回调函数 */
  27117. type GetFuzzyLocationFailCallback = (res: GeneralCallbackResult) => void
  27118. /** 接口调用成功的回调函数 */
  27119. type GetFuzzyLocationSuccessCallback = (
  27120. result: GetFuzzyLocationSuccessCallbackResult
  27121. ) => void
  27122. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27123. type GetGroupEnterInfoCompleteCallback = (
  27124. res: GeneralCallbackResult
  27125. ) => void
  27126. /** 接口调用失败的回调函数 */
  27127. type GetGroupEnterInfoFailCallback = (res: GeneralCallbackResult) => void
  27128. /** 接口调用成功的回调函数 */
  27129. type GetGroupEnterInfoSuccessCallback = (
  27130. result: GetGroupEnterInfoSuccessCallbackResult
  27131. ) => void
  27132. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27133. type GetHCEStateCompleteCallback = (res: NFCError) => void
  27134. /** 接口调用失败的回调函数 */
  27135. type GetHCEStateFailCallback = (res: NFCError) => void
  27136. /** 接口调用成功的回调函数 */
  27137. type GetHCEStateSuccessCallback = (res: NFCError) => void
  27138. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27139. type GetHistoricalBytesCompleteCallback = (res: Nfcrwerror) => void
  27140. /** 接口调用失败的回调函数 */
  27141. type GetHistoricalBytesFailCallback = (res: Nfcrwerror) => void
  27142. /** 接口调用成功的回调函数 */
  27143. type GetHistoricalBytesSuccessCallback = (
  27144. result: GetHistoricalBytesSuccessCallbackResult
  27145. ) => void
  27146. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27147. type GetImageInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27148. /** 接口调用失败的回调函数 */
  27149. type GetImageInfoFailCallback = (res: GeneralCallbackResult) => void
  27150. /** 接口调用成功的回调函数 */
  27151. type GetImageInfoSuccessCallback = (
  27152. result: GetImageInfoSuccessCallbackResult
  27153. ) => void
  27154. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27155. type GetLatestUserKeyCompleteCallback = (res: GeneralCallbackResult) => void
  27156. /** 接口调用失败的回调函数 */
  27157. type GetLatestUserKeyFailCallback = (res: GeneralCallbackResult) => void
  27158. /** 接口调用成功的回调函数 */
  27159. type GetLatestUserKeySuccessCallback = (
  27160. result: GetLatestUserKeySuccessCallbackResult
  27161. ) => void
  27162. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27163. type GetLocalIPAddressCompleteCallback = (
  27164. res: GeneralCallbackResult
  27165. ) => void
  27166. /** 接口调用失败的回调函数 */
  27167. type GetLocalIPAddressFailCallback = (res: GeneralCallbackResult) => void
  27168. /** 接口调用成功的回调函数 */
  27169. type GetLocalIPAddressSuccessCallback = (
  27170. result: GetLocalIPAddressSuccessCallbackResult
  27171. ) => void
  27172. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27173. type GetLocationCompleteCallback = (res: GeneralCallbackResult) => void
  27174. /** 接口调用失败的回调函数 */
  27175. type GetLocationFailCallback = (res: GeneralCallbackResult) => void
  27176. /** 接口调用成功的回调函数 */
  27177. type GetLocationSuccessCallback = (
  27178. result: GetLocationSuccessCallbackResult
  27179. ) => void
  27180. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27181. type GetMaxTransceiveLengthCompleteCallback = (res: Nfcrwerror) => void
  27182. /** 接口调用失败的回调函数 */
  27183. type GetMaxTransceiveLengthFailCallback = (res: Nfcrwerror) => void
  27184. /** 接口调用成功的回调函数 */
  27185. type GetMaxTransceiveLengthSuccessCallback = (
  27186. result: GetMaxTransceiveLengthSuccessCallbackResult
  27187. ) => void
  27188. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27189. type GetNetworkTypeCompleteCallback = (res: GeneralCallbackResult) => void
  27190. /** 接口调用失败的回调函数 */
  27191. type GetNetworkTypeFailCallback = (res: GeneralCallbackResult) => void
  27192. /** 接口调用成功的回调函数 */
  27193. type GetNetworkTypeSuccessCallback = (
  27194. result: GetNetworkTypeSuccessCallbackResult
  27195. ) => void
  27196. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27197. type GetRandomValuesCompleteCallback = (res: GeneralCallbackResult) => void
  27198. /** 接口调用失败的回调函数 */
  27199. type GetRandomValuesFailCallback = (res: GeneralCallbackResult) => void
  27200. /** 接口调用成功的回调函数 */
  27201. type GetRandomValuesSuccessCallback = (
  27202. result: GetRandomValuesSuccessCallbackResult
  27203. ) => void
  27204. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27205. type GetRegionCompleteCallback = (res: GeneralCallbackResult) => void
  27206. /** 接口调用失败的回调函数 */
  27207. type GetRegionFailCallback = (res: GeneralCallbackResult) => void
  27208. /** 接口调用成功的回调函数 */
  27209. type GetRegionSuccessCallback = (
  27210. result: GetRegionSuccessCallbackResult
  27211. ) => void
  27212. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27213. type GetRotateCompleteCallback = (res: GeneralCallbackResult) => void
  27214. /** 接口调用失败的回调函数 */
  27215. type GetRotateFailCallback = (res: GeneralCallbackResult) => void
  27216. /** 接口调用成功的回调函数 */
  27217. type GetRotateSuccessCallback = (
  27218. result: GetRotateSuccessCallbackResult
  27219. ) => void
  27220. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27221. type GetSakCompleteCallback = (res: Nfcrwerror) => void
  27222. /** 接口调用失败的回调函数 */
  27223. type GetSakFailCallback = (res: Nfcrwerror) => void
  27224. /** 接口调用成功的回调函数 */
  27225. type GetSakSuccessCallback = (result: GetSakSuccessCallbackResult) => void
  27226. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27227. type GetSavedFileListCompleteCallback = (res: GeneralCallbackResult) => void
  27228. /** 接口调用失败的回调函数 */
  27229. type GetSavedFileListFailCallback = (res: GeneralCallbackResult) => void
  27230. /** 接口调用成功的回调函数 */
  27231. type GetSavedFileListSuccessCallback = (
  27232. result: GetSavedFileListSuccessCallbackResult
  27233. ) => void
  27234. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27235. type GetScaleCompleteCallback = (res: GeneralCallbackResult) => void
  27236. /** 接口调用失败的回调函数 */
  27237. type GetScaleFailCallback = (res: GeneralCallbackResult) => void
  27238. /** 接口调用成功的回调函数 */
  27239. type GetScaleSuccessCallback = (
  27240. result: GetScaleSuccessCallbackResult
  27241. ) => void
  27242. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27243. type GetScreenBrightnessCompleteCallback = (
  27244. res: GeneralCallbackResult
  27245. ) => void
  27246. /** 接口调用失败的回调函数 */
  27247. type GetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void
  27248. /** 接口调用成功的回调函数 */
  27249. type GetScreenBrightnessSuccessCallback = (
  27250. option: GetScreenBrightnessSuccessCallbackOption
  27251. ) => void
  27252. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27253. type GetScreenRecordingStateCompleteCallback = (
  27254. res: GeneralCallbackResult
  27255. ) => void
  27256. /** 接口调用失败的回调函数 */
  27257. type GetScreenRecordingStateFailCallback = (
  27258. res: GeneralCallbackResult
  27259. ) => void
  27260. /** 接口调用成功的回调函数 */
  27261. type GetScreenRecordingStateSuccessCallback = (
  27262. result: GetScreenRecordingStateSuccessCallbackResult
  27263. ) => void
  27264. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27265. type GetSelectedTextRangeCompleteCallback = (
  27266. res: GeneralCallbackResult
  27267. ) => void
  27268. /** 接口调用失败的回调函数 */
  27269. type GetSelectedTextRangeFailCallback = (res: GeneralCallbackResult) => void
  27270. /** 接口调用成功的回调函数 */
  27271. type GetSelectedTextRangeSuccessCallback = (
  27272. result: GetSelectedTextRangeSuccessCallbackResult
  27273. ) => void
  27274. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27275. type GetSelectionTextCompleteCallback = (res: GeneralCallbackResult) => void
  27276. /** 接口调用失败的回调函数 */
  27277. type GetSelectionTextFailCallback = (res: GeneralCallbackResult) => void
  27278. /** 接口调用成功的回调函数 */
  27279. type GetSelectionTextSuccessCallback = (
  27280. result: GetSelectionTextSuccessCallbackResult
  27281. ) => void
  27282. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27283. type GetSettingCompleteCallback = (res: GeneralCallbackResult) => void
  27284. /** 接口调用失败的回调函数 */
  27285. type GetSettingFailCallback = (res: GeneralCallbackResult) => void
  27286. /** 接口调用成功的回调函数 */
  27287. type GetSettingSuccessCallback = (
  27288. result: GetSettingSuccessCallbackResult
  27289. ) => void
  27290. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27291. type GetShareInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27292. /** 接口调用失败的回调函数 */
  27293. type GetShareInfoFailCallback = (res: GeneralCallbackResult) => void
  27294. /** 接口调用成功的回调函数 */
  27295. type GetShareInfoSuccessCallback = (
  27296. result: GetGroupEnterInfoSuccessCallbackResult
  27297. ) => void
  27298. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27299. type GetSkewCompleteCallback = (res: GeneralCallbackResult) => void
  27300. /** 接口调用失败的回调函数 */
  27301. type GetSkewFailCallback = (res: GeneralCallbackResult) => void
  27302. /** 接口调用成功的回调函数 */
  27303. type GetSkewSuccessCallback = (result: GetSkewSuccessCallbackResult) => void
  27304. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27305. type GetSkylineInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27306. /** 接口调用失败的回调函数 */
  27307. type GetSkylineInfoFailCallback = (res: GeneralCallbackResult) => void
  27308. /** 接口调用成功的回调函数 */
  27309. type GetSkylineInfoSuccessCallback = (
  27310. /** 当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  27311. result: SkylineInfo
  27312. ) => void
  27313. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27314. type GetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  27315. /** 接口调用失败的回调函数 */
  27316. type GetStorageFailCallback = (res: GeneralCallbackResult) => void
  27317. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27318. type GetStorageInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27319. /** 接口调用失败的回调函数 */
  27320. type GetStorageInfoFailCallback = (res: GeneralCallbackResult) => void
  27321. /** 接口调用成功的回调函数 */
  27322. type GetStorageInfoSuccessCallback = (
  27323. option: GetStorageInfoSuccessCallbackOption
  27324. ) => void
  27325. /** 接口调用成功的回调函数 */
  27326. type GetStorageSuccessCallback<T = any> = (
  27327. result: GetStorageSuccessCallbackResult<T>
  27328. ) => void
  27329. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27330. type GetSystemInfoAsyncCompleteCallback = (
  27331. res: GeneralCallbackResult
  27332. ) => void
  27333. /** 接口调用失败的回调函数 */
  27334. type GetSystemInfoAsyncFailCallback = (res: GeneralCallbackResult) => void
  27335. /** 接口调用成功的回调函数 */
  27336. type GetSystemInfoAsyncSuccessCallback = (result: SystemInfo) => void
  27337. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27338. type GetSystemInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27339. /** 接口调用失败的回调函数 */
  27340. type GetSystemInfoFailCallback = (res: GeneralCallbackResult) => void
  27341. /** 接口调用成功的回调函数 */
  27342. type GetSystemInfoSuccessCallback = (result: SystemInfo) => void
  27343. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27344. type GetUserInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27345. /** 接口调用失败的回调函数 */
  27346. type GetUserInfoFailCallback = (res: GeneralCallbackResult) => void
  27347. /** 接口调用成功的回调函数 */
  27348. type GetUserInfoSuccessCallback = (
  27349. result: GetUserInfoSuccessCallbackResult
  27350. ) => void
  27351. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27352. type GetUserProfileCompleteCallback = (res: GeneralCallbackResult) => void
  27353. /** 接口调用失败的回调函数 */
  27354. type GetUserProfileFailCallback = (res: GeneralCallbackResult) => void
  27355. /** 接口调用成功的回调函数 */
  27356. type GetUserProfileSuccessCallback = (
  27357. result: GetUserProfileSuccessCallbackResult
  27358. ) => void
  27359. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27360. type GetVideoInfoCompleteCallback = (res: GeneralCallbackResult) => void
  27361. /** 接口调用失败的回调函数 */
  27362. type GetVideoInfoFailCallback = (res: GeneralCallbackResult) => void
  27363. /** 接口调用成功的回调函数 */
  27364. type GetVideoInfoSuccessCallback = (
  27365. result: GetVideoInfoSuccessCallbackResult
  27366. ) => void
  27367. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27368. type GetWeRunDataCompleteCallback = (res: GeneralCallbackResult) => void
  27369. /** 接口调用失败的回调函数 */
  27370. type GetWeRunDataFailCallback = (res: GeneralCallbackResult) => void
  27371. /** 接口调用成功的回调函数 */
  27372. type GetWeRunDataSuccessCallback = (
  27373. result: GetWeRunDataSuccessCallbackResult
  27374. ) => void
  27375. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27376. type GetWifiListCompleteCallback = (res: WifiError) => void
  27377. /** 接口调用失败的回调函数 */
  27378. type GetWifiListFailCallback = (res: WifiError) => void
  27379. /** 接口调用成功的回调函数 */
  27380. type GetWifiListSuccessCallback = (res: WifiError) => void
  27381. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27382. type HideHomeButtonCompleteCallback = (res: GeneralCallbackResult) => void
  27383. /** 接口调用失败的回调函数 */
  27384. type HideHomeButtonFailCallback = (res: GeneralCallbackResult) => void
  27385. /** 接口调用成功的回调函数 */
  27386. type HideHomeButtonSuccessCallback = (res: GeneralCallbackResult) => void
  27387. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27388. type HideKeyboardCompleteCallback = (res: GeneralCallbackResult) => void
  27389. /** 接口调用失败的回调函数 */
  27390. type HideKeyboardFailCallback = (res: GeneralCallbackResult) => void
  27391. /** 接口调用成功的回调函数 */
  27392. type HideKeyboardSuccessCallback = (res: GeneralCallbackResult) => void
  27393. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27394. type HideLoadingCompleteCallback = (res: GeneralCallbackResult) => void
  27395. /** 接口调用失败的回调函数 */
  27396. type HideLoadingFailCallback = (res: GeneralCallbackResult) => void
  27397. /** 接口调用成功的回调函数 */
  27398. type HideLoadingSuccessCallback = (res: GeneralCallbackResult) => void
  27399. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27400. type HideNavigationBarLoadingCompleteCallback = (
  27401. res: GeneralCallbackResult
  27402. ) => void
  27403. /** 接口调用失败的回调函数 */
  27404. type HideNavigationBarLoadingFailCallback = (
  27405. res: GeneralCallbackResult
  27406. ) => void
  27407. /** 接口调用成功的回调函数 */
  27408. type HideNavigationBarLoadingSuccessCallback = (
  27409. res: GeneralCallbackResult
  27410. ) => void
  27411. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27412. type HideShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  27413. /** 接口调用失败的回调函数 */
  27414. type HideShareMenuFailCallback = (res: GeneralCallbackResult) => void
  27415. /** 接口调用成功的回调函数 */
  27416. type HideShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  27417. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27418. type HideTabBarCompleteCallback = (res: GeneralCallbackResult) => void
  27419. /** 接口调用失败的回调函数 */
  27420. type HideTabBarFailCallback = (res: GeneralCallbackResult) => void
  27421. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27422. type HideTabBarRedDotCompleteCallback = (res: GeneralCallbackResult) => void
  27423. /** 接口调用失败的回调函数 */
  27424. type HideTabBarRedDotFailCallback = (res: GeneralCallbackResult) => void
  27425. /** 接口调用成功的回调函数 */
  27426. type HideTabBarRedDotSuccessCallback = (res: GeneralCallbackResult) => void
  27427. /** 接口调用成功的回调函数 */
  27428. type HideTabBarSuccessCallback = (res: GeneralCallbackResult) => void
  27429. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27430. type HideToastCompleteCallback = (res: GeneralCallbackResult) => void
  27431. /** 接口调用失败的回调函数 */
  27432. type HideToastFailCallback = (res: GeneralCallbackResult) => void
  27433. /** 接口调用成功的回调函数 */
  27434. type HideToastSuccessCallback = (res: GeneralCallbackResult) => void
  27435. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27436. type IncludePointsCompleteCallback = (res: GeneralCallbackResult) => void
  27437. /** 接口调用失败的回调函数 */
  27438. type IncludePointsFailCallback = (res: GeneralCallbackResult) => void
  27439. /** 接口调用成功的回调函数 */
  27440. type IncludePointsSuccessCallback = (res: GeneralCallbackResult) => void
  27441. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27442. type InitFaceDetectCompleteCallback = (res: GeneralCallbackResult) => void
  27443. /** 接口调用失败的回调函数 */
  27444. type InitFaceDetectFailCallback = (res: GeneralCallbackResult) => void
  27445. /** 接口调用成功的回调函数 */
  27446. type InitFaceDetectSuccessCallback = (res: GeneralCallbackResult) => void
  27447. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27448. type InitMarkerClusterCompleteCallback = (
  27449. res: GeneralCallbackResult
  27450. ) => void
  27451. /** 接口调用失败的回调函数 */
  27452. type InitMarkerClusterFailCallback = (res: GeneralCallbackResult) => void
  27453. /** 接口调用成功的回调函数 */
  27454. type InitMarkerClusterSuccessCallback = (res: GeneralCallbackResult) => void
  27455. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  27456. type InnerAudioContextOffErrorCallback = (
  27457. result: InnerAudioContextOnErrorListenerResult
  27458. ) => void
  27459. /** 音频播放错误事件的监听函数 */
  27460. type InnerAudioContextOnErrorCallback = (
  27461. result: InnerAudioContextOnErrorListenerResult
  27462. ) => void
  27463. type InnerAudioContextOnStopCallback = (res: GeneralCallbackResult) => void
  27464. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27465. type InsertDividerCompleteCallback = (res: GeneralCallbackResult) => void
  27466. /** 接口调用失败的回调函数 */
  27467. type InsertDividerFailCallback = (res: GeneralCallbackResult) => void
  27468. /** 接口调用成功的回调函数 */
  27469. type InsertDividerSuccessCallback = (res: GeneralCallbackResult) => void
  27470. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27471. type InsertImageCompleteCallback = (res: GeneralCallbackResult) => void
  27472. /** 接口调用失败的回调函数 */
  27473. type InsertImageFailCallback = (res: GeneralCallbackResult) => void
  27474. /** 接口调用成功的回调函数 */
  27475. type InsertImageSuccessCallback = (res: GeneralCallbackResult) => void
  27476. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27477. type InsertTextCompleteCallback = (res: GeneralCallbackResult) => void
  27478. /** 接口调用失败的回调函数 */
  27479. type InsertTextFailCallback = (res: GeneralCallbackResult) => void
  27480. /** 接口调用成功的回调函数 */
  27481. type InsertTextSuccessCallback = (res: GeneralCallbackResult) => void
  27482. /** 监听相交状态变化的回调函数 */
  27483. type IntersectionObserverObserveCallback = (
  27484. result: IntersectionObserverObserveCallbackResult
  27485. ) => void
  27486. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  27487. type InterstitialAdOffErrorCallback = (
  27488. result: InterstitialAdOnErrorListenerResult
  27489. ) => void
  27490. /** 插屏错误事件的监听函数 */
  27491. type InterstitialAdOnErrorCallback = (
  27492. result: InterstitialAdOnErrorListenerResult
  27493. ) => void
  27494. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27495. type IsBluetoothDevicePairedCompleteCallback = (
  27496. res: GeneralCallbackResult
  27497. ) => void
  27498. /** 接口调用失败的回调函数 */
  27499. type IsBluetoothDevicePairedFailCallback = (
  27500. res: GeneralCallbackResult
  27501. ) => void
  27502. /** 接口调用成功的回调函数 */
  27503. type IsBluetoothDevicePairedSuccessCallback = (
  27504. res: GeneralCallbackResult
  27505. ) => void
  27506. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27507. type IsConnectedCompleteCallback = (res: Nfcrwerror) => void
  27508. /** 接口调用失败的回调函数 */
  27509. type IsConnectedFailCallback = (res: Nfcrwerror) => void
  27510. /** 接口调用成功的回调函数 */
  27511. type IsConnectedSuccessCallback = (res: Nfcrwerror) => void
  27512. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27513. type Join1v1ChatCompleteCallback = (res: Join1v1ChatError) => void
  27514. /** 接口调用失败的回调函数 */
  27515. type Join1v1ChatFailCallback = (res: Join1v1ChatError) => void
  27516. /** 接口调用成功的回调函数 */
  27517. type Join1v1ChatSuccessCallback = (res: Join1v1ChatError) => void
  27518. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27519. type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void
  27520. /** 接口调用失败的回调函数 */
  27521. type JoinVoIPChatFailCallback = (res: JoinVoIPChatError) => void
  27522. /** 接口调用成功的回调函数 */
  27523. type JoinVoIPChatSuccessCallback = (
  27524. result: JoinVoIPChatSuccessCallbackResult
  27525. ) => void
  27526. /** 接口调用成功的回调函数 */
  27527. type LivePlayerContextSnapshotSuccessCallback = (
  27528. result: LivePlayerContextSnapshotSuccessCallbackResult
  27529. ) => void
  27530. /** 接口调用成功的回调函数 */
  27531. type LivePusherContextSnapshotSuccessCallback = (
  27532. result: LivePusherContextSnapshotSuccessCallbackResult
  27533. ) => void
  27534. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27535. type LoadFontFaceCompleteCallback = (
  27536. result: LoadFontFaceCompleteCallbackResult
  27537. ) => void
  27538. /** 接口调用失败的回调函数 */
  27539. type LoadFontFaceFailCallback = (
  27540. result: LoadFontFaceCompleteCallbackResult
  27541. ) => void
  27542. /** 接口调用成功的回调函数 */
  27543. type LoadFontFaceSuccessCallback = (
  27544. result: LoadFontFaceCompleteCallbackResult
  27545. ) => void
  27546. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27547. type LoginCompleteCallback = (res: GeneralCallbackResult) => void
  27548. /** 接口调用失败的回调函数 */
  27549. type LoginFailCallback = (res: GeneralCallbackResult) => void
  27550. /** 接口调用成功的回调函数 */
  27551. type LoginSuccessCallback = (result: LoginSuccessCallbackResult) => void
  27552. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27553. type MakeBluetoothPairCompleteCallback = (
  27554. res: GeneralCallbackResult
  27555. ) => void
  27556. /** 接口调用失败的回调函数 */
  27557. type MakeBluetoothPairFailCallback = (res: GeneralCallbackResult) => void
  27558. /** 接口调用成功的回调函数 */
  27559. type MakeBluetoothPairSuccessCallback = (res: GeneralCallbackResult) => void
  27560. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27561. type MakePhoneCallCompleteCallback = (res: GeneralCallbackResult) => void
  27562. /** 接口调用失败的回调函数 */
  27563. type MakePhoneCallFailCallback = (res: GeneralCallbackResult) => void
  27564. /** 接口调用成功的回调函数 */
  27565. type MakePhoneCallSuccessCallback = (res: GeneralCallbackResult) => void
  27566. /** 监听 media query 状态变化的回调函数 */
  27567. type MediaQueryObserverObserveCallback = (
  27568. result: MediaQueryObserverObserveCallbackResult
  27569. ) => void
  27570. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27571. type MkdirCompleteCallback = (res: GeneralCallbackResult) => void
  27572. /** 接口调用失败的回调函数 */
  27573. type MkdirFailCallback = (result: MkdirFailCallbackResult) => void
  27574. /** 接口调用成功的回调函数 */
  27575. type MkdirSuccessCallback = (res: GeneralCallbackResult) => void
  27576. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27577. type MoveAlongCompleteCallback = (res: GeneralCallbackResult) => void
  27578. /** 接口调用失败的回调函数 */
  27579. type MoveAlongFailCallback = (res: GeneralCallbackResult) => void
  27580. /** 接口调用成功的回调函数 */
  27581. type MoveAlongSuccessCallback = (res: GeneralCallbackResult) => void
  27582. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27583. type MoveToLocationCompleteCallback = (res: GeneralCallbackResult) => void
  27584. /** 接口调用失败的回调函数 */
  27585. type MoveToLocationFailCallback = (res: GeneralCallbackResult) => void
  27586. /** 接口调用成功的回调函数 */
  27587. type MoveToLocationSuccessCallback = (res: GeneralCallbackResult) => void
  27588. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27589. type MuteCompleteCallback = (res: GeneralCallbackResult) => void
  27590. /** 接口调用失败的回调函数 */
  27591. type MuteFailCallback = (res: GeneralCallbackResult) => void
  27592. /** 接口调用成功的回调函数 */
  27593. type MuteSuccessCallback = (res: GeneralCallbackResult) => void
  27594. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27595. type NavigateBackCompleteCallback = (res: GeneralCallbackResult) => void
  27596. /** 接口调用失败的回调函数 */
  27597. type NavigateBackFailCallback = (res: GeneralCallbackResult) => void
  27598. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27599. type NavigateBackMiniProgramCompleteCallback = (
  27600. res: GeneralCallbackResult
  27601. ) => void
  27602. /** 接口调用失败的回调函数 */
  27603. type NavigateBackMiniProgramFailCallback = (
  27604. res: GeneralCallbackResult
  27605. ) => void
  27606. /** 接口调用成功的回调函数 */
  27607. type NavigateBackMiniProgramSuccessCallback = (
  27608. res: GeneralCallbackResult
  27609. ) => void
  27610. /** 接口调用成功的回调函数 */
  27611. type NavigateBackSuccessCallback = (res: GeneralCallbackResult) => void
  27612. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27613. type NavigateToCompleteCallback = (res: GeneralCallbackResult) => void
  27614. /** 接口调用失败的回调函数 */
  27615. type NavigateToFailCallback = (res: GeneralCallbackResult) => void
  27616. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27617. type NavigateToMiniProgramCompleteCallback = (
  27618. res: GeneralCallbackResult
  27619. ) => void
  27620. /** 接口调用失败的回调函数 */
  27621. type NavigateToMiniProgramFailCallback = (
  27622. res: GeneralCallbackResult
  27623. ) => void
  27624. /** 接口调用成功的回调函数 */
  27625. type NavigateToMiniProgramSuccessCallback = (
  27626. res: GeneralCallbackResult
  27627. ) => void
  27628. /** 接口调用成功的回调函数 */
  27629. type NavigateToSuccessCallback = (
  27630. result: NavigateToSuccessCallbackResult
  27631. ) => void
  27632. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27633. type NdefCloseCompleteCallback = (res: Nfcrwerror) => void
  27634. /** 接口调用失败的回调函数 */
  27635. type NdefCloseFailCallback = (res: Nfcrwerror) => void
  27636. /** 接口调用成功的回调函数 */
  27637. type NdefCloseSuccessCallback = (res: Nfcrwerror) => void
  27638. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  27639. type NodeCallback = (result: NodeCallbackResult) => void
  27640. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  27641. type NotifyBLECharacteristicValueChangeCompleteCallback = (
  27642. res: BluetoothError
  27643. ) => void
  27644. /** 接口调用失败的回调函数 */
  27645. type NotifyBLECharacteristicValueChangeFailCallback = (
  27646. res: BluetoothError
  27647. ) => void
  27648. /** 接口调用成功的回调函数 */
  27649. type NotifyBLECharacteristicValueChangeSuccessCallback = (
  27650. res: BluetoothError
  27651. ) => void
  27652. /** onAccelerometerChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27653. type OffAccelerometerChangeCallback = (res: GeneralCallbackResult) => void
  27654. /** onAppHide 传入的监听函数。不传此参数则移除所有监听函数。 */
  27655. type OffAppHideCallback = (res: GeneralCallbackResult) => void
  27656. /** onAppShow 传入的监听函数。不传此参数则移除所有监听函数。 */
  27657. type OffAppShowCallback = (res: GeneralCallbackResult) => void
  27658. /** onAudioInterruptionBegin 传入的监听函数。不传此参数则移除所有监听函数。 */
  27659. type OffAudioInterruptionBeginCallback = (
  27660. res: GeneralCallbackResult
  27661. ) => void
  27662. /** onAudioInterruptionEnd 传入的监听函数。不传此参数则移除所有监听函数。 */
  27663. type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void
  27664. /** onBLECharacteristicValueChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27665. type OffBLECharacteristicValueChangeCallback = (
  27666. result: OnBLECharacteristicValueChangeListenerResult
  27667. ) => void
  27668. /** onBLEConnectionStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27669. type OffBLEConnectionStateChangeCallback = (
  27670. result: OnBLEConnectionStateChangeListenerResult
  27671. ) => void
  27672. /** onBLEMTUChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27673. type OffBLEMTUChangeCallback = (
  27674. result: OnBLEMTUChangeListenerResult
  27675. ) => void
  27676. /** onBLEPeripheralConnectionStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  27677. type OffBLEPeripheralConnectionStateChangedCallback = (
  27678. result: OnBLEPeripheralConnectionStateChangedListenerResult
  27679. ) => void
  27680. /** onBeaconServiceChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27681. type OffBeaconServiceChangeCallback = (res: GeneralCallbackResult) => void
  27682. /** onBeaconUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  27683. type OffBeaconUpdateCallback = (res: GeneralCallbackResult) => void
  27684. /** onBindWifi 传入的监听函数。不传此参数则移除所有监听函数。 */
  27685. type OffBindWifiCallback = (res: GeneralCallbackResult) => void
  27686. /** onBluetoothAdapterStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27687. type OffBluetoothAdapterStateChangeCallback = (
  27688. result: OnBluetoothAdapterStateChangeListenerResult
  27689. ) => void
  27690. /** onBluetoothDeviceFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  27691. type OffBluetoothDeviceFoundCallback = (res: GeneralCallbackResult) => void
  27692. /** onCanplay 传入的监听函数。不传此参数则移除所有监听函数。 */
  27693. type OffCanplayCallback = (res: GeneralCallbackResult) => void
  27694. /** onCharacteristicReadRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  27695. type OffCharacteristicReadRequestCallback = (
  27696. result: OnCharacteristicReadRequestListenerResult
  27697. ) => void
  27698. /** onCharacteristicSubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  27699. type OffCharacteristicSubscribedCallback = (
  27700. result: OnCharacteristicSubscribedListenerResult
  27701. ) => void
  27702. /** onCharacteristicUnsubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  27703. type OffCharacteristicUnsubscribedCallback = (
  27704. result: OnCharacteristicSubscribedListenerResult
  27705. ) => void
  27706. /** onCharacteristicWriteRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  27707. type OffCharacteristicWriteRequestCallback = (
  27708. result: OnCharacteristicWriteRequestListenerResult
  27709. ) => void
  27710. /** onChunkReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  27711. type OffChunkReceivedCallback = (
  27712. result: OnChunkReceivedListenerResult
  27713. ) => void
  27714. /** onCompassChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27715. type OffCompassChangeCallback = (res: GeneralCallbackResult) => void
  27716. /** onConnect 传入的监听函数。不传此参数则移除所有监听函数。 */
  27717. type OffConnectCallback = (res: GeneralCallbackResult) => void
  27718. /** onCopyUrl 传入的监听函数。不传此参数则移除所有监听函数。 */
  27719. type OffCopyUrlCallback = (result: OnCopyUrlListenerResult) => void
  27720. /** onDeviceMotionChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27721. type OffDeviceMotionChangeCallback = (res: GeneralCallbackResult) => void
  27722. /** onDiscovered 传入的监听函数。不传此参数则移除所有监听函数。 */
  27723. type OffDiscoveredCallback = (result: OnDiscoveredListenerResult) => void
  27724. /** onEnded 传入的监听函数。不传此参数则移除所有监听函数。 */
  27725. type OffEndedCallback = (res: GeneralCallbackResult) => void
  27726. /** onGetWifiList 传入的监听函数。不传此参数则移除所有监听函数。 */
  27727. type OffGetWifiListCallback = (result: OnGetWifiListListenerResult) => void
  27728. /** onHCEMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  27729. type OffHCEMessageCallback = (result: OnHCEMessageListenerResult) => void
  27730. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  27731. type OffHeadersReceivedCallback = (
  27732. result: OnHeadersReceivedListenerResult
  27733. ) => void
  27734. /** onKeyboardHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27735. type OffKeyboardHeightChangeCallback = (
  27736. result: OnKeyboardHeightChangeListenerResult
  27737. ) => void
  27738. /** onLazyLoadError 传入的监听函数。不传此参数则移除所有监听函数。 */
  27739. type OffLazyLoadErrorCallback = (
  27740. result: OnLazyLoadErrorListenerResult
  27741. ) => void
  27742. /** onListening 传入的监听函数。不传此参数则移除所有监听函数。 */
  27743. type OffListeningCallback = (res: GeneralCallbackResult) => void
  27744. /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
  27745. type OffLoadCallback = (res: GeneralCallbackResult) => void
  27746. /** onLocalServiceDiscoveryStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  27747. type OffLocalServiceDiscoveryStopCallback = (
  27748. res: GeneralCallbackResult
  27749. ) => void
  27750. /** onLocalServiceFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  27751. type OffLocalServiceFoundCallback = (
  27752. result: OnLocalServiceFoundListenerResult
  27753. ) => void
  27754. /** onLocalServiceLost 传入的监听函数。不传此参数则移除所有监听函数。 */
  27755. type OffLocalServiceLostCallback = (
  27756. result: OnLocalServiceLostListenerResult
  27757. ) => void
  27758. /** onLocalServiceResolveFail 传入的监听函数。不传此参数则移除所有监听函数。 */
  27759. type OffLocalServiceResolveFailCallback = (
  27760. result: OnLocalServiceLostListenerResult
  27761. ) => void
  27762. /** onLocationChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27763. type OffLocationChangeCallback = (
  27764. result: OnLocationChangeListenerResult
  27765. ) => void
  27766. /** onLocationChangeError 传入的监听函数。不传此参数则移除所有监听函数。 */
  27767. type OffLocationChangeErrorCallback = (
  27768. result: OnLocationChangeErrorListenerResult
  27769. ) => void
  27770. /** onMemoryWarning 传入的监听函数。不传此参数则移除所有监听函数。 */
  27771. type OffMemoryWarningCallback = (
  27772. result: OnMemoryWarningListenerResult
  27773. ) => void
  27774. /** onNetworkStatusChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27775. type OffNetworkStatusChangeCallback = (res: GeneralCallbackResult) => void
  27776. /** onNetworkWeakChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27777. type OffNetworkWeakChangeCallback = (
  27778. result: OnNetworkWeakChangeListenerResult
  27779. ) => void
  27780. /** onPageNotFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  27781. type OffPageNotFoundCallback = (
  27782. result: OnPageNotFoundListenerResult
  27783. ) => void
  27784. /** onPause 传入的监听函数。不传此参数则移除所有监听函数。 */
  27785. type OffPauseCallback = (res: GeneralCallbackResult) => void
  27786. /** onPlay 传入的监听函数。不传此参数则移除所有监听函数。 */
  27787. type OffPlayCallback = (res: GeneralCallbackResult) => void
  27788. /** onScreenRecordingStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  27789. type OffScreenRecordingStateChangedCallback = (
  27790. result: OnScreenRecordingStateChangedListenerResult
  27791. ) => void
  27792. /** onSeeked 传入的监听函数。不传此参数则移除所有监听函数。 */
  27793. type OffSeekedCallback = (res: GeneralCallbackResult) => void
  27794. /** onSeeking 传入的监听函数。不传此参数则移除所有监听函数。 */
  27795. type OffSeekingCallback = (res: GeneralCallbackResult) => void
  27796. /** onStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  27797. type OffStopCallback = (res: GeneralCallbackResult) => void
  27798. /** onThemeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  27799. type OffThemeChangeCallback = (result: OnThemeChangeListenerResult) => void
  27800. /** onTimeUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  27801. type OffTimeUpdateCallback = (res: GeneralCallbackResult) => void
  27802. /** onUnhandledRejection 传入的监听函数。不传此参数则移除所有监听函数。 */
  27803. type OffUnhandledRejectionCallback = (
  27804. result: OnUnhandledRejectionListenerResult
  27805. ) => void
  27806. /** onVoIPChatInterrupted 传入的监听函数。不传此参数则移除所有监听函数。 */
  27807. type OffVoIPChatInterruptedCallback = (
  27808. result: OnVoIPChatInterruptedListenerResult
  27809. ) => void
  27810. /** onVoIPChatMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  27811. type OffVoIPChatMembersChangedCallback = (
  27812. result: OnVoIPChatMembersChangedListenerResult
  27813. ) => void
  27814. /** onVoIPChatSpeakersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  27815. type OffVoIPChatSpeakersChangedCallback = (
  27816. result: OnVoIPChatSpeakersChangedListenerResult
  27817. ) => void
  27818. /** onVoIPChatStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  27819. type OffVoIPChatStateChangedCallback = (
  27820. result: OnVoIPChatStateChangedListenerResult
  27821. ) => void
  27822. /** onVoIPVideoMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  27823. type OffVoIPVideoMembersChangedCallback = (
  27824. result: OnVoIPVideoMembersChangedListenerResult
  27825. ) => void
  27826. /** onWaiting 传入的监听函数。不传此参数则移除所有监听函数。 */
  27827. type OffWaitingCallback = (res: GeneralCallbackResult) => void
  27828. /** onWifiConnected 传入的监听函数。不传此参数则移除所有监听函数。 */
  27829. type OffWifiConnectedCallback = (
  27830. result: OnWifiConnectedListenerResult
  27831. ) => void
  27832. /** onWifiConnectedWithPartialInfo 传入的监听函数。不传此参数则移除所有监听函数。 */
  27833. type OffWifiConnectedWithPartialInfoCallback = (
  27834. result: OnWifiConnectedWithPartialInfoListenerResult
  27835. ) => void
  27836. /** onWindowResize 传入的监听函数。不传此参数则移除所有监听函数。 */
  27837. type OffWindowResizeCallback = (
  27838. result: OnWindowResizeListenerResult
  27839. ) => void
  27840. /** 加速度数据事件的监听函数 */
  27841. type OnAccelerometerChangeCallback = (
  27842. result: OnAccelerometerChangeListenerResult
  27843. ) => void
  27844. /** 小程序切后台事件的监听函数 */
  27845. type OnAppHideCallback = (res: GeneralCallbackResult) => void
  27846. /** 小程序切前台事件的监听函数 */
  27847. type OnAppShowCallback = (
  27848. /** 启动参数 */
  27849. options: LaunchOptionsApp
  27850. ) => void
  27851. /** 音频因为受到系统占用而被中断开始事件的监听函数 */
  27852. type OnAudioInterruptionBeginCallback = (res: GeneralCallbackResult) => void
  27853. /** 音频中断结束事件的监听函数 */
  27854. type OnAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void
  27855. /** 蓝牙低功耗设备的特征值变化事件的监听函数 */
  27856. type OnBLECharacteristicValueChangeCallback = (
  27857. result: OnBLECharacteristicValueChangeListenerResult
  27858. ) => void
  27859. /** 蓝牙低功耗连接状态改变事件的监听函数 */
  27860. type OnBLEConnectionStateChangeCallback = (
  27861. result: OnBLEConnectionStateChangeListenerResult
  27862. ) => void
  27863. /** 蓝牙低功耗的最大传输单元变化事件的监听函数 */
  27864. type OnBLEMTUChangeCallback = (result: OnBLEMTUChangeListenerResult) => void
  27865. /** 当前外围设备被连接或断开连接事件的监听函数 */
  27866. type OnBLEPeripheralConnectionStateChangedCallback = (
  27867. result: OnBLEPeripheralConnectionStateChangedListenerResult
  27868. ) => void
  27869. /** 音乐暂停事件的监听函数 */
  27870. type OnBackgroundAudioPauseCallback = (res: GeneralCallbackResult) => void
  27871. /** 音乐播放事件的监听函数 */
  27872. type OnBackgroundAudioPlayCallback = (res: GeneralCallbackResult) => void
  27873. /** 音乐停止事件的监听函数 */
  27874. type OnBackgroundAudioStopCallback = (res: GeneralCallbackResult) => void
  27875. /** 收到 backgroundFetch 数据事件的监听函数 */
  27876. type OnBackgroundFetchDataCallback = (
  27877. result: OnBackgroundFetchDataListenerResult
  27878. ) => void
  27879. /** Beacon 服务状态变化事件的监听函数 */
  27880. type OnBeaconServiceChangeCallback = (
  27881. result: OnBeaconServiceChangeListenerResult
  27882. ) => void
  27883. /** Beacon 设备更新事件的监听函数 */
  27884. type OnBeaconUpdateCallback = (result: OnBeaconUpdateListenerResult) => void
  27885. /** 当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数 */
  27886. type OnBindWifiCallback = (res: GeneralCallbackResult) => void
  27887. /** 蓝牙适配器状态变化事件的监听函数 */
  27888. type OnBluetoothAdapterStateChangeCallback = (
  27889. result: OnBluetoothAdapterStateChangeListenerResult
  27890. ) => void
  27891. /** 搜索到新设备的事件的监听函数 */
  27892. type OnBluetoothDeviceFoundCallback = (
  27893. result: OnBluetoothDeviceFoundListenerResult
  27894. ) => void
  27895. /** 回调函数 */
  27896. type OnCameraFrameCallback = (result: OnCameraFrameCallbackResult) => void
  27897. type OnCanplayCallback = (res: GeneralCallbackResult) => void
  27898. /** 已连接的设备请求读当前外围设备的特征值事件的监听函数 */
  27899. type OnCharacteristicReadRequestCallback = (
  27900. result: OnCharacteristicReadRequestListenerResult
  27901. ) => void
  27902. /** 特征订阅事件的监听函数 */
  27903. type OnCharacteristicSubscribedCallback = (
  27904. result: OnCharacteristicSubscribedListenerResult
  27905. ) => void
  27906. /** 取消特征订阅事件的监听函数 */
  27907. type OnCharacteristicUnsubscribedCallback = (
  27908. result: OnCharacteristicSubscribedListenerResult
  27909. ) => void
  27910. /** 已连接的设备请求写当前外围设备的特征值事件的监听函数 */
  27911. type OnCharacteristicWriteRequestCallback = (
  27912. result: OnCharacteristicWriteRequestListenerResult
  27913. ) => void
  27914. /** 向微信后台请求检查更新结果事件的监听函数 */
  27915. type OnCheckForUpdateCallback = (
  27916. result: OnCheckForUpdateListenerResult
  27917. ) => void
  27918. /** Transfer-Encoding Chunk Received 事件的监听函数 */
  27919. type OnChunkReceivedCallback = (
  27920. result: OnChunkReceivedListenerResult
  27921. ) => void
  27922. /** 罗盘数据变化事件的监听函数 */
  27923. type OnCompassChangeCallback = (
  27924. result: OnCompassChangeListenerResult
  27925. ) => void
  27926. /** 当一个 socket 连接成功建立的时候触发该事件的监听函数 */
  27927. type OnConnectCallback = (res: GeneralCallbackResult) => void
  27928. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的监听函数 */
  27929. type OnCopyUrlCallback = (result: OnCopyUrlListenerResult) => void
  27930. /** 设备方向变化事件的监听函数 */
  27931. type OnDeviceMotionChangeCallback = (
  27932. result: OnDeviceMotionChangeListenerResult
  27933. ) => void
  27934. /** 的监听函数 */
  27935. type OnDiscoveredCallback = (result: OnDiscoveredListenerResult) => void
  27936. type OnEndedCallback = (res: GeneralCallbackResult) => void
  27937. /** 已录制完指定帧大小的文件事件的监听函数 */
  27938. type OnFrameRecordedCallback = (
  27939. result: OnFrameRecordedListenerResult
  27940. ) => void
  27941. /** 获取到 Wi-Fi 列表数据事件的监听函数 */
  27942. type OnGetWifiListCallback = (result: OnGetWifiListListenerResult) => void
  27943. /** 陀螺仪数据变化事件的监听函数 */
  27944. type OnGyroscopeChangeCallback = (
  27945. result: OnGyroscopeChangeListenerResult
  27946. ) => void
  27947. /** 接收 NFC 设备消息事件的监听函数 */
  27948. type OnHCEMessageCallback = (result: OnHCEMessageListenerResult) => void
  27949. /** HTTP Response Header 事件的监听函数 */
  27950. type OnHeadersReceivedCallback = (
  27951. result: OnHeadersReceivedListenerResult
  27952. ) => void
  27953. /** 录音因为受到系统占用而被中断开始事件的监听函数 */
  27954. type OnInterruptionBeginCallback = (res: GeneralCallbackResult) => void
  27955. /** 录音中断结束事件的监听函数 */
  27956. type OnInterruptionEndCallback = (res: GeneralCallbackResult) => void
  27957. /** 键盘高度变化事件的监听函数 */
  27958. type OnKeyboardHeightChangeCallback = (
  27959. result: OnKeyboardHeightChangeListenerResult
  27960. ) => void
  27961. /** 小程序异步组件加载失败事件的监听函数 */
  27962. type OnLazyLoadErrorCallback = (
  27963. result: OnLazyLoadErrorListenerResult
  27964. ) => void
  27965. /** 开始监听数据包消息的事件的监听函数 */
  27966. type OnListeningCallback = (res: GeneralCallbackResult) => void
  27967. type OnLoadCallback = (res: GeneralCallbackResult) => void
  27968. /** mDNS 服务停止搜索的事件的监听函数 */
  27969. type OnLocalServiceDiscoveryStopCallback = (
  27970. res: GeneralCallbackResult
  27971. ) => void
  27972. /** mDNS 服务发现的事件的监听函数 */
  27973. type OnLocalServiceFoundCallback = (
  27974. result: OnLocalServiceFoundListenerResult
  27975. ) => void
  27976. /** mDNS 服务离开的事件的监听函数 */
  27977. type OnLocalServiceLostCallback = (
  27978. result: OnLocalServiceLostListenerResult
  27979. ) => void
  27980. /** mDNS 服务解析失败的事件的监听函数 */
  27981. type OnLocalServiceResolveFailCallback = (
  27982. result: OnLocalServiceLostListenerResult
  27983. ) => void
  27984. /** 实时地理位置变化事件的监听函数 */
  27985. type OnLocationChangeCallback = (
  27986. result: OnLocationChangeListenerResult
  27987. ) => void
  27988. /** 的监听函数 */
  27989. type OnLocationChangeErrorCallback = (
  27990. result: OnLocationChangeErrorListenerResult
  27991. ) => void
  27992. /** 内存不足告警事件的监听函数 */
  27993. type OnMemoryWarningCallback = (
  27994. result: OnMemoryWarningListenerResult
  27995. ) => void
  27996. /** 网络状态变化事件的监听函数 */
  27997. type OnNetworkStatusChangeCallback = (
  27998. result: OnNetworkStatusChangeListenerResult
  27999. ) => void
  28000. /** 弱网状态变化事件的监听函数 */
  28001. type OnNetworkWeakChangeCallback = (
  28002. result: OnNetworkWeakChangeListenerResult
  28003. ) => void
  28004. /** 用户在系统音乐播放面板点击下一曲事件的监听函数 */
  28005. type OnNextCallback = (res: GeneralCallbackResult) => void
  28006. /** WebSocket 连接打开事件的监听函数 */
  28007. type OnOpenCallback = (result: OnOpenListenerResult) => void
  28008. /** 小程序要打开的页面不存在事件的监听函数 */
  28009. type OnPageNotFoundCallback = (result: OnPageNotFoundListenerResult) => void
  28010. type OnPauseCallback = (res: GeneralCallbackResult) => void
  28011. type OnPlayCallback = (res: GeneralCallbackResult) => void
  28012. /** 用户在系统音乐播放面板点击上一曲事件的监听函数 */
  28013. type OnPrevCallback = (res: GeneralCallbackResult) => void
  28014. /** worker线程被系统回收事件的监听函数 */
  28015. type OnProcessKilledCallback = (res: GeneralCallbackResult) => void
  28016. /** 录音继续事件的监听函数 */
  28017. type OnResumeCallback = (res: GeneralCallbackResult) => void
  28018. /** 用户录屏事件的监听函数 */
  28019. type OnScreenRecordingStateChangedCallback = (
  28020. result: OnScreenRecordingStateChangedListenerResult
  28021. ) => void
  28022. type OnSeekedCallback = (res: GeneralCallbackResult) => void
  28023. type OnSeekingCallback = (res: GeneralCallbackResult) => void
  28024. /** WebSocket 连接关闭事件的监听函数 */
  28025. type OnSocketCloseCallback = (
  28026. result: SocketTaskOnCloseListenerResult
  28027. ) => void
  28028. /** WebSocket 错误事件的监听函数 */
  28029. type OnSocketErrorCallback = (result: GeneralCallbackResult) => void
  28030. /** WebSocket 接受到服务器的消息事件的监听函数 */
  28031. type OnSocketMessageCallback = (
  28032. result: SocketTaskOnMessageListenerResult
  28033. ) => void
  28034. /** WebSocket 连接打开事件的监听函数 */
  28035. type OnSocketOpenCallback = (result: OnSocketOpenListenerResult) => void
  28036. /** 录音开始事件的监听函数 */
  28037. type OnStartCallback = (res: GeneralCallbackResult) => void
  28038. /** 系统主题改变事件的监听函数 */
  28039. type OnThemeChangeCallback = (result: OnThemeChangeListenerResult) => void
  28040. type OnTimeUpdateCallback = (res: GeneralCallbackResult) => void
  28041. /** 未处理的 Promise 拒绝事件的监听函数 */
  28042. type OnUnhandledRejectionCallback = (
  28043. result: OnUnhandledRejectionListenerResult
  28044. ) => void
  28045. /** 小程序更新失败事件的监听函数 */
  28046. type OnUpdateFailedCallback = (res: GeneralCallbackResult) => void
  28047. /** 小程序有版本更新事件的监听函数 */
  28048. type OnUpdateReadyCallback = (res: GeneralCallbackResult) => void
  28049. /** 用户主动截屏事件的监听函数 */
  28050. type OnUserCaptureScreenCallback = (res: GeneralCallbackResult) => void
  28051. /** 被动断开实时语音通话事件的监听函数 */
  28052. type OnVoIPChatInterruptedCallback = (
  28053. result: OnVoIPChatInterruptedListenerResult
  28054. ) => void
  28055. /** 实时语音通话成员在线状态变化事件的监听函数 */
  28056. type OnVoIPChatMembersChangedCallback = (
  28057. result: OnVoIPChatMembersChangedListenerResult
  28058. ) => void
  28059. /** 实时语音通话成员通话状态变化事件的监听函数 */
  28060. type OnVoIPChatSpeakersChangedCallback = (
  28061. result: OnVoIPChatSpeakersChangedListenerResult
  28062. ) => void
  28063. /** 房间状态变化事件的监听函数 */
  28064. type OnVoIPChatStateChangedCallback = (
  28065. result: OnVoIPChatStateChangedListenerResult
  28066. ) => void
  28067. /** 实时语音通话成员视频状态变化事件的监听函数 */
  28068. type OnVoIPVideoMembersChangedCallback = (
  28069. result: OnVoIPVideoMembersChangedListenerResult
  28070. ) => void
  28071. /** 音频加载中事件的监听函数 */
  28072. type OnWaitingCallback = (res: GeneralCallbackResult) => void
  28073. /** 连接上 Wi-Fi 的事件的监听函数 */
  28074. type OnWifiConnectedCallback = (
  28075. result: OnWifiConnectedListenerResult
  28076. ) => void
  28077. /** 连接上 Wi-Fi 的事件的监听函数 */
  28078. type OnWifiConnectedWithPartialInfoCallback = (
  28079. result: OnWifiConnectedWithPartialInfoListenerResult
  28080. ) => void
  28081. /** 窗口尺寸变化事件的监听函数 */
  28082. type OnWindowResizeCallback = (result: OnWindowResizeListenerResult) => void
  28083. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28084. type OpenAppAuthorizeSettingCompleteCallback = (
  28085. res: GeneralCallbackResult
  28086. ) => void
  28087. /** 接口调用失败的回调函数 */
  28088. type OpenAppAuthorizeSettingFailCallback = (
  28089. res: GeneralCallbackResult
  28090. ) => void
  28091. /** 接口调用成功的回调函数 */
  28092. type OpenAppAuthorizeSettingSuccessCallback = (
  28093. res: GeneralCallbackResult
  28094. ) => void
  28095. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28096. type OpenBluetoothAdapterCompleteCallback = (res: BluetoothError) => void
  28097. /** 接口调用失败的回调函数 */
  28098. type OpenBluetoothAdapterFailCallback = (res: BluetoothError) => void
  28099. /** 接口调用成功的回调函数 */
  28100. type OpenBluetoothAdapterSuccessCallback = (res: BluetoothError) => void
  28101. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28102. type OpenCardCompleteCallback = (res: GeneralCallbackResult) => void
  28103. /** 接口调用失败的回调函数 */
  28104. type OpenCardFailCallback = (res: GeneralCallbackResult) => void
  28105. /** 接口调用成功的回调函数 */
  28106. type OpenCardSuccessCallback = (res: GeneralCallbackResult) => void
  28107. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28108. type OpenChannelsActivityCompleteCallback = (
  28109. res: GeneralCallbackResult
  28110. ) => void
  28111. /** 接口调用失败的回调函数 */
  28112. type OpenChannelsActivityFailCallback = (res: GeneralCallbackResult) => void
  28113. /** 接口调用成功的回调函数 */
  28114. type OpenChannelsActivitySuccessCallback = (
  28115. res: GeneralCallbackResult
  28116. ) => void
  28117. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28118. type OpenChannelsEventCompleteCallback = (
  28119. res: GeneralCallbackResult
  28120. ) => void
  28121. /** 接口调用失败的回调函数 */
  28122. type OpenChannelsEventFailCallback = (res: GeneralCallbackResult) => void
  28123. /** 接口调用成功的回调函数 */
  28124. type OpenChannelsEventSuccessCallback = (res: GeneralCallbackResult) => void
  28125. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28126. type OpenChannelsLiveCompleteCallback = (res: GeneralCallbackResult) => void
  28127. /** 接口调用失败的回调函数 */
  28128. type OpenChannelsLiveFailCallback = (res: GeneralCallbackResult) => void
  28129. /** 接口调用成功的回调函数 */
  28130. type OpenChannelsLiveSuccessCallback = (res: GeneralCallbackResult) => void
  28131. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28132. type OpenChannelsUserProfileCompleteCallback = (
  28133. res: GeneralCallbackResult
  28134. ) => void
  28135. /** 接口调用失败的回调函数 */
  28136. type OpenChannelsUserProfileFailCallback = (
  28137. res: GeneralCallbackResult
  28138. ) => void
  28139. /** 接口调用成功的回调函数 */
  28140. type OpenChannelsUserProfileSuccessCallback = (
  28141. res: GeneralCallbackResult
  28142. ) => void
  28143. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28144. type OpenCompleteCallback = (res: GeneralCallbackResult) => void
  28145. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28146. type OpenCustomerServiceChatCompleteCallback = (
  28147. res: GeneralCallbackResult
  28148. ) => void
  28149. /** 接口调用失败的回调函数 */
  28150. type OpenCustomerServiceChatFailCallback = (
  28151. res: GeneralCallbackResult
  28152. ) => void
  28153. /** 接口调用成功的回调函数 */
  28154. type OpenCustomerServiceChatSuccessCallback = (
  28155. res: GeneralCallbackResult
  28156. ) => void
  28157. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28158. type OpenDocumentCompleteCallback = (res: GeneralCallbackResult) => void
  28159. /** 接口调用失败的回调函数 */
  28160. type OpenDocumentFailCallback = (res: GeneralCallbackResult) => void
  28161. /** 接口调用成功的回调函数 */
  28162. type OpenDocumentSuccessCallback = (res: GeneralCallbackResult) => void
  28163. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28164. type OpenEmbeddedMiniProgramCompleteCallback = (
  28165. res: GeneralCallbackResult
  28166. ) => void
  28167. /** 接口调用失败的回调函数 */
  28168. type OpenEmbeddedMiniProgramFailCallback = (
  28169. res: GeneralCallbackResult
  28170. ) => void
  28171. /** 接口调用成功的回调函数 */
  28172. type OpenEmbeddedMiniProgramSuccessCallback = (
  28173. res: GeneralCallbackResult
  28174. ) => void
  28175. /** 接口调用失败的回调函数 */
  28176. type OpenFailCallback = (result: OpenFailCallbackResult) => void
  28177. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28178. type OpenLocationCompleteCallback = (res: GeneralCallbackResult) => void
  28179. /** 接口调用失败的回调函数 */
  28180. type OpenLocationFailCallback = (res: GeneralCallbackResult) => void
  28181. /** 接口调用成功的回调函数 */
  28182. type OpenLocationSuccessCallback = (res: GeneralCallbackResult) => void
  28183. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28184. type OpenMapAppCompleteCallback = (res: GeneralCallbackResult) => void
  28185. /** 接口调用失败的回调函数 */
  28186. type OpenMapAppFailCallback = (res: GeneralCallbackResult) => void
  28187. /** 接口调用成功的回调函数 */
  28188. type OpenMapAppSuccessCallback = (res: GeneralCallbackResult) => void
  28189. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28190. type OpenSettingCompleteCallback = (res: GeneralCallbackResult) => void
  28191. /** 接口调用失败的回调函数 */
  28192. type OpenSettingFailCallback = (res: GeneralCallbackResult) => void
  28193. /** 接口调用成功的回调函数 */
  28194. type OpenSettingSuccessCallback = (
  28195. result: OpenSettingSuccessCallbackResult
  28196. ) => void
  28197. /** 接口调用成功的回调函数 */
  28198. type OpenSuccessCallback = (result: OpenSuccessCallbackResult) => void
  28199. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28200. type OpenSystemBluetoothSettingCompleteCallback = (
  28201. res: GeneralCallbackResult
  28202. ) => void
  28203. /** 接口调用失败的回调函数 */
  28204. type OpenSystemBluetoothSettingFailCallback = (
  28205. res: GeneralCallbackResult
  28206. ) => void
  28207. /** 接口调用成功的回调函数 */
  28208. type OpenSystemBluetoothSettingSuccessCallback = (
  28209. res: GeneralCallbackResult
  28210. ) => void
  28211. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28212. type OpenVideoEditorCompleteCallback = (res: GeneralCallbackResult) => void
  28213. /** 接口调用失败的回调函数 */
  28214. type OpenVideoEditorFailCallback = (res: GeneralCallbackResult) => void
  28215. /** 接口调用成功的回调函数 */
  28216. type OpenVideoEditorSuccessCallback = (
  28217. result: OpenVideoEditorSuccessCallbackResult
  28218. ) => void
  28219. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28220. type PageScrollToCompleteCallback = (res: GeneralCallbackResult) => void
  28221. /** 接口调用失败的回调函数 */
  28222. type PageScrollToFailCallback = (res: GeneralCallbackResult) => void
  28223. /** 接口调用成功的回调函数 */
  28224. type PageScrollToSuccessCallback = (res: GeneralCallbackResult) => void
  28225. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28226. type PauseBGMCompleteCallback = (res: GeneralCallbackResult) => void
  28227. /** 接口调用失败的回调函数 */
  28228. type PauseBGMFailCallback = (res: GeneralCallbackResult) => void
  28229. /** 接口调用成功的回调函数 */
  28230. type PauseBGMSuccessCallback = (res: GeneralCallbackResult) => void
  28231. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28232. type PauseBackgroundAudioCompleteCallback = (
  28233. res: GeneralCallbackResult
  28234. ) => void
  28235. /** 接口调用失败的回调函数 */
  28236. type PauseBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  28237. /** 接口调用成功的回调函数 */
  28238. type PauseBackgroundAudioSuccessCallback = (
  28239. res: GeneralCallbackResult
  28240. ) => void
  28241. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28242. type PauseCompleteCallback = (res: GeneralCallbackResult) => void
  28243. /** 接口调用失败的回调函数 */
  28244. type PauseFailCallback = (res: GeneralCallbackResult) => void
  28245. /** 接口调用成功的回调函数 */
  28246. type PauseSuccessCallback = (res: GeneralCallbackResult) => void
  28247. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28248. type PauseVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  28249. /** 接口调用失败的回调函数 */
  28250. type PauseVoiceFailCallback = (res: GeneralCallbackResult) => void
  28251. /** 接口调用成功的回调函数 */
  28252. type PauseVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  28253. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28254. type PlayBGMCompleteCallback = (res: GeneralCallbackResult) => void
  28255. /** 接口调用失败的回调函数 */
  28256. type PlayBGMFailCallback = (res: GeneralCallbackResult) => void
  28257. /** 接口调用成功的回调函数 */
  28258. type PlayBGMSuccessCallback = (res: GeneralCallbackResult) => void
  28259. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28260. type PlayBackgroundAudioCompleteCallback = (
  28261. res: GeneralCallbackResult
  28262. ) => void
  28263. /** 接口调用失败的回调函数 */
  28264. type PlayBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  28265. /** 接口调用成功的回调函数 */
  28266. type PlayBackgroundAudioSuccessCallback = (
  28267. res: GeneralCallbackResult
  28268. ) => void
  28269. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28270. type PlayCompleteCallback = (res: GeneralCallbackResult) => void
  28271. /** 接口调用失败的回调函数 */
  28272. type PlayFailCallback = (res: GeneralCallbackResult) => void
  28273. /** 接口调用成功的回调函数 */
  28274. type PlaySuccessCallback = (res: GeneralCallbackResult) => void
  28275. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28276. type PlayVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  28277. /** 接口调用失败的回调函数 */
  28278. type PlayVoiceFailCallback = (res: GeneralCallbackResult) => void
  28279. /** 接口调用成功的回调函数 */
  28280. type PlayVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  28281. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28282. type PluginLoginCompleteCallback = (res: GeneralCallbackResult) => void
  28283. /** 接口调用失败的回调函数 */
  28284. type PluginLoginFailCallback = (res: GeneralCallbackResult) => void
  28285. /** 接口调用成功的回调函数 */
  28286. type PluginLoginSuccessCallback = (
  28287. result: PluginLoginSuccessCallbackResult
  28288. ) => void
  28289. /** 分包加载进度变化事件的监听函数 */
  28290. type PreDownloadSubpackageTaskOnProgressUpdateCallback = (
  28291. result: PreDownloadSubpackageTaskOnProgressUpdateListenerResult
  28292. ) => void
  28293. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28294. type PreloadAssetsCompleteCallback = (res: GeneralCallbackResult) => void
  28295. /** 接口调用失败的回调函数 */
  28296. type PreloadAssetsFailCallback = (res: GeneralCallbackResult) => void
  28297. /** 接口调用成功的回调函数 */
  28298. type PreloadAssetsSuccessCallback = (res: GeneralCallbackResult) => void
  28299. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28300. type PreloadSkylineViewCompleteCallback = (
  28301. res: GeneralCallbackResult
  28302. ) => void
  28303. /** 接口调用失败的回调函数 */
  28304. type PreloadSkylineViewFailCallback = (res: GeneralCallbackResult) => void
  28305. /** 接口调用成功的回调函数 */
  28306. type PreloadSkylineViewSuccessCallback = (
  28307. res: GeneralCallbackResult
  28308. ) => void
  28309. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28310. type PreloadWebviewCompleteCallback = (res: GeneralCallbackResult) => void
  28311. /** 接口调用失败的回调函数 */
  28312. type PreloadWebviewFailCallback = (res: GeneralCallbackResult) => void
  28313. /** 接口调用成功的回调函数 */
  28314. type PreloadWebviewSuccessCallback = (res: GeneralCallbackResult) => void
  28315. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28316. type PreviewImageCompleteCallback = (res: GeneralCallbackResult) => void
  28317. /** 接口调用失败的回调函数 */
  28318. type PreviewImageFailCallback = (res: GeneralCallbackResult) => void
  28319. /** 接口调用成功的回调函数 */
  28320. type PreviewImageSuccessCallback = (res: GeneralCallbackResult) => void
  28321. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28322. type PreviewMediaCompleteCallback = (res: GeneralCallbackResult) => void
  28323. /** 接口调用失败的回调函数 */
  28324. type PreviewMediaFailCallback = (res: GeneralCallbackResult) => void
  28325. /** 接口调用成功的回调函数 */
  28326. type PreviewMediaSuccessCallback = (res: GeneralCallbackResult) => void
  28327. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28328. type ReLaunchCompleteCallback = (res: GeneralCallbackResult) => void
  28329. /** 接口调用失败的回调函数 */
  28330. type ReLaunchFailCallback = (res: GeneralCallbackResult) => void
  28331. /** 接口调用成功的回调函数 */
  28332. type ReLaunchSuccessCallback = (res: GeneralCallbackResult) => void
  28333. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28334. type ReadBLECharacteristicValueCompleteCallback = (
  28335. res: BluetoothError
  28336. ) => void
  28337. /** 接口调用失败的回调函数 */
  28338. type ReadBLECharacteristicValueFailCallback = (res: BluetoothError) => void
  28339. /** 接口调用成功的回调函数 */
  28340. type ReadBLECharacteristicValueSuccessCallback = (
  28341. res: BluetoothError
  28342. ) => void
  28343. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28344. type ReadCompleteCallback = (res: GeneralCallbackResult) => void
  28345. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28346. type ReadCompressedFileCompleteCallback = (
  28347. res: GeneralCallbackResult
  28348. ) => void
  28349. /** 接口调用失败的回调函数 */
  28350. type ReadCompressedFileFailCallback = (
  28351. result: ReadCompressedFileFailCallbackResult
  28352. ) => void
  28353. /** 接口调用成功的回调函数 */
  28354. type ReadCompressedFileSuccessCallback = (
  28355. result: ReadCompressedFileSuccessCallbackResult
  28356. ) => void
  28357. /** 接口调用失败的回调函数 */
  28358. type ReadFailCallback = (result: ReadFailCallbackResult) => void
  28359. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28360. type ReadFileCompleteCallback = (res: GeneralCallbackResult) => void
  28361. /** 接口调用失败的回调函数 */
  28362. type ReadFileFailCallback = (result: ReadFileFailCallbackResult) => void
  28363. /** 接口调用成功的回调函数 */
  28364. type ReadFileSuccessCallback = (
  28365. result: ReadFileSuccessCallbackResult
  28366. ) => void
  28367. /** 接口调用成功的回调函数 */
  28368. type ReadSuccessCallback = (result: ReadSuccessCallbackResult) => void
  28369. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28370. type ReadZipEntryCompleteCallback = (res: GeneralCallbackResult) => void
  28371. /** 接口调用失败的回调函数 */
  28372. type ReadZipEntryFailCallback = (
  28373. result: ReadZipEntryFailCallbackResult
  28374. ) => void
  28375. /** 接口调用成功的回调函数 */
  28376. type ReadZipEntrySuccessCallback = (
  28377. result: ReadZipEntrySuccessCallbackResult
  28378. ) => void
  28379. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28380. type ReaddirCompleteCallback = (res: GeneralCallbackResult) => void
  28381. /** 接口调用失败的回调函数 */
  28382. type ReaddirFailCallback = (result: ReaddirFailCallbackResult) => void
  28383. /** 接口调用成功的回调函数 */
  28384. type ReaddirSuccessCallback = (result: ReaddirSuccessCallbackResult) => void
  28385. /** 录音结束事件的监听函数 */
  28386. type RecorderManagerOnStopCallback = (result: OnStopListenerResult) => void
  28387. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28388. type RedirectToCompleteCallback = (res: GeneralCallbackResult) => void
  28389. /** 接口调用失败的回调函数 */
  28390. type RedirectToFailCallback = (res: GeneralCallbackResult) => void
  28391. /** 接口调用成功的回调函数 */
  28392. type RedirectToSuccessCallback = (res: GeneralCallbackResult) => void
  28393. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28394. type RedoCompleteCallback = (res: GeneralCallbackResult) => void
  28395. /** 接口调用失败的回调函数 */
  28396. type RedoFailCallback = (res: GeneralCallbackResult) => void
  28397. /** 接口调用成功的回调函数 */
  28398. type RedoSuccessCallback = (res: GeneralCallbackResult) => void
  28399. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28400. type RemoveArcCompleteCallback = (res: GeneralCallbackResult) => void
  28401. /** 接口调用失败的回调函数 */
  28402. type RemoveArcFailCallback = (res: GeneralCallbackResult) => void
  28403. /** 接口调用成功的回调函数 */
  28404. type RemoveArcSuccessCallback = (res: GeneralCallbackResult) => void
  28405. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28406. type RemoveCustomLayerCompleteCallback = (
  28407. res: GeneralCallbackResult
  28408. ) => void
  28409. /** 接口调用失败的回调函数 */
  28410. type RemoveCustomLayerFailCallback = (res: GeneralCallbackResult) => void
  28411. /** 接口调用成功的回调函数 */
  28412. type RemoveCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void
  28413. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28414. type RemoveFormatCompleteCallback = (res: GeneralCallbackResult) => void
  28415. /** 接口调用失败的回调函数 */
  28416. type RemoveFormatFailCallback = (res: GeneralCallbackResult) => void
  28417. /** 接口调用成功的回调函数 */
  28418. type RemoveFormatSuccessCallback = (res: GeneralCallbackResult) => void
  28419. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28420. type RemoveGroundOverlayCompleteCallback = (
  28421. res: GeneralCallbackResult
  28422. ) => void
  28423. /** 接口调用失败的回调函数 */
  28424. type RemoveGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  28425. /** 接口调用成功的回调函数 */
  28426. type RemoveGroundOverlaySuccessCallback = (
  28427. res: GeneralCallbackResult
  28428. ) => void
  28429. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28430. type RemoveMarkersCompleteCallback = (res: GeneralCallbackResult) => void
  28431. /** 接口调用失败的回调函数 */
  28432. type RemoveMarkersFailCallback = (res: GeneralCallbackResult) => void
  28433. /** 接口调用成功的回调函数 */
  28434. type RemoveMarkersSuccessCallback = (res: GeneralCallbackResult) => void
  28435. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28436. type RemoveSavedFileCompleteCallback = (res: GeneralCallbackResult) => void
  28437. /** 接口调用失败的回调函数 */
  28438. type RemoveSavedFileFailCallback = (
  28439. result: RemoveSavedFileFailCallbackResult
  28440. ) => void
  28441. /** 接口调用成功的回调函数 */
  28442. type RemoveSavedFileSuccessCallback = (res: GeneralCallbackResult) => void
  28443. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28444. type RemoveServiceCompleteCallback = (res: GeneralCallbackResult) => void
  28445. /** 接口调用失败的回调函数 */
  28446. type RemoveServiceFailCallback = (res: GeneralCallbackResult) => void
  28447. /** 接口调用成功的回调函数 */
  28448. type RemoveServiceSuccessCallback = (res: GeneralCallbackResult) => void
  28449. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28450. type RemoveStorageCompleteCallback = (res: GeneralCallbackResult) => void
  28451. /** 接口调用失败的回调函数 */
  28452. type RemoveStorageFailCallback = (res: GeneralCallbackResult) => void
  28453. /** 接口调用成功的回调函数 */
  28454. type RemoveStorageSuccessCallback = (res: GeneralCallbackResult) => void
  28455. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28456. type RemoveTabBarBadgeCompleteCallback = (
  28457. res: GeneralCallbackResult
  28458. ) => void
  28459. /** 接口调用失败的回调函数 */
  28460. type RemoveTabBarBadgeFailCallback = (res: GeneralCallbackResult) => void
  28461. /** 接口调用成功的回调函数 */
  28462. type RemoveTabBarBadgeSuccessCallback = (res: GeneralCallbackResult) => void
  28463. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28464. type RemoveVisualLayerCompleteCallback = (
  28465. res: GeneralCallbackResult
  28466. ) => void
  28467. /** 接口调用失败的回调函数 */
  28468. type RemoveVisualLayerFailCallback = (res: GeneralCallbackResult) => void
  28469. /** 接口调用成功的回调函数 */
  28470. type RemoveVisualLayerSuccessCallback = (res: GeneralCallbackResult) => void
  28471. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28472. type RenameCompleteCallback = (res: GeneralCallbackResult) => void
  28473. /** 接口调用失败的回调函数 */
  28474. type RenameFailCallback = (result: RenameFailCallbackResult) => void
  28475. /** 接口调用成功的回调函数 */
  28476. type RenameSuccessCallback = (res: GeneralCallbackResult) => void
  28477. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28478. type RequestCompleteCallback = (res: GeneralCallbackResult) => void
  28479. /** 接口调用失败的回调函数 */
  28480. type RequestFailCallback = (err: Err) => void
  28481. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28482. type RequestFullScreenCompleteCallback = (
  28483. res: GeneralCallbackResult
  28484. ) => void
  28485. /** 接口调用失败的回调函数 */
  28486. type RequestFullScreenFailCallback = (res: GeneralCallbackResult) => void
  28487. /** 接口调用成功的回调函数 */
  28488. type RequestFullScreenSuccessCallback = (res: GeneralCallbackResult) => void
  28489. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28490. type RequestOrderPaymentCompleteCallback = (
  28491. res: GeneralCallbackResult
  28492. ) => void
  28493. /** 接口调用失败的回调函数 */
  28494. type RequestOrderPaymentFailCallback = (res: GeneralCallbackResult) => void
  28495. /** 接口调用成功的回调函数 */
  28496. type RequestOrderPaymentSuccessCallback = (
  28497. res: GeneralCallbackResult
  28498. ) => void
  28499. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28500. type RequestPaymentCompleteCallback = (res: GeneralCallbackResult) => void
  28501. /** 接口调用失败的回调函数 */
  28502. type RequestPaymentFailCallback = (res: GeneralCallbackResult) => void
  28503. /** 接口调用成功的回调函数 */
  28504. type RequestPaymentSuccessCallback = (res: GeneralCallbackResult) => void
  28505. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28506. type RequestPictureInPictureCompleteCallback = (
  28507. res: GeneralCallbackResult
  28508. ) => void
  28509. /** 接口调用失败的回调函数 */
  28510. type RequestPictureInPictureFailCallback = (
  28511. res: GeneralCallbackResult
  28512. ) => void
  28513. /** 接口调用成功的回调函数 */
  28514. type RequestPictureInPictureSuccessCallback = (
  28515. res: GeneralCallbackResult
  28516. ) => void
  28517. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28518. type RequestPluginPaymentCompleteCallback = (
  28519. res: GeneralCallbackResult
  28520. ) => void
  28521. /** 接口调用失败的回调函数 */
  28522. type RequestPluginPaymentFailCallback = (res: GeneralCallbackResult) => void
  28523. /** 接口调用成功的回调函数 */
  28524. type RequestPluginPaymentSuccessCallback = (
  28525. res: GeneralCallbackResult
  28526. ) => void
  28527. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28528. type RequestSubscribeDeviceMessageCompleteCallback = (
  28529. res: GeneralCallbackResult
  28530. ) => void
  28531. /** 接口调用失败的回调函数 */
  28532. type RequestSubscribeDeviceMessageFailCallback = (
  28533. result: RequestSubscribeDeviceMessageFailCallbackResult
  28534. ) => void
  28535. /** 接口调用成功的回调函数 */
  28536. type RequestSubscribeDeviceMessageSuccessCallback = (
  28537. result: RequestSubscribeDeviceMessageSuccessCallbackResult
  28538. ) => void
  28539. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28540. type RequestSubscribeMessageCompleteCallback = (
  28541. res: GeneralCallbackResult
  28542. ) => void
  28543. /** 接口调用失败的回调函数 */
  28544. type RequestSubscribeMessageFailCallback = (
  28545. result: RequestSubscribeMessageFailCallbackResult
  28546. ) => void
  28547. /** 接口调用成功的回调函数 */
  28548. type RequestSubscribeMessageSuccessCallback = (
  28549. result: RequestSubscribeMessageSuccessCallbackResult
  28550. ) => void
  28551. /** 接口调用成功的回调函数 */
  28552. type RequestSuccessCallback<
  28553. T extends string | IAnyObject | ArrayBuffer =
  28554. | string
  28555. | IAnyObject
  28556. | ArrayBuffer
  28557. > = (result: RequestSuccessCallbackResult<T>) => void
  28558. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28559. type ResumeBGMCompleteCallback = (res: GeneralCallbackResult) => void
  28560. /** 接口调用失败的回调函数 */
  28561. type ResumeBGMFailCallback = (res: GeneralCallbackResult) => void
  28562. /** 接口调用成功的回调函数 */
  28563. type ResumeBGMSuccessCallback = (res: GeneralCallbackResult) => void
  28564. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28565. type ResumeCompleteCallback = (res: GeneralCallbackResult) => void
  28566. /** 接口调用失败的回调函数 */
  28567. type ResumeFailCallback = (res: GeneralCallbackResult) => void
  28568. /** 接口调用成功的回调函数 */
  28569. type ResumeSuccessCallback = (res: GeneralCallbackResult) => void
  28570. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  28571. type RewardedVideoAdOffCloseCallback = (
  28572. result: RewardedVideoAdOnCloseListenerResult
  28573. ) => void
  28574. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  28575. type RewardedVideoAdOffErrorCallback = (
  28576. result: RewardedVideoAdOnErrorListenerResult
  28577. ) => void
  28578. /** 用户点击 `关闭广告` 按钮的事件的监听函数 */
  28579. type RewardedVideoAdOnCloseCallback = (
  28580. result: RewardedVideoAdOnCloseListenerResult
  28581. ) => void
  28582. /** 激励视频错误事件的监听函数 */
  28583. type RewardedVideoAdOnErrorCallback = (
  28584. result: RewardedVideoAdOnErrorListenerResult
  28585. ) => void
  28586. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28587. type RmdirCompleteCallback = (res: GeneralCallbackResult) => void
  28588. /** 接口调用失败的回调函数 */
  28589. type RmdirFailCallback = (result: RmdirFailCallbackResult) => void
  28590. /** 接口调用成功的回调函数 */
  28591. type RmdirSuccessCallback = (res: GeneralCallbackResult) => void
  28592. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28593. type SaveFileCompleteCallback = (res: GeneralCallbackResult) => void
  28594. /** 接口调用失败的回调函数 */
  28595. type SaveFileFailCallback = (result: SaveFileFailCallbackResult) => void
  28596. /** 接口调用成功的回调函数 */
  28597. type SaveFileSuccessCallback = (
  28598. result: SaveFileSuccessCallbackResult
  28599. ) => void
  28600. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28601. type SaveFileToDiskCompleteCallback = (res: GeneralCallbackResult) => void
  28602. /** 接口调用失败的回调函数 */
  28603. type SaveFileToDiskFailCallback = (res: GeneralCallbackResult) => void
  28604. /** 接口调用成功的回调函数 */
  28605. type SaveFileToDiskSuccessCallback = (res: GeneralCallbackResult) => void
  28606. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28607. type SaveImageToPhotosAlbumCompleteCallback = (
  28608. res: GeneralCallbackResult
  28609. ) => void
  28610. /** 接口调用失败的回调函数 */
  28611. type SaveImageToPhotosAlbumFailCallback = (
  28612. res: GeneralCallbackResult
  28613. ) => void
  28614. /** 接口调用成功的回调函数 */
  28615. type SaveImageToPhotosAlbumSuccessCallback = (
  28616. res: GeneralCallbackResult
  28617. ) => void
  28618. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28619. type SaveVideoToPhotosAlbumCompleteCallback = (
  28620. res: GeneralCallbackResult
  28621. ) => void
  28622. /** 接口调用失败的回调函数 */
  28623. type SaveVideoToPhotosAlbumFailCallback = (
  28624. res: GeneralCallbackResult
  28625. ) => void
  28626. /** 接口调用成功的回调函数 */
  28627. type SaveVideoToPhotosAlbumSuccessCallback = (
  28628. res: GeneralCallbackResult
  28629. ) => void
  28630. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28631. type ScanCodeCompleteCallback = (res: GeneralCallbackResult) => void
  28632. /** 接口调用失败的回调函数 */
  28633. type ScanCodeFailCallback = (res: GeneralCallbackResult) => void
  28634. /** 接口调用成功的回调函数 */
  28635. type ScanCodeSuccessCallback = (
  28636. result: ScanCodeSuccessCallbackResult
  28637. ) => void
  28638. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  28639. type ScrollOffsetCallback = (result: ScrollOffsetCallbackResult) => void
  28640. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28641. type SeekBackgroundAudioCompleteCallback = (
  28642. res: GeneralCallbackResult
  28643. ) => void
  28644. /** 接口调用失败的回调函数 */
  28645. type SeekBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  28646. /** 接口调用成功的回调函数 */
  28647. type SeekBackgroundAudioSuccessCallback = (
  28648. res: GeneralCallbackResult
  28649. ) => void
  28650. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28651. type SendCompleteCallback = (res: GeneralCallbackResult) => void
  28652. /** 接口调用失败的回调函数 */
  28653. type SendFailCallback = (res: GeneralCallbackResult) => void
  28654. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28655. type SendHCEMessageCompleteCallback = (res: NFCError) => void
  28656. /** 接口调用失败的回调函数 */
  28657. type SendHCEMessageFailCallback = (res: NFCError) => void
  28658. /** 接口调用成功的回调函数 */
  28659. type SendHCEMessageSuccessCallback = (res: NFCError) => void
  28660. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28661. type SendMessageCompleteCallback = (res: GeneralCallbackResult) => void
  28662. /** 接口调用失败的回调函数 */
  28663. type SendMessageFailCallback = (res: GeneralCallbackResult) => void
  28664. /** 接口调用成功的回调函数 */
  28665. type SendMessageSuccessCallback = (res: GeneralCallbackResult) => void
  28666. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28667. type SendSmsCompleteCallback = (res: GeneralCallbackResult) => void
  28668. /** 接口调用失败的回调函数 */
  28669. type SendSmsFailCallback = (res: GeneralCallbackResult) => void
  28670. /** 接口调用成功的回调函数 */
  28671. type SendSmsSuccessCallback = (res: GeneralCallbackResult) => void
  28672. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28673. type SendSocketMessageCompleteCallback = (
  28674. res: GeneralCallbackResult
  28675. ) => void
  28676. /** 接口调用失败的回调函数 */
  28677. type SendSocketMessageFailCallback = (res: GeneralCallbackResult) => void
  28678. /** 接口调用成功的回调函数 */
  28679. type SendSocketMessageSuccessCallback = (res: GeneralCallbackResult) => void
  28680. /** 接口调用成功的回调函数 */
  28681. type SendSuccessCallback = (res: GeneralCallbackResult) => void
  28682. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28683. type SetBGMVolumeCompleteCallback = (res: GeneralCallbackResult) => void
  28684. /** 接口调用失败的回调函数 */
  28685. type SetBGMVolumeFailCallback = (res: GeneralCallbackResult) => void
  28686. /** 接口调用成功的回调函数 */
  28687. type SetBGMVolumeSuccessCallback = (res: GeneralCallbackResult) => void
  28688. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28689. type SetBLEMTUCompleteCallback = (res: GeneralCallbackResult) => void
  28690. /** 接口调用失败的回调函数 */
  28691. type SetBLEMTUFailCallback = (result: SetBLEMTUFailCallbackResult) => void
  28692. /** 接口调用成功的回调函数 */
  28693. type SetBLEMTUSuccessCallback = (
  28694. result: SetBLEMTUSuccessCallbackResult
  28695. ) => void
  28696. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28697. type SetBackgroundColorCompleteCallback = (
  28698. res: GeneralCallbackResult
  28699. ) => void
  28700. /** 接口调用失败的回调函数 */
  28701. type SetBackgroundColorFailCallback = (res: GeneralCallbackResult) => void
  28702. /** 接口调用成功的回调函数 */
  28703. type SetBackgroundColorSuccessCallback = (
  28704. res: GeneralCallbackResult
  28705. ) => void
  28706. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28707. type SetBackgroundFetchTokenCompleteCallback = (
  28708. res: GeneralCallbackResult
  28709. ) => void
  28710. /** 接口调用失败的回调函数 */
  28711. type SetBackgroundFetchTokenFailCallback = (
  28712. res: GeneralCallbackResult
  28713. ) => void
  28714. /** 接口调用成功的回调函数 */
  28715. type SetBackgroundFetchTokenSuccessCallback = (
  28716. res: GeneralCallbackResult
  28717. ) => void
  28718. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28719. type SetBackgroundTextStyleCompleteCallback = (
  28720. res: GeneralCallbackResult
  28721. ) => void
  28722. /** 接口调用失败的回调函数 */
  28723. type SetBackgroundTextStyleFailCallback = (
  28724. res: GeneralCallbackResult
  28725. ) => void
  28726. /** 接口调用成功的回调函数 */
  28727. type SetBackgroundTextStyleSuccessCallback = (
  28728. res: GeneralCallbackResult
  28729. ) => void
  28730. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28731. type SetBoundaryCompleteCallback = (res: GeneralCallbackResult) => void
  28732. /** 接口调用失败的回调函数 */
  28733. type SetBoundaryFailCallback = (res: GeneralCallbackResult) => void
  28734. /** 接口调用成功的回调函数 */
  28735. type SetBoundarySuccessCallback = (res: GeneralCallbackResult) => void
  28736. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28737. type SetCenterOffsetCompleteCallback = (res: GeneralCallbackResult) => void
  28738. /** 接口调用失败的回调函数 */
  28739. type SetCenterOffsetFailCallback = (res: GeneralCallbackResult) => void
  28740. /** 接口调用成功的回调函数 */
  28741. type SetCenterOffsetSuccessCallback = (res: GeneralCallbackResult) => void
  28742. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28743. type SetClipboardDataCompleteCallback = (res: GeneralCallbackResult) => void
  28744. /** 接口调用失败的回调函数 */
  28745. type SetClipboardDataFailCallback = (res: GeneralCallbackResult) => void
  28746. /** 接口调用成功的回调函数 */
  28747. type SetClipboardDataSuccessCallback = (res: GeneralCallbackResult) => void
  28748. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28749. type SetContentsCompleteCallback = (res: GeneralCallbackResult) => void
  28750. /** 接口调用失败的回调函数 */
  28751. type SetContentsFailCallback = (res: GeneralCallbackResult) => void
  28752. /** 接口调用成功的回调函数 */
  28753. type SetContentsSuccessCallback = (res: GeneralCallbackResult) => void
  28754. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28755. type SetEnable1v1ChatCompleteCallback = (res: GeneralCallbackResult) => void
  28756. /** 接口调用失败的回调函数 */
  28757. type SetEnable1v1ChatFailCallback = (res: GeneralCallbackResult) => void
  28758. /** 接口调用成功的回调函数 */
  28759. type SetEnable1v1ChatSuccessCallback = (res: GeneralCallbackResult) => void
  28760. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28761. type SetEnableDebugCompleteCallback = (res: GeneralCallbackResult) => void
  28762. /** 接口调用失败的回调函数 */
  28763. type SetEnableDebugFailCallback = (res: GeneralCallbackResult) => void
  28764. /** 接口调用成功的回调函数 */
  28765. type SetEnableDebugSuccessCallback = (res: GeneralCallbackResult) => void
  28766. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28767. type SetInnerAudioOptionCompleteCallback = (
  28768. res: GeneralCallbackResult
  28769. ) => void
  28770. /** 接口调用失败的回调函数 */
  28771. type SetInnerAudioOptionFailCallback = (res: GeneralCallbackResult) => void
  28772. /** 接口调用成功的回调函数 */
  28773. type SetInnerAudioOptionSuccessCallback = (
  28774. res: GeneralCallbackResult
  28775. ) => void
  28776. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28777. type SetKeepScreenOnCompleteCallback = (res: GeneralCallbackResult) => void
  28778. /** 接口调用失败的回调函数 */
  28779. type SetKeepScreenOnFailCallback = (res: GeneralCallbackResult) => void
  28780. /** 接口调用成功的回调函数 */
  28781. type SetKeepScreenOnSuccessCallback = (res: GeneralCallbackResult) => void
  28782. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28783. type SetLocMarkerIconCompleteCallback = (res: GeneralCallbackResult) => void
  28784. /** 接口调用失败的回调函数 */
  28785. type SetLocMarkerIconFailCallback = (res: GeneralCallbackResult) => void
  28786. /** 接口调用成功的回调函数 */
  28787. type SetLocMarkerIconSuccessCallback = (res: GeneralCallbackResult) => void
  28788. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28789. type SetMICVolumeCompleteCallback = (res: GeneralCallbackResult) => void
  28790. /** 接口调用失败的回调函数 */
  28791. type SetMICVolumeFailCallback = (res: GeneralCallbackResult) => void
  28792. /** 接口调用成功的回调函数 */
  28793. type SetMICVolumeSuccessCallback = (res: GeneralCallbackResult) => void
  28794. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28795. type SetNavigationBarColorCompleteCallback = (
  28796. res: GeneralCallbackResult
  28797. ) => void
  28798. /** 接口调用失败的回调函数 */
  28799. type SetNavigationBarColorFailCallback = (
  28800. res: GeneralCallbackResult
  28801. ) => void
  28802. /** 接口调用成功的回调函数 */
  28803. type SetNavigationBarColorSuccessCallback = (
  28804. res: GeneralCallbackResult
  28805. ) => void
  28806. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28807. type SetNavigationBarTitleCompleteCallback = (
  28808. res: GeneralCallbackResult
  28809. ) => void
  28810. /** 接口调用失败的回调函数 */
  28811. type SetNavigationBarTitleFailCallback = (
  28812. res: GeneralCallbackResult
  28813. ) => void
  28814. /** 接口调用成功的回调函数 */
  28815. type SetNavigationBarTitleSuccessCallback = (
  28816. res: GeneralCallbackResult
  28817. ) => void
  28818. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28819. type SetScreenBrightnessCompleteCallback = (
  28820. res: GeneralCallbackResult
  28821. ) => void
  28822. /** 接口调用失败的回调函数 */
  28823. type SetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void
  28824. /** 接口调用成功的回调函数 */
  28825. type SetScreenBrightnessSuccessCallback = (
  28826. res: GeneralCallbackResult
  28827. ) => void
  28828. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28829. type SetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  28830. /** 接口调用失败的回调函数 */
  28831. type SetStorageFailCallback = (res: GeneralCallbackResult) => void
  28832. /** 接口调用成功的回调函数 */
  28833. type SetStorageSuccessCallback = (res: GeneralCallbackResult) => void
  28834. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28835. type SetTabBarBadgeCompleteCallback = (res: GeneralCallbackResult) => void
  28836. /** 接口调用失败的回调函数 */
  28837. type SetTabBarBadgeFailCallback = (res: GeneralCallbackResult) => void
  28838. /** 接口调用成功的回调函数 */
  28839. type SetTabBarBadgeSuccessCallback = (res: GeneralCallbackResult) => void
  28840. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28841. type SetTabBarItemCompleteCallback = (res: GeneralCallbackResult) => void
  28842. /** 接口调用失败的回调函数 */
  28843. type SetTabBarItemFailCallback = (res: GeneralCallbackResult) => void
  28844. /** 接口调用成功的回调函数 */
  28845. type SetTabBarItemSuccessCallback = (res: GeneralCallbackResult) => void
  28846. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28847. type SetTabBarStyleCompleteCallback = (res: GeneralCallbackResult) => void
  28848. /** 接口调用失败的回调函数 */
  28849. type SetTabBarStyleFailCallback = (res: GeneralCallbackResult) => void
  28850. /** 接口调用成功的回调函数 */
  28851. type SetTabBarStyleSuccessCallback = (res: GeneralCallbackResult) => void
  28852. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28853. type SetTimeoutCompleteCallback = (res: Nfcrwerror) => void
  28854. /** 接口调用失败的回调函数 */
  28855. type SetTimeoutFailCallback = (res: Nfcrwerror) => void
  28856. /** 接口调用成功的回调函数 */
  28857. type SetTimeoutSuccessCallback = (res: Nfcrwerror) => void
  28858. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28859. type SetTopBarTextCompleteCallback = (res: GeneralCallbackResult) => void
  28860. /** 接口调用失败的回调函数 */
  28861. type SetTopBarTextFailCallback = (res: GeneralCallbackResult) => void
  28862. /** 接口调用成功的回调函数 */
  28863. type SetTopBarTextSuccessCallback = (res: GeneralCallbackResult) => void
  28864. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28865. type SetVisualEffectOnCaptureCompleteCallback = (
  28866. res: GeneralCallbackResult
  28867. ) => void
  28868. /** 接口调用失败的回调函数 */
  28869. type SetVisualEffectOnCaptureFailCallback = (
  28870. res: GeneralCallbackResult
  28871. ) => void
  28872. /** 接口调用成功的回调函数 */
  28873. type SetVisualEffectOnCaptureSuccessCallback = (
  28874. res: GeneralCallbackResult
  28875. ) => void
  28876. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28877. type SetWifiListCompleteCallback = (res: WifiError) => void
  28878. /** 接口调用失败的回调函数 */
  28879. type SetWifiListFailCallback = (res: WifiError) => void
  28880. /** 接口调用成功的回调函数 */
  28881. type SetWifiListSuccessCallback = (res: WifiError) => void
  28882. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28883. type SetWindowSizeCompleteCallback = (res: GeneralCallbackResult) => void
  28884. /** 接口调用失败的回调函数 */
  28885. type SetWindowSizeFailCallback = (res: GeneralCallbackResult) => void
  28886. /** 接口调用成功的回调函数 */
  28887. type SetWindowSizeSuccessCallback = (res: GeneralCallbackResult) => void
  28888. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28889. type SetZoomCompleteCallback = (res: GeneralCallbackResult) => void
  28890. /** 接口调用失败的回调函数 */
  28891. type SetZoomFailCallback = (res: GeneralCallbackResult) => void
  28892. /** 接口调用成功的回调函数 */
  28893. type SetZoomSuccessCallback = (result: SetZoomSuccessCallbackResult) => void
  28894. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28895. type ShareFileMessageCompleteCallback = (res: GeneralCallbackResult) => void
  28896. /** 接口调用失败的回调函数 */
  28897. type ShareFileMessageFailCallback = (res: GeneralCallbackResult) => void
  28898. /** 接口调用成功的回调函数 */
  28899. type ShareFileMessageSuccessCallback = (res: GeneralCallbackResult) => void
  28900. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28901. type ShareToWeRunCompleteCallback = (res: GeneralCallbackResult) => void
  28902. /** 接口调用失败的回调函数 */
  28903. type ShareToWeRunFailCallback = (res: GeneralCallbackResult) => void
  28904. /** 接口调用成功的回调函数 */
  28905. type ShareToWeRunSuccessCallback = (res: GeneralCallbackResult) => void
  28906. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28907. type ShareVideoMessageCompleteCallback = (
  28908. res: GeneralCallbackResult
  28909. ) => void
  28910. /** 接口调用失败的回调函数 */
  28911. type ShareVideoMessageFailCallback = (res: GeneralCallbackResult) => void
  28912. /** 接口调用成功的回调函数 */
  28913. type ShareVideoMessageSuccessCallback = (res: GeneralCallbackResult) => void
  28914. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28915. type ShowActionSheetCompleteCallback = (res: GeneralCallbackResult) => void
  28916. /** 接口调用失败的回调函数 */
  28917. type ShowActionSheetFailCallback = (res: GeneralCallbackResult) => void
  28918. /** 接口调用成功的回调函数 */
  28919. type ShowActionSheetSuccessCallback = (
  28920. result: ShowActionSheetSuccessCallbackResult
  28921. ) => void
  28922. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28923. type ShowLoadingCompleteCallback = (res: GeneralCallbackResult) => void
  28924. /** 接口调用失败的回调函数 */
  28925. type ShowLoadingFailCallback = (res: GeneralCallbackResult) => void
  28926. /** 接口调用成功的回调函数 */
  28927. type ShowLoadingSuccessCallback = (res: GeneralCallbackResult) => void
  28928. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28929. type ShowModalCompleteCallback = (res: GeneralCallbackResult) => void
  28930. /** 接口调用失败的回调函数 */
  28931. type ShowModalFailCallback = (res: GeneralCallbackResult) => void
  28932. /** 接口调用成功的回调函数 */
  28933. type ShowModalSuccessCallback = (
  28934. result: ShowModalSuccessCallbackResult
  28935. ) => void
  28936. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28937. type ShowNavigationBarLoadingCompleteCallback = (
  28938. res: GeneralCallbackResult
  28939. ) => void
  28940. /** 接口调用失败的回调函数 */
  28941. type ShowNavigationBarLoadingFailCallback = (
  28942. res: GeneralCallbackResult
  28943. ) => void
  28944. /** 接口调用成功的回调函数 */
  28945. type ShowNavigationBarLoadingSuccessCallback = (
  28946. res: GeneralCallbackResult
  28947. ) => void
  28948. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28949. type ShowRedPackageCompleteCallback = (res: GeneralCallbackResult) => void
  28950. /** 接口调用失败的回调函数 */
  28951. type ShowRedPackageFailCallback = (res: GeneralCallbackResult) => void
  28952. /** 接口调用成功的回调函数 */
  28953. type ShowRedPackageSuccessCallback = (res: GeneralCallbackResult) => void
  28954. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28955. type ShowShareImageMenuCompleteCallback = (
  28956. res: GeneralCallbackResult
  28957. ) => void
  28958. /** 接口调用失败的回调函数 */
  28959. type ShowShareImageMenuFailCallback = (res: GeneralCallbackResult) => void
  28960. /** 接口调用成功的回调函数 */
  28961. type ShowShareImageMenuSuccessCallback = (
  28962. res: GeneralCallbackResult
  28963. ) => void
  28964. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28965. type ShowShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  28966. /** 接口调用失败的回调函数 */
  28967. type ShowShareMenuFailCallback = (res: GeneralCallbackResult) => void
  28968. /** 接口调用成功的回调函数 */
  28969. type ShowShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  28970. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28971. type ShowTabBarCompleteCallback = (res: GeneralCallbackResult) => void
  28972. /** 接口调用失败的回调函数 */
  28973. type ShowTabBarFailCallback = (res: GeneralCallbackResult) => void
  28974. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28975. type ShowTabBarRedDotCompleteCallback = (res: GeneralCallbackResult) => void
  28976. /** 接口调用失败的回调函数 */
  28977. type ShowTabBarRedDotFailCallback = (res: GeneralCallbackResult) => void
  28978. /** 接口调用成功的回调函数 */
  28979. type ShowTabBarRedDotSuccessCallback = (res: GeneralCallbackResult) => void
  28980. /** 接口调用成功的回调函数 */
  28981. type ShowTabBarSuccessCallback = (res: GeneralCallbackResult) => void
  28982. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28983. type ShowToastCompleteCallback = (res: GeneralCallbackResult) => void
  28984. /** 接口调用失败的回调函数 */
  28985. type ShowToastFailCallback = (res: GeneralCallbackResult) => void
  28986. /** 接口调用成功的回调函数 */
  28987. type ShowToastSuccessCallback = (res: GeneralCallbackResult) => void
  28988. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28989. type SnapshotCompleteCallback = (res: GeneralCallbackResult) => void
  28990. /** 接口调用失败的回调函数 */
  28991. type SnapshotFailCallback = (res: GeneralCallbackResult) => void
  28992. /** 接口调用失败的回调函数 */
  28993. type SocketTaskCloseFailCallback = (res: GeneralCallbackResult) => void
  28994. /** WebSocket 连接关闭事件的监听函数 */
  28995. type SocketTaskOnCloseCallback = (
  28996. result: SocketTaskOnCloseListenerResult
  28997. ) => void
  28998. /** WebSocket 接受到服务器的消息事件的监听函数 */
  28999. type SocketTaskOnMessageCallback = (
  29000. result: SocketTaskOnMessageListenerResult
  29001. ) => void
  29002. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29003. type StartAccelerometerCompleteCallback = (
  29004. res: GeneralCallbackResult
  29005. ) => void
  29006. /** 接口调用失败的回调函数 */
  29007. type StartAccelerometerFailCallback = (res: GeneralCallbackResult) => void
  29008. /** 接口调用成功的回调函数 */
  29009. type StartAccelerometerSuccessCallback = (
  29010. res: GeneralCallbackResult
  29011. ) => void
  29012. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29013. type StartAdvertisingCompleteCallback = (res: GeneralCallbackResult) => void
  29014. /** 接口调用失败的回调函数 */
  29015. type StartAdvertisingFailCallback = (res: GeneralCallbackResult) => void
  29016. /** 接口调用成功的回调函数 */
  29017. type StartAdvertisingSuccessCallback = (res: GeneralCallbackResult) => void
  29018. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29019. type StartBeaconDiscoveryCompleteCallback = (res: BeaconError) => void
  29020. /** 接口调用失败的回调函数 */
  29021. type StartBeaconDiscoveryFailCallback = (res: BeaconError) => void
  29022. /** 接口调用成功的回调函数 */
  29023. type StartBeaconDiscoverySuccessCallback = (res: BeaconError) => void
  29024. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29025. type StartBluetoothDevicesDiscoveryCompleteCallback = (
  29026. res: BluetoothError
  29027. ) => void
  29028. /** 接口调用失败的回调函数 */
  29029. type StartBluetoothDevicesDiscoveryFailCallback = (
  29030. res: BluetoothError
  29031. ) => void
  29032. /** 接口调用成功的回调函数 */
  29033. type StartBluetoothDevicesDiscoverySuccessCallback = (
  29034. res: BluetoothError
  29035. ) => void
  29036. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29037. type StartCompassCompleteCallback = (res: GeneralCallbackResult) => void
  29038. /** 接口调用失败的回调函数 */
  29039. type StartCompassFailCallback = (res: GeneralCallbackResult) => void
  29040. /** 接口调用成功的回调函数 */
  29041. type StartCompassSuccessCallback = (res: GeneralCallbackResult) => void
  29042. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29043. type StartCompleteCallback = (res: GeneralCallbackResult) => void
  29044. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29045. type StartDeviceMotionListeningCompleteCallback = (
  29046. res: GeneralCallbackResult
  29047. ) => void
  29048. /** 接口调用失败的回调函数 */
  29049. type StartDeviceMotionListeningFailCallback = (
  29050. res: GeneralCallbackResult
  29051. ) => void
  29052. /** 接口调用成功的回调函数 */
  29053. type StartDeviceMotionListeningSuccessCallback = (
  29054. res: GeneralCallbackResult
  29055. ) => void
  29056. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29057. type StartDiscoveryCompleteCallback = (res: Nfcrwerror) => void
  29058. /** 接口调用失败的回调函数 */
  29059. type StartDiscoveryFailCallback = (res: Nfcrwerror) => void
  29060. /** 接口调用成功的回调函数 */
  29061. type StartDiscoverySuccessCallback = (res: Nfcrwerror) => void
  29062. /** 接口调用失败的回调函数 */
  29063. type StartFailCallback = (res: GeneralCallbackResult) => void
  29064. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29065. type StartGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void
  29066. /** 接口调用失败的回调函数 */
  29067. type StartGyroscopeFailCallback = (res: GeneralCallbackResult) => void
  29068. /** 接口调用成功的回调函数 */
  29069. type StartGyroscopeSuccessCallback = (res: GeneralCallbackResult) => void
  29070. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29071. type StartHCECompleteCallback = (res: NFCError) => void
  29072. /** 接口调用失败的回调函数 */
  29073. type StartHCEFailCallback = (res: NFCError) => void
  29074. /** 接口调用成功的回调函数 */
  29075. type StartHCESuccessCallback = (res: NFCError) => void
  29076. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29077. type StartLocalServiceDiscoveryCompleteCallback = (
  29078. res: GeneralCallbackResult
  29079. ) => void
  29080. /** 接口调用失败的回调函数 */
  29081. type StartLocalServiceDiscoveryFailCallback = (
  29082. result: StartLocalServiceDiscoveryFailCallbackResult
  29083. ) => void
  29084. /** 接口调用成功的回调函数 */
  29085. type StartLocalServiceDiscoverySuccessCallback = (
  29086. res: GeneralCallbackResult
  29087. ) => void
  29088. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29089. type StartLocationUpdateBackgroundCompleteCallback = (
  29090. res: GeneralCallbackResult
  29091. ) => void
  29092. /** 接口调用失败的回调函数 */
  29093. type StartLocationUpdateBackgroundFailCallback = (
  29094. res: GeneralCallbackResult
  29095. ) => void
  29096. /** 接口调用成功的回调函数 */
  29097. type StartLocationUpdateBackgroundSuccessCallback = (
  29098. res: GeneralCallbackResult
  29099. ) => void
  29100. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29101. type StartLocationUpdateCompleteCallback = (
  29102. res: GeneralCallbackResult
  29103. ) => void
  29104. /** 接口调用失败的回调函数 */
  29105. type StartLocationUpdateFailCallback = (res: GeneralCallbackResult) => void
  29106. /** 接口调用成功的回调函数 */
  29107. type StartLocationUpdateSuccessCallback = (
  29108. res: GeneralCallbackResult
  29109. ) => void
  29110. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29111. type StartPreviewCompleteCallback = (res: GeneralCallbackResult) => void
  29112. /** 接口调用失败的回调函数 */
  29113. type StartPreviewFailCallback = (res: GeneralCallbackResult) => void
  29114. /** 接口调用成功的回调函数 */
  29115. type StartPreviewSuccessCallback = (res: GeneralCallbackResult) => void
  29116. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29117. type StartPullDownRefreshCompleteCallback = (
  29118. res: GeneralCallbackResult
  29119. ) => void
  29120. /** 接口调用失败的回调函数 */
  29121. type StartPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void
  29122. /** 接口调用成功的回调函数 */
  29123. type StartPullDownRefreshSuccessCallback = (
  29124. res: GeneralCallbackResult
  29125. ) => void
  29126. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29127. type StartRecordCompleteCallback = (res: GeneralCallbackResult) => void
  29128. /** 接口调用失败的回调函数 */
  29129. type StartRecordFailCallback = (res: GeneralCallbackResult) => void
  29130. /** 超过录制时长上限时会结束录像并触发此回调,录像异常退出时也会触发此回调 */
  29131. type StartRecordTimeoutCallback = (
  29132. result: StartRecordTimeoutCallbackResult
  29133. ) => void
  29134. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29135. type StartSoterAuthenticationCompleteCallback = (
  29136. res: GeneralCallbackResult
  29137. ) => void
  29138. /** 接口调用失败的回调函数 */
  29139. type StartSoterAuthenticationFailCallback = (
  29140. res: GeneralCallbackResult
  29141. ) => void
  29142. /** 接口调用成功的回调函数 */
  29143. type StartSoterAuthenticationSuccessCallback = (
  29144. result: StartSoterAuthenticationSuccessCallbackResult
  29145. ) => void
  29146. /** 接口调用成功的回调函数 */
  29147. type StartSuccessCallback = (res: GeneralCallbackResult) => void
  29148. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29149. type StartWifiCompleteCallback = (res: WifiError) => void
  29150. /** 接口调用失败的回调函数 */
  29151. type StartWifiFailCallback = (res: WifiError) => void
  29152. /** 接口调用成功的回调函数 */
  29153. type StartWifiSuccessCallback = (res: WifiError) => void
  29154. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29155. type StatCompleteCallback = (res: GeneralCallbackResult) => void
  29156. /** 接口调用失败的回调函数 */
  29157. type StatFailCallback = (result: StatFailCallbackResult) => void
  29158. /** 接口调用成功的回调函数 */
  29159. type StatSuccessCallback = (result: StatSuccessCallbackResult) => void
  29160. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29161. type StopAccelerometerCompleteCallback = (
  29162. res: GeneralCallbackResult
  29163. ) => void
  29164. /** 接口调用失败的回调函数 */
  29165. type StopAccelerometerFailCallback = (res: GeneralCallbackResult) => void
  29166. /** 接口调用成功的回调函数 */
  29167. type StopAccelerometerSuccessCallback = (res: GeneralCallbackResult) => void
  29168. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29169. type StopAdvertisingCompleteCallback = (res: GeneralCallbackResult) => void
  29170. /** 接口调用失败的回调函数 */
  29171. type StopAdvertisingFailCallback = (res: GeneralCallbackResult) => void
  29172. /** 接口调用成功的回调函数 */
  29173. type StopAdvertisingSuccessCallback = (res: GeneralCallbackResult) => void
  29174. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29175. type StopBGMCompleteCallback = (res: GeneralCallbackResult) => void
  29176. /** 接口调用失败的回调函数 */
  29177. type StopBGMFailCallback = (res: GeneralCallbackResult) => void
  29178. /** 接口调用成功的回调函数 */
  29179. type StopBGMSuccessCallback = (res: GeneralCallbackResult) => void
  29180. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29181. type StopBackgroundAudioCompleteCallback = (
  29182. res: GeneralCallbackResult
  29183. ) => void
  29184. /** 接口调用失败的回调函数 */
  29185. type StopBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  29186. /** 接口调用成功的回调函数 */
  29187. type StopBackgroundAudioSuccessCallback = (
  29188. res: GeneralCallbackResult
  29189. ) => void
  29190. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29191. type StopBeaconDiscoveryCompleteCallback = (res: BeaconError) => void
  29192. /** 接口调用失败的回调函数 */
  29193. type StopBeaconDiscoveryFailCallback = (res: BeaconError) => void
  29194. /** 接口调用成功的回调函数 */
  29195. type StopBeaconDiscoverySuccessCallback = (res: BeaconError) => void
  29196. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29197. type StopBluetoothDevicesDiscoveryCompleteCallback = (
  29198. res: BluetoothError
  29199. ) => void
  29200. /** 接口调用失败的回调函数 */
  29201. type StopBluetoothDevicesDiscoveryFailCallback = (
  29202. res: BluetoothError
  29203. ) => void
  29204. /** 接口调用成功的回调函数 */
  29205. type StopBluetoothDevicesDiscoverySuccessCallback = (
  29206. res: BluetoothError
  29207. ) => void
  29208. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29209. type StopCompassCompleteCallback = (res: GeneralCallbackResult) => void
  29210. /** 接口调用失败的回调函数 */
  29211. type StopCompassFailCallback = (res: GeneralCallbackResult) => void
  29212. /** 接口调用成功的回调函数 */
  29213. type StopCompassSuccessCallback = (res: GeneralCallbackResult) => void
  29214. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29215. type StopCompleteCallback = (res: GeneralCallbackResult) => void
  29216. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29217. type StopDeviceMotionListeningCompleteCallback = (
  29218. res: GeneralCallbackResult
  29219. ) => void
  29220. /** 接口调用失败的回调函数 */
  29221. type StopDeviceMotionListeningFailCallback = (
  29222. res: GeneralCallbackResult
  29223. ) => void
  29224. /** 接口调用成功的回调函数 */
  29225. type StopDeviceMotionListeningSuccessCallback = (
  29226. res: GeneralCallbackResult
  29227. ) => void
  29228. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29229. type StopDiscoveryCompleteCallback = (res: Nfcrwerror) => void
  29230. /** 接口调用失败的回调函数 */
  29231. type StopDiscoveryFailCallback = (res: Nfcrwerror) => void
  29232. /** 接口调用成功的回调函数 */
  29233. type StopDiscoverySuccessCallback = (res: Nfcrwerror) => void
  29234. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29235. type StopFaceDetectCompleteCallback = (res: GeneralCallbackResult) => void
  29236. /** 接口调用失败的回调函数 */
  29237. type StopFaceDetectFailCallback = (res: GeneralCallbackResult) => void
  29238. /** 接口调用成功的回调函数 */
  29239. type StopFaceDetectSuccessCallback = (res: GeneralCallbackResult) => void
  29240. /** 接口调用失败的回调函数 */
  29241. type StopFailCallback = (res: GeneralCallbackResult) => void
  29242. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29243. type StopGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void
  29244. /** 接口调用失败的回调函数 */
  29245. type StopGyroscopeFailCallback = (res: GeneralCallbackResult) => void
  29246. /** 接口调用成功的回调函数 */
  29247. type StopGyroscopeSuccessCallback = (res: GeneralCallbackResult) => void
  29248. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29249. type StopHCECompleteCallback = (res: NFCError) => void
  29250. /** 接口调用失败的回调函数 */
  29251. type StopHCEFailCallback = (res: NFCError) => void
  29252. /** 接口调用成功的回调函数 */
  29253. type StopHCESuccessCallback = (res: NFCError) => void
  29254. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29255. type StopLocalServiceDiscoveryCompleteCallback = (
  29256. res: GeneralCallbackResult
  29257. ) => void
  29258. /** 接口调用失败的回调函数 */
  29259. type StopLocalServiceDiscoveryFailCallback = (
  29260. result: StopLocalServiceDiscoveryFailCallbackResult
  29261. ) => void
  29262. /** 接口调用成功的回调函数 */
  29263. type StopLocalServiceDiscoverySuccessCallback = (
  29264. res: GeneralCallbackResult
  29265. ) => void
  29266. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29267. type StopLocationUpdateCompleteCallback = (
  29268. res: GeneralCallbackResult
  29269. ) => void
  29270. /** 接口调用失败的回调函数 */
  29271. type StopLocationUpdateFailCallback = (res: GeneralCallbackResult) => void
  29272. /** 接口调用成功的回调函数 */
  29273. type StopLocationUpdateSuccessCallback = (
  29274. res: GeneralCallbackResult
  29275. ) => void
  29276. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29277. type StopPreviewCompleteCallback = (res: GeneralCallbackResult) => void
  29278. /** 接口调用失败的回调函数 */
  29279. type StopPreviewFailCallback = (res: GeneralCallbackResult) => void
  29280. /** 接口调用成功的回调函数 */
  29281. type StopPreviewSuccessCallback = (res: GeneralCallbackResult) => void
  29282. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29283. type StopPullDownRefreshCompleteCallback = (
  29284. res: GeneralCallbackResult
  29285. ) => void
  29286. /** 接口调用失败的回调函数 */
  29287. type StopPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void
  29288. /** 接口调用成功的回调函数 */
  29289. type StopPullDownRefreshSuccessCallback = (
  29290. res: GeneralCallbackResult
  29291. ) => void
  29292. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29293. type StopRecordCompleteCallback = (res: GeneralCallbackResult) => void
  29294. /** 接口调用失败的回调函数 */
  29295. type StopRecordFailCallback = (res: GeneralCallbackResult) => void
  29296. /** 接口调用成功的回调函数 */
  29297. type StopSuccessCallback = (res: GeneralCallbackResult) => void
  29298. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29299. type StopVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  29300. /** 接口调用失败的回调函数 */
  29301. type StopVoiceFailCallback = (res: GeneralCallbackResult) => void
  29302. /** 接口调用成功的回调函数 */
  29303. type StopVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  29304. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29305. type StopWifiCompleteCallback = (res: WifiError) => void
  29306. /** 接口调用失败的回调函数 */
  29307. type StopWifiFailCallback = (res: WifiError) => void
  29308. /** 接口调用成功的回调函数 */
  29309. type StopWifiSuccessCallback = (res: WifiError) => void
  29310. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29311. type SubscribeVoIPVideoMembersCompleteCallback = (
  29312. res: GeneralCallbackResult
  29313. ) => void
  29314. /** 接口调用失败的回调函数 */
  29315. type SubscribeVoIPVideoMembersFailCallback = (
  29316. res: GeneralCallbackResult
  29317. ) => void
  29318. /** 接口调用成功的回调函数 */
  29319. type SubscribeVoIPVideoMembersSuccessCallback = (
  29320. res: GeneralCallbackResult
  29321. ) => void
  29322. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29323. type SwitchCameraCompleteCallback = (res: GeneralCallbackResult) => void
  29324. /** 接口调用失败的回调函数 */
  29325. type SwitchCameraFailCallback = (res: GeneralCallbackResult) => void
  29326. /** 接口调用成功的回调函数 */
  29327. type SwitchCameraSuccessCallback = (res: GeneralCallbackResult) => void
  29328. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29329. type SwitchTabCompleteCallback = (res: GeneralCallbackResult) => void
  29330. /** 接口调用失败的回调函数 */
  29331. type SwitchTabFailCallback = (res: GeneralCallbackResult) => void
  29332. /** 接口调用成功的回调函数 */
  29333. type SwitchTabSuccessCallback = (res: GeneralCallbackResult) => void
  29334. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  29335. type TCPSocketOffMessageCallback = (
  29336. result: TCPSocketOnMessageListenerResult
  29337. ) => void
  29338. /** 当接收到数据的时触发该事件的监听函数 */
  29339. type TCPSocketOnMessageCallback = (
  29340. result: TCPSocketOnMessageListenerResult
  29341. ) => void
  29342. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29343. type TakePhotoCompleteCallback = (res: GeneralCallbackResult) => void
  29344. /** 接口调用失败的回调函数 */
  29345. type TakePhotoFailCallback = (res: GeneralCallbackResult) => void
  29346. /** 接口调用成功的回调函数 */
  29347. type TakePhotoSuccessCallback = (
  29348. result: TakePhotoSuccessCallbackResult
  29349. ) => void
  29350. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29351. type ToScreenLocationCompleteCallback = (res: GeneralCallbackResult) => void
  29352. /** 接口调用失败的回调函数 */
  29353. type ToScreenLocationFailCallback = (res: GeneralCallbackResult) => void
  29354. /** 接口调用成功的回调函数 */
  29355. type ToScreenLocationSuccessCallback = (
  29356. result: ToScreenLocationSuccessCallbackResult
  29357. ) => void
  29358. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29359. type ToggleTorchCompleteCallback = (res: GeneralCallbackResult) => void
  29360. /** 接口调用失败的回调函数 */
  29361. type ToggleTorchFailCallback = (res: GeneralCallbackResult) => void
  29362. /** 接口调用成功的回调函数 */
  29363. type ToggleTorchSuccessCallback = (res: GeneralCallbackResult) => void
  29364. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29365. type TransceiveCompleteCallback = (res: Nfcrwerror) => void
  29366. /** 接口调用失败的回调函数 */
  29367. type TransceiveFailCallback = (res: Nfcrwerror) => void
  29368. /** 接口调用成功的回调函数 */
  29369. type TransceiveSuccessCallback = (
  29370. result: TransceiveSuccessCallbackResult
  29371. ) => void
  29372. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29373. type TranslateMarkerCompleteCallback = (res: GeneralCallbackResult) => void
  29374. /** 接口调用失败的回调函数 */
  29375. type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void
  29376. /** 接口调用成功的回调函数 */
  29377. type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void
  29378. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29379. type TruncateCompleteCallback = (res: GeneralCallbackResult) => void
  29380. /** 接口调用失败的回调函数 */
  29381. type TruncateFailCallback = (result: TruncateFailCallbackResult) => void
  29382. /** 接口调用成功的回调函数 */
  29383. type TruncateSuccessCallback = (res: GeneralCallbackResult) => void
  29384. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  29385. type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void
  29386. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  29387. type UDPSocketOffErrorCallback = (result: GeneralCallbackResult) => void
  29388. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  29389. type UDPSocketOffMessageCallback = (
  29390. result: UDPSocketOnMessageListenerResult
  29391. ) => void
  29392. type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void
  29393. type UDPSocketOnErrorCallback = (result: GeneralCallbackResult) => void
  29394. /** 收到消息的事件的监听函数 */
  29395. type UDPSocketOnMessageCallback = (
  29396. result: UDPSocketOnMessageListenerResult
  29397. ) => void
  29398. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29399. type UndoCompleteCallback = (res: GeneralCallbackResult) => void
  29400. /** 接口调用失败的回调函数 */
  29401. type UndoFailCallback = (res: GeneralCallbackResult) => void
  29402. /** 接口调用成功的回调函数 */
  29403. type UndoSuccessCallback = (res: GeneralCallbackResult) => void
  29404. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29405. type UnlinkCompleteCallback = (res: GeneralCallbackResult) => void
  29406. /** 接口调用失败的回调函数 */
  29407. type UnlinkFailCallback = (result: UnlinkFailCallbackResult) => void
  29408. /** 接口调用成功的回调函数 */
  29409. type UnlinkSuccessCallback = (res: GeneralCallbackResult) => void
  29410. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29411. type UnzipCompleteCallback = (res: GeneralCallbackResult) => void
  29412. /** 接口调用失败的回调函数 */
  29413. type UnzipFailCallback = (result: UnzipFailCallbackResult) => void
  29414. /** 接口调用成功的回调函数 */
  29415. type UnzipSuccessCallback = (res: GeneralCallbackResult) => void
  29416. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29417. type UpdateGroundOverlayCompleteCallback = (
  29418. res: GeneralCallbackResult
  29419. ) => void
  29420. /** 接口调用失败的回调函数 */
  29421. type UpdateGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  29422. /** 接口调用成功的回调函数 */
  29423. type UpdateGroundOverlaySuccessCallback = (
  29424. res: GeneralCallbackResult
  29425. ) => void
  29426. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29427. type UpdateShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  29428. /** 接口调用失败的回调函数 */
  29429. type UpdateShareMenuFailCallback = (res: GeneralCallbackResult) => void
  29430. /** 接口调用成功的回调函数 */
  29431. type UpdateShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  29432. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29433. type UpdateVoIPChatMuteConfigCompleteCallback = (
  29434. res: GeneralCallbackResult
  29435. ) => void
  29436. /** 接口调用失败的回调函数 */
  29437. type UpdateVoIPChatMuteConfigFailCallback = (
  29438. res: GeneralCallbackResult
  29439. ) => void
  29440. /** 接口调用成功的回调函数 */
  29441. type UpdateVoIPChatMuteConfigSuccessCallback = (
  29442. res: GeneralCallbackResult
  29443. ) => void
  29444. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29445. type UpdateWeChatAppCompleteCallback = (res: GeneralCallbackResult) => void
  29446. /** 接口调用失败的回调函数 */
  29447. type UpdateWeChatAppFailCallback = (res: GeneralCallbackResult) => void
  29448. /** 接口调用成功的回调函数 */
  29449. type UpdateWeChatAppSuccessCallback = (res: GeneralCallbackResult) => void
  29450. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29451. type UploadFileCompleteCallback = (res: GeneralCallbackResult) => void
  29452. /** 接口调用失败的回调函数 */
  29453. type UploadFileFailCallback = (res: GeneralCallbackResult) => void
  29454. /** 接口调用成功的回调函数 */
  29455. type UploadFileSuccessCallback = (
  29456. result: UploadFileSuccessCallbackResult
  29457. ) => void
  29458. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  29459. type UploadTaskOffProgressUpdateCallback = (
  29460. result: UploadTaskOnProgressUpdateListenerResult
  29461. ) => void
  29462. /** 上传进度变化事件的监听函数 */
  29463. type UploadTaskOnProgressUpdateCallback = (
  29464. result: UploadTaskOnProgressUpdateListenerResult
  29465. ) => void
  29466. /** 开启会话回调 */
  29467. type VKSessionStartCallback = (
  29468. /** 参数 status 可选值:
  29469. * - 0: 成功;
  29470. * - 2000001: 参数错误;
  29471. * - 2003000: 会话不可用;
  29472. * - 2000000: 系统错误;
  29473. * - 2000002: 设备不支持;
  29474. * - 2000003: 系统不支持;
  29475. * - 2000004: 设备不支持;
  29476. * - 2003001: 未开启系统相机权限;
  29477. * - 2003002: 未开启小程序相机权限; */
  29478. status:
  29479. | 0
  29480. | 2000001
  29481. | 2003000
  29482. | 2000000
  29483. | 2000002
  29484. | 2000003
  29485. | 2000004
  29486. | 2003001
  29487. | 2003002
  29488. ) => void
  29489. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29490. type VibrateLongCompleteCallback = (res: GeneralCallbackResult) => void
  29491. /** 接口调用失败的回调函数 */
  29492. type VibrateLongFailCallback = (res: GeneralCallbackResult) => void
  29493. /** 接口调用成功的回调函数 */
  29494. type VibrateLongSuccessCallback = (res: GeneralCallbackResult) => void
  29495. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29496. type VibrateShortCompleteCallback = (res: GeneralCallbackResult) => void
  29497. /** 接口调用失败的回调函数 */
  29498. type VibrateShortFailCallback = (
  29499. result: VibrateShortFailCallbackResult
  29500. ) => void
  29501. /** 接口调用成功的回调函数 */
  29502. type VibrateShortSuccessCallback = (res: GeneralCallbackResult) => void
  29503. /** 主线程/Worker 线程向当前线程发送的消息的事件的监听函数 */
  29504. type WorkerOnMessageCallback = (
  29505. result: WorkerOnMessageListenerResult
  29506. ) => void
  29507. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29508. type WriteBLECharacteristicValueCompleteCallback = (
  29509. res: BluetoothError
  29510. ) => void
  29511. /** 接口调用失败的回调函数 */
  29512. type WriteBLECharacteristicValueFailCallback = (res: BluetoothError) => void
  29513. /** 接口调用成功的回调函数 */
  29514. type WriteBLECharacteristicValueSuccessCallback = (
  29515. res: BluetoothError
  29516. ) => void
  29517. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29518. type WriteCharacteristicValueCompleteCallback = (
  29519. res: GeneralCallbackResult
  29520. ) => void
  29521. /** 接口调用失败的回调函数 */
  29522. type WriteCharacteristicValueFailCallback = (
  29523. res: GeneralCallbackResult
  29524. ) => void
  29525. /** 接口调用成功的回调函数 */
  29526. type WriteCharacteristicValueSuccessCallback = (
  29527. res: GeneralCallbackResult
  29528. ) => void
  29529. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29530. type WriteCompleteCallback = (res: GeneralCallbackResult) => void
  29531. /** 接口调用失败的回调函数 */
  29532. type WriteFailCallback = (result: WriteFailCallbackResult) => void
  29533. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29534. type WriteFileCompleteCallback = (res: GeneralCallbackResult) => void
  29535. /** 接口调用失败的回调函数 */
  29536. type WriteFileFailCallback = (result: WriteFileFailCallbackResult) => void
  29537. /** 接口调用成功的回调函数 */
  29538. type WriteFileSuccessCallback = (res: GeneralCallbackResult) => void
  29539. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29540. type WriteNdefMessageCompleteCallback = (res: Nfcrwerror) => void
  29541. /** 接口调用失败的回调函数 */
  29542. type WriteNdefMessageFailCallback = (res: Nfcrwerror) => void
  29543. /** 接口调用成功的回调函数 */
  29544. type WriteNdefMessageSuccessCallback = (res: Nfcrwerror) => void
  29545. /** 接口调用成功的回调函数 */
  29546. type WriteSuccessCallback = (result: WriteSuccessCallbackResult) => void
  29547. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  29548. type WxOffErrorCallback = (res: GeneralCallbackResult) => void
  29549. /** 小程序错误事件的监听函数 */
  29550. type WxOnErrorCallback = (
  29551. /** 错误信息,包含堆栈 */
  29552. error: string
  29553. ) => void
  29554. /** 接口调用成功的回调函数 */
  29555. type WxStartRecordSuccessCallback = (
  29556. result: StartRecordSuccessCallbackResult
  29557. ) => void
  29558. /** 接口调用成功的回调函数 */
  29559. type WxStopRecordSuccessCallback = (res: GeneralCallbackResult) => void
  29560. }