草庐IT

onConnected

全部标签

javascript - 为什么 SharedWorker onConnect 事件有一个 Ports 数组?

在我见过的所有例子中,它们都与此类似onconnect=function(e){varport=e.ports[0];port.onmessage=function(e){varworkerResult='Result:'+(e.data[0]*e.data[1]);port.postMessage(workerResult);}port.start();}是否存在ports数组包含多个元素的实例?在SharedWorker上使用chrome://inspect并打印出e,我得到无论产生多少个共享SharedWorker的实例,其长度始终为1。为什么它不只是一个MessageEvent

c# - SignalR OnConnected - 向连接的客户端发送消息

很简单的问题。为什么刚刚连接的客户端没有收到任何消息,而其他所有客户端都收到了广播?发送连接消息的客户端的正确方法是什么?protectedoverridevoidOnConnected(HttpContextBasecontext,stringclientId){GameActionmessage=newGameAction();message.text="Playerconnected";Connection.Broadcast(serializer.Serialize(message));GameActiongamestate=newGameAction();gamestate.

javascript - JointJs - onConnect 链接事件

我正在尝试创建一个板,用户可以在其中动态添加block并将block与链接连接起来。(类似this但动态)我正在使用JointJs框架,到目前为止一切都按预期工作,但我需要在用户连接两个block时显示一些信息。我的问题是在连接block时找不到要处理的事件。我查看了thisquestion但在我的示例中,我没有链接实例来附加事件。Here你可以看看我的例子下面是block是如何添加到板上的。text属性中的ma​​gnet:true使文本可连接。我真的需要一些帮助来找到要在链接连接时处理的事件。varrect=newjoint.shapes.basic.newRect({positi

java - Google Play 位置 未连接。调用 connect() 并等待 onConnected() 被调用

我的一些用户遇到了非常奇怪的崩溃。我正在使用GooglePlay服务和定位服务。错误是:Notconnected.Callconnect()andwaitforonConnected()tobecalled.它所说的导致崩溃的代码中的相关函数是:@OverridepublicvoidonConnected(Bundlebundle){if(debug){Toast.makeText(this,DateFormat.getDateTimeInstance().format(newDate())+":Connected.",Toast.LENGTH_SHORT).show();}//Req

android - 未连接。调用 Connect 或等待 onConnected() 在 onConnected 内部调用异常?

我为GoogleLocationClientAPI实现了这个onConnected回调:@OverridepublicvoidonConnected(Bundlearg0){if(lc!=null){lastKnownLocation=lc.getLastLocation();LocationRequestrequest=newLocationRequest();request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);request.setFastestInterval(MIN_TIME_BETWEEN_LOCATION_

android - 未连接。调用 Connect 或等待 onConnected() 被调用

我的应用程序以map为中心。我经常调用requestLocationUpdates()。偶尔,当它被调用时,我会得到这个exception。或者在任何其他调用这种方法的地方。我在SOF上看到了建议的解决方案,遗憾的是似乎对我没有任何作用。即使我调用mLocationClient.connect(),也不能保证它会立即连接,如果我错了请纠正我。我该如何解决这个问题?caseR.id.btnContinue:gpsLocationDailog.cancel();intisGooglePlayServiceAvilable=GooglePlayServicesUtil.isGooglePla

android - 适用于 Android 的 Google+ 平台 - getCurrentPerson

我使用适用于Android的Google+平台PlusClientplusClient=newPlusClient.Builder(this,this,this).setScopes(Scopes.PLUS_LOGIN).build();在onConnected-Listener中我想读取登录用户的数据@OverridepublicvoidonConnected(){super.onConnected();Personperson=plusClient.getCurrentPerson();}方法调用getCurrentPerson返回null。有没有人设法读取用户数据?

android - onConnected() 未被调用以获取位置更新(用于位置的 GooglePlayApi)

所以我有这段代码:packagecom.entu.bocterapp;importandroid.content.Context;importandroid.location.Location;importandroid.location.LocationListener;importandroid.os.Bundle;importandroid.widget.Toast;importcom.google.android.gms.common.ConnectionResult;importcom.google.android.gms.common.GooglePlayServicesU

android - GoogleApiClient : not firing onConnected or onConnectionFailed

因此,我正在尝试使用GoogleApiClient获取我的最后一个位置。我正在执行连接语句,但onConnected没有触发,onConnectionFailed也没有触发。有什么想法吗?备注:我是在模拟器上运行的,不是真机。在模拟器上浏览。packagecom.example.jdc.testjdc;importandroid.location.Location;importandroid.support.v7.app.ActionBarActivity;importandroid.os.Bundle;importandroid.util.Log;importandroid.view

java - GoogleApiClient 尚未连接,即使调用了 onConnected 并且我正在 onCreate 中创建我的 GoogleApiClient

我在这里查看了这个问答:GoogleApiClientisthrowing"GoogleApiClientisnotconnectedyet"AFTERonConnectedfunctiongettingcalled因为它似乎与我所经历的相似,但事实并非如此。该用户的问题是他们在onStart()方法中声明了他们的api客户端,我在onCreate()方法中创建了我的,就像答案所建议的那样。然而,我仍然遇到同样的错误。这是这三种方法的代码:protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstan