对于javascript-在senchatouch2中使用oAuth连接Facebook感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于com.facebook.react.bridge.Jav
对于javascript-在sencha touch 2中使用oAuth连接Facebook感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于com.facebook.react.bridge.JavaScriptExecutor的实例源码、com.facebook.react.bridge.JSCJavaScriptExecutor的实例源码、Facebook PHP SDK v4.0 FacebookJavaScriptLoginHelper返回状态为NULL、javaScript -- touch事件详解(touchstart、touchmove和touchend)的有用信息。
本文目录一览:- javascript-在sencha touch 2中使用oAuth连接Facebook
- com.facebook.react.bridge.JavaScriptExecutor的实例源码
- com.facebook.react.bridge.JSCJavaScriptExecutor的实例源码
- Facebook PHP SDK v4.0 FacebookJavaScriptLoginHelper返回状态为NULL
- javaScript -- touch事件详解(touchstart、touchmove和touchend)
javascript-在sencha touch 2中使用oAuth连接Facebook
sencha touch 2没有提供任何功能/库来与facebook连接.
到目前为止我不太清楚
我们可以在sencha touch中使用facebook javascript sdk吗?
我发现以下教程很好,我们可以将其与extjs mvc合并吗
http://thinkdiff.net/facebook/new-javascript-sdk-oauth-2-0-based-fbconnect-tutorial/
解决方法:
我想取决于您要如何连接.对我来说,我只需要连接并显示一个Facebook页面的墙贴即可显示在我的iPad上.我这样做的方法如下:登录到Facebook开发人员并创建一个应用程序.给它起一个名字,例如Senchatouch应用程序.它将生成一个appID和密钥.
然后,您需要通过查询以下链接来找到您的facebook用户名ID:
https://graph.facebook.com/ [用户名]
一旦有了它,就必须转到Facebook Graph API资源管理器并在其中键入该ID,然后您可以看到示例响应.
然后,您需要将访问令牌附加到此链接:
https://graph.facebook.com/51539791474/feed?access_token=ACCESS_TOKEN
所以你有这样的事情:
https://graph.facebook.com/51539791474/feed?access_token=AAAFnhgQ0ZAHIBAAbiopuvZAa8zlEmRyxKtZBTcgspJIJ21tVwI17xZCJEbgtNRaMUCnGBVwUa1zE7s6ZBRzg6rJ5UGIEBhZAQfMsCrrT0GVQZDZD
这是您可以在sencha touch 2中的普通JSONP代理中使用的链接.
我的商店代码:
Ext.define(''TCApp.store.Facebook'', {
extend: ''Ext.data.Store'',
requires: [
''TCApp.model.Facebook''
],
config: {
autoLoad: true,
model: ''TCApp.model.Facebook'',
storeId: ''Facebook'',
proxy: {
type: ''jsonp'',
url: ''https://graph.facebook.com/51539791474/Feed?access_token=AAACEdEose0cBAAJt7hcZCdkHHK8hOjZBDFd8GSfg2xkI6hj5AghswWn7MvBTz4B4xooN4t2fXvMmTZCrxAq4t5ofnnPIY7oZBebnbuB5wQZDZD'',
reader: {
type: ''json'',
rootProperty: ''data''
}
}
}
});
和我的模型:
Ext.define(''TCApp.model.Facebook'', {
extend: ''Ext.data.Model'',
config: {
fields: [
{
name: ''message''
},
{
name: ''picture''
},
{
name: ''link''
},
{
name: ''description''
}
]
}
});
然后,使用itemTpl将其绑定到一个简单列表:
''<div><img src="{picture}"/>{message}</div>'',
''<div>{description}</div></div>'',
我唯一的问题是有效期,似乎每个访问令牌都有2个小时的有效期.我还没有找到扩展的方法,如果您发现问题,请发布解决方案或链接到它.谢谢
总结
以上是小编为你收集整理的javascript-在sencha touch 2中使用oAuth连接Facebook全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
原文地址:https://codeday.me/bug/20191201/2079291.html
com.facebook.react.bridge.JavaScriptExecutor的实例源码
private void recreateReactContextInBackground( JavaScriptExecutor.Factory jsExecutorFactory,JSBundleLoader jsBundleLoader) { UiThreadUtil.assertOnUiThread(); ReactContextinitParams initParams = new ReactContextinitParams(jsExecutorFactory,jsBundleLoader); if (mReactContextinitAsyncTask == null) { // No background task to create react context is currently running,create and execute one. mReactContextinitAsyncTask = new ReactContextinitAsyncTask(); mReactContextinitAsyncTask.execute(initParams); } else { // Background task is currently running,queue up most recent init params to recreate context // once task completes. mPendingReactContextinitParams = initParams; } }
private void recreateReactContextInBackground( JavaScriptExecutor.Factory jsExecutorFactory,queue up most recent init params to recreate context // once task completes. mPendingReactContextinitParams = initParams; } }
private void recreateReactContextInBackground( JavaScriptExecutor.Factory jsExecutorFactory,queue up most recent init params to recreate context // once task completes. mPendingReactContextinitParams = initParams; } }
@Override protected Result<ReactApplicationContext> doInBackground(ReactContextinitParams... params) { Assertions.assertCondition(params != null && params.length > 0 && params[0] != null); try { JavaScriptExecutor jsExecutor = params[0].getJsExecutorFactory().create( mJSCConfig == null ? new WritableNativeMap() : mJSCConfig.getConfigMap()); return Result.of(createReactContext(jsExecutor,params[0].getJsBundleLoader())); } catch (Exception e) { // Pass exception to onPostExecute() so it can be handled on the main thread return Result.of(e); } }
@Override protected Result<ReactApplicationContext> doInBackground(ReactContextinitParams... params) { Assertions.assertCondition(params != null && params.length > 0 && params[0] != null); try { JavaScriptExecutor jsExecutor = params[0].getJsExecutorFactory().create( mJSCConfig == null ? new WritableNativeMap() : mJSCConfig.getConfigMap()); return Result.of(createReactContext(jsExecutor,params[0].getJsBundleLoader())); } catch (Exception e) { // Pass exception to onPostExecute() so it can be handled on the main thread return Result.of(e); } }
@Override protected Result<ReactApplicationContext> doInBackground(ReactContextinitParams... params) { Assertions.assertCondition(params != null && params.length > 0 && params[0] != null); try { JavaScriptExecutor jsExecutor = params[0].getJsExecutorFactory().create( mJSCConfig == null ? new WritableNativeMap() : mJSCConfig.getConfigMap()); return Result.of(createReactContext(jsExecutor,params[0].getJsBundleLoader())); } catch (Exception e) { // Pass exception to onPostExecute() so it can be handled on the main thread return Result.of(e); } }
public ReactContextinitParams( JavaScriptExecutor.Factory jsExecutorFactory,JSBundleLoader jsBundleLoader) { mJsExecutorFactory = Assertions.assertNotNull(jsExecutorFactory); mJsBundleLoader = Assertions.assertNotNull(jsBundleLoader); }
public JavaScriptExecutor.Factory getJsExecutorFactory() { return mJsExecutorFactory; }
public ReactContextinitParams( JavaScriptExecutor.Factory jsExecutorFactory,JSBundleLoader jsBundleLoader) { mJsExecutorFactory = Assertions.assertNotNull(jsExecutorFactory); mJsBundleLoader = Assertions.assertNotNull(jsBundleLoader); }
public JavaScriptExecutor.Factory getJsExecutorFactory() { return mJsExecutorFactory; }
public ReactContextinitParams( JavaScriptExecutor.Factory jsExecutorFactory,JSBundleLoader jsBundleLoader) { mJsExecutorFactory = Assertions.assertNotNull(jsExecutorFactory); mJsBundleLoader = Assertions.assertNotNull(jsBundleLoader); }
public JavaScriptExecutor.Factory getJsExecutorFactory() { return mJsExecutorFactory; }
com.facebook.react.bridge.JSCJavaScriptExecutor的实例源码
@Override public CatalystInstance build() { return new CatalystInstanceImpl.Builder() .setReactQueueConfigurationSpec(ReactQueueConfigurationSpec.createDefault()) .setJSExecutor(new JSCJavaScriptExecutor(new WritableNativeMap())) .setRegistry(mNativeModuleRegistryBuilder.build()) .setJSModulesConfig(mJSModulesConfigBuilder.build()) .setJSBundleLoader(JSBundleLoader.createFileLoader( mContext,"assets://AndroidTestBundle.js")) .setNativeModuleCallExceptionHandler( new NativeModuleCallExceptionHandler() { @Override public void handleException(Exception e) { throw new RuntimeException(e); } }) .build(); }
@Override public CatalystInstance build() { return new CatalystInstanceImpl.Builder() .setReactQueueConfigurationSpec(ReactQueueConfigurationSpec.createDefault()) .setJSExecutor(new JSCJavaScriptExecutor(new WritableNativeMap())) .setRegistry(mNativeModuleRegistryBuilder.build()) .setJSModulesConfig(mJSModulesConfigBuilder.build()) .setJSBundleLoader(JSBundleLoader.createFileLoader( mContext,"assets://AndroidTestBundle.js")) .setNativeModuleCallExceptionHandler( new NativeModuleCallExceptionHandler() { @Override public void handleException(Exception e) { throw new RuntimeException(e); } }) .build(); }
@Override public CatalystInstance build() { return new CatalystInstanceImpl.Builder() .setReactQueueConfigurationSpec(ReactQueueConfigurationSpec.createDefault()) .setJSExecutor(new JSCJavaScriptExecutor(new WritableNativeMap())) .setRegistry(mNativeModuleRegistryBuilder.build()) .setJSModulesConfig(mJSModulesConfigBuilder.build()) .setJSBundleLoader(JSBundleLoader.createFileLoader( mContext,"assets://AndroidTestBundle.js")) .setNativeModuleCallExceptionHandler( new NativeModuleCallExceptionHandler() { @Override public void handleException(Exception e) { throw new RuntimeException(e); } }) .build(); }
private void onjsBundleLoadedFromServer() { recreateReactContextInBackground( new JSCJavaScriptExecutor.Factory(),JSBundleLoader.createCachedBundleFromNetworkLoader( mDevSupportManager.getSourceUrl(),mDevSupportManager.getDownloadedJSBundleFile())); }
private void onjsBundleLoadedFromServer() { recreateReactContextInBackground( new JSCJavaScriptExecutor.Factory(),mDevSupportManager.getDownloadedJSBundleFile())); }
private void onjsBundleLoadedFromServer() { recreateReactContextInBackground( new JSCJavaScriptExecutor.Factory(),mDevSupportManager.getDownloadedJSBundleFile())); }
private void recreateReactContextInBackgroundFromBundleFile() { recreateReactContextInBackground( new JSCJavaScriptExecutor.Factory(),JSBundleLoader.createFileLoader(mApplicationContext,mJSBundleFile)); }
private void recreateReactContextInBackgroundFromBundleFile() { recreateReactContextInBackground( new JSCJavaScriptExecutor.Factory(),mJSBundleFile)); }
private void recreateReactContextInBackgroundFromBundleFile() { recreateReactContextInBackground( new JSCJavaScriptExecutor.Factory(),mJSBundleFile)); }
Facebook PHP SDK v4.0 FacebookJavaScriptLoginHelper返回状态为NULL
我正在使用FB PHP SDK 4.0在我的localhost上工作.我能够使用JS SDK完成登录,现在我试图通过PHP SDK访问一些信息.
在每个页面上我添加这个js和PHP代码.
javascipt的
window.fbAsyncInit = function() {
FB.init({
appId : 'app-id',
xfbml : true,
version : 'v2.1',
status : true,
cookie : true
});
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
PHP
session_start();
//NO COMPOSER
require '/path-to/autoload.PHP';
use Facebook\FacebookSession;
use Facebook\FacebookJavaScriptLoginHelper;
FacebookSession::setDefaultApplication('app-id', 'app-secret');
$helper = new FacebookJavaScriptLoginHelper();
try {
$session = $helper->getSession();
} catch(FacebookRequestException $ex) {
// When Facebook returns an error
} catch(\Exception $ex) {
// When validation fails or other local issues
}
if ($session) {
// Logged in.
}
每当我调用FB.getLoginStatus()时,它就会给我一个成功的响应.但是在PHP端,每当我转储$helper时它返回[[state]] =>空值.我确保我的app-id匹配.
我认为他们通过cookie进行通信,但当我查看我的浏览器Cookie和网站数据时,我找不到任何相关内容.或者我是否需要访问令牌才能完成此操作?
解决方法:
当我在Firefox上测试时,它正在工作.这实际上是Chrome的问题:除非您使用–enable-file-cookies标志启动,否则Google Chrome不支持本地文件(包括localhost)的Cookie.但是,如果您使用本地IP地址-127.0.0.1-进行测试,则Chrome会支持Cookie.
见https://stackoverflow.com/a/10081969/1158909
javaScript -- touch事件详解(touchstart、touchmove和touchend)
HTML5中新添加了很多事件,但是由于他们的兼容问题不是很理想,应用实战性不是太强,所以在这里基本省略,咱们只分享应用广泛兼容不错的事件,日后随着兼容情况提升以后再陆续添加分享。今天为大家介绍的事件主要是触摸事件:touchstart、touchmove和touchend。
一开始触摸事件touchstart、touchmove和touchend是iOS版Safari浏览器为了向开发人员传达一些信息新添加的事件。因为ios设备既没有鼠标也没有键盘,所以在为移动Safari浏览器开发交互性网页的时候,PC端的鼠标和键盘事件是不够用的。
在iPhone 3Gs发布的时候,其自带的移动Safari浏览器就提供了一些与触摸(touch)操作相关的新事件。随后,Android上的浏览器也实现了相同的事件。触摸事件(touch)会在用户手指放在屏幕上面的时候、在屏幕上滑动的时候或者是从屏幕上移开的时候出发。下面具体说明:
touchstart事件:当手指触摸屏幕时候触发,即使已经有一个手指放在屏幕上也会触发。
touchmove事件:当手指在屏幕上滑动的时候连续地触发。在这个事件发生期间,调用preventDefault()事件可以阻止滚动。
touchend事件:当手指从屏幕上离开的时候触发。
touchcancel事件:当系统停止跟踪触摸的时候触发。关于这个事件的确切出发时间,文档中并没有具体说明,咱们只能去猜测了。
上面的这些事件都会冒泡,也都可以取消。虽然这些触摸事件没有在DOM规范中定义,但是它们却是以兼容DOM的方式实现的。所以,每个触摸事件的event对象都提供了在鼠标实践中常见的属性:bubbles(起泡事件的类型)、cancelable(是否用 preventDefault() 方法可以取消与事件关联的默认动作)、clientX(返回当事件被触发时,鼠标指针的水平坐标)、clientY(返回当事件触发时,鼠标指针的垂直坐标)、screenX(当某个事件被触发时,鼠标指针的水平坐标)和screenY(返回当某个事件被触发时,鼠标指针的垂直坐标)。除了常见的DOM属性,触摸事件还包含下面三个用于跟踪触摸的属性。
touches:表示当前跟踪的触摸操作的touch对象的数组。
targetTouches:特定于事件目标的Touch对象的数组。
changeTouches:表示自上次触摸以来发生了什么改变的Touch对象的数组。
每个Touch对象包含的属性如下。
clientX:触摸目标在视口中的x坐标。
clientY:触摸目标在视口中的y坐标。
identifier:标识触摸的唯一ID。
pageX:触摸目标在页面中的x坐标。
pageY:触摸目标在页面中的y坐标。
screenX:触摸目标在屏幕中的x坐标。
screenY:触摸目标在屏幕中的y坐标。
target:触目的DOM节点目标。
上面的属性光这么看,果然非常繁琐,每个属性说的都是那么的细致,只有真刀实枪的来点小例子才能更加明白其中的奥妙。所以小例子如下。
function load (){
document.addEventListener(''touchstart'',touch, false);
document.addEventListener(''touchmove'',touch, false);
document.addEventListener(''touchend'',touch, false);
function touch (event){
var event = event || window.event;
var oInp = document.getElementById("inp");
switch(event.type){
case "touchstart":
oInp.innerHTML = "Touch started (" + event.touches[0].clientX + "," + event.touches[0].clientY + ")";
break;
case "touchend":
oInp.innerHTML = "<br>Touch end (" + event.changedTouches[0].clientX + "," + event.changedTouches[0].clientY + ")";
break;
case "touchmove":
event.preventDefault();
oInp.innerHTML = "<br>Touch moved (" + event.touches[0].clientX + "," + event.touches[0].clientY + ")";
break;
}
}
}
window.addEventListener(''load'',load, false);
关于javascript-在sencha touch 2中使用oAuth连接Facebook的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于com.facebook.react.bridge.JavaScriptExecutor的实例源码、com.facebook.react.bridge.JSCJavaScriptExecutor的实例源码、Facebook PHP SDK v4.0 FacebookJavaScriptLoginHelper返回状态为NULL、javaScript -- touch事件详解(touchstart、touchmove和touchend)等相关知识的信息别忘了在本站进行查找喔。
本文标签: