[英]Facebook JavaScript SDK sources?
In https://developers.facebook.com/docs/javascript/howto/requirejs/v2.3 the file structure is the following: 在https://developers.facebook.com/docs/javascript/howto/requirejs/v2.3中 ,文件结构如下:
- project/
- index.html
- scripts/
- main.js
- require.js
- fb.js
Where does one get fb.js and main.js from ? 从哪里获得fb.js和main.js ? I have been unable to find the sources of the files.
我一直找不到文件的来源。
Those are your own files. 这些是您自己的文件。 Examples for both files are in the section "Adding a shim to the Facebook SDK".
这两个文件的示例都在“向Facebook SDK添加填充程序”部分中。 There are two code parts, one for main.js and one for fb.js:
有两个代码部分,一个用于main.js,一个用于fb.js:
main.js main.js
require.config({
shim: {
'facebook' : {
exports: 'FB'
}
},
paths: {
'facebook': '//connect.facebook.net/en_US/sdk'
}
})
require(['fb']);
fb.js fb.js
define(['facebook'], function(){
FB.init({
appId : '{your-app-id}',
version : 'v2.3'
});
FB.getLoginStatus(function(response) {
console.log(response);
});
});
Tell me if it works, i´ve never used RequireJS, i only know the basics. 告诉我它是否有效,我从未使用过RequireJS,我只知道基础知识。 Never will use it though, CommonJS with Webpack or Browserify is so much better :)
虽然永远不会使用它,但将CommonJS与Webpack或Browserify相比要好得多:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.