草庐IT

android-classes

全部标签

javascript - 热点插件 scanWifi() 在 Android ionic cordova 中不起作用

我在扫描最近的wifi时遇到问题。我正在使用ionicCordova框架。我使用了Hotspot插件的scanWifi方法来扫描wifi列表。我引用了以下链接:https://ionicframework.com/docs/native/hotspot/我的代码是:import{Hotspot,HotspotNetwork}from'@ionic-native/hotspot';this.hotspot.scanWifi().then((networks:Array)=>{this.availableWifiList=networks;});当应用程序尝试扫描最近的wifi时,它会返回

javascript - FB.login() 在 Android Chrome 上失败并显示 "Unsafe JavaScript attempt to initiate navigation for frame"但不是桌面 Chrome

我这里有一个FacebookJSSDK登录流程:https://web.triller.co/#/user/login当用户点击Facebook按钮时,将执行以下功能:loginFacebook(){constfbPromise=newPromise((resolve,reject)=>{FB.login(resp=>{if(resp.authResponse){resolve(resp.authResponse.accessToken);}else{console.log(resp);reject(newError('Facebooklogincanceledorfailed.'))

javascript - Karma + Jasmine( Angular Testing ): Where should I define mock classes and test variables?

让我们来看下面的例子:constlistDefinition:any={module:"module",service:"service",listname:"listname"};@Component(...)classMockTreeExpanderComponentextendsTreeExpanderComponent{...}classMockListConfigurationsServiceextendsListConfigurationsService{...}describe('ColumnsListConfigurationsComponentTestcases',(

javascript - ES6 继承 : uses `super` to access the properties of the parent class

Javascript的super关键字,当我在Chrome、Babel、TypeScript上运行代码时,我得到了不同的结果。我的问题是哪个结果是正确的?规范的哪一部分定义了这种行为?以下代码:classPoint{getX(){console.log(this.x);//C}}classColorPointextendsPoint{constructor(){super();this.x=2;super.x=3;console.log(this.x)//Aconsole.log(super.x)//B}m(){this.getX()}}constcp=newColorPoint();

javascript - Node.js 事件发射器 : How to bind a class context to the event listener and then remove this listener

有没有办法在事件监听器方法中访问类上下文并有可能删除监听器?示例1:import{EventEmitter}from"events";exportdefaultclassEventsExample1{privateemitter:EventEmitter;constructor(privatetext:string){this.emitter=newEventEmitter();this.emitter.addListener("test",this.handleTestEvent);this.emitter.emit("test");}publicdispose(){this.emi

javascript - "Class extends value #<Object> is not a constructor or null"

感谢阅读我的文章我的代码出现此错误:“Classextendsvalue#isnotaconstructorornull”这是我的代码,我正在尝试导出/导入类。怪物.js:constminiMonster=require("./minimonster.js");classmonster{constructor(options={name},health){this.options=options;this.health=100;this.heal=()=>{return(this.health+=10);};}}letbigMonster=newmonster("Godzilla");

javascript - angularjs ng-class 方法被多次调用

在这个例子中,我有2个ng-class,每个调用不同的Controller方法,由于某种原因每个方法被调用3次,知道吗?可能的错误?varnavList=angular.module('navList',[]);navList.controller('navCtrl',['$scope','$location',function($scope,$location){$scope.firstClass=function(){console.log('firstClass');return'labellabel-success';};$scope.secondClass=function(

javascript - 通过 node.js 发送 android 推送通知

我最近一直在尝试向我的android和ios设备发送推送通知。对于ios,我发现node-apn模块将用于处理此问题,但对于android,我还没有遇到过任何此类问题。任何帮助将不胜感激。 最佳答案 还有另一种选择;android-gcm.它非常易于使用。文档中的代码示例:vargcm=require('android-gcm');//initializenewandroidGcmobjectvargcmObject=newgcm.AndroidGcm('API_KEY');//createnewmessagevarmessage=

javascript - 如何使用javascript检测iPhone/Android从 sleep 中醒来

我正在构建一个使用sockets.io的网站/网络应用目前,如果用户正在iPhone上使用safari,并且他们锁定了屏幕(变黑),我的套接字连接已关闭。这很好,我想要这个。但是当他们解锁屏幕(或从sleep中醒来)时。我想用javascript检测这个事件,这样我就可以重新连接我的套接字。这可能吗??谷歌对这个话题的关注度不高。 最佳答案 没关系,我想通了window.addEventListener("pageshow",function(){alert("pageshown");},false);

javascript - 删除 :active pseudo-class from an element

我希望能够告诉一个元素它不再是:active以便CSS规则不再适用。有没有办法在JavaScript中做到这一点? 最佳答案 可能的解决方案:1)使用类:JS:document.getElementById("element").classList.remove("hasactive");CSS:#element.hasactive:active{background:blue;}2)阻止默认的mousedown功能(事件状态):编辑:显然,这只适用于Firefox。JS:document.getElementById("eleme