Skip to content

Commit f24e9d8

Browse files
Merge pull request jeduan#384 from simllll/master
Update facebook-browser.js
2 parents 2db5112 + d54042b commit f24e9d8

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

www/facebook-browser.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,32 @@ exports.getAccessToken = function getAccessToken (s, f) {
7575
}
7676

7777
exports.logEvent = function logEvent (eventName, params, valueToSum, s, f) {
78-
// AppEvents are not avaliable in JS.
79-
s()
78+
if (!__fbSdkReady) {
79+
return __fbCallbacks.push(function() {
80+
logEvent(eventName, params, valueToSum, s, f);
81+
});
82+
}
83+
84+
FB.AppEvents.logEvent(eventName, valueToSum, params);
85+
86+
if(s) s();
8087
}
8188

8289
exports.logPurchase = function logPurchase (value, currency, s, f) {
83-
// AppEvents are not avaliable in JS.
84-
s()
90+
if (!__fbSdkReady) {
91+
return __fbCallbacks.push(function() {
92+
logPurchase(value, currency, s, f);
93+
});
94+
}
95+
96+
FB.AppEvents.logPurchase(value, currency);
97+
98+
if(s) s();
8599
}
86100

87101
exports.appInvite = function appInvite (options, s, f) {
88102
// App Invites are not avaliable in JS.
89-
s()
103+
if(s) s()
90104
}
91105

92106
exports.logout = function logout (s, f) {

0 commit comments

Comments
 (0)