pitchtarget / ember-cli-facebook-js-sdk

Simple Facebook SDK for Javascript addon for your Ember CLI app.
MIT License
29 stars 15 forks source link

Dynamic appId #12

Closed danilovaz closed 7 years ago

danilovaz commented 8 years ago

@bugant Hey man, really thank's for this addon!

I need to know: Can I set appId dynamic? For example, I have 2 differents appIds and depend where it is call, I will use appId X or appId Y.

bugant commented 8 years ago

@danilovaz I think that the Facebook JS sdk does not support this scenario, I mean you cannot initialize the sdk twice.

danilovaz commented 8 years ago

@bugant This is possible. I try setting two differents appIds and this works. The problem is: I can't (or I don't know how) sent to config/environment.js the appId I need.

Example: ENV.FB = { appId: someVariable }

Can I configure your addon to use like an service and send the appId I want?

danilovaz commented 8 years ago

I can't do something like that, for each call I need?

action1() {
  this.get('fb').FBInit({ appId: '12345678' }).then((response) => {
    console.log(response);
  });
},
action2() {
  this.get('fb').FBInit({ appId: '9876543' }).then((response) => {
    console.log(response);
  });
}
bugant commented 8 years ago

@danilovaz at the moment the addon supports only a single app initialization... one vaiable solution would be the one you suggested of passing parameters to init: in that case the cached init promise could be discarded and a new init will be performed.

I'm not convinced this is something supported by the Facebook SDK though, do you have a link to the documentation that talk about this?

bugant commented 7 years ago

@danilovaz any news on this? My concern is that even if it could work I cannot find any official documentation about initializing the FB js SDK twice in the same page.

bugant commented 7 years ago

@danilovaz I'm closing this issue since I have no new info on it. Please, re-open it if you are willing to discuss on this topic.