Skip to content

using services/ParseServices.js (with Parse-Angular-Patch) causes repeated calls to FB.init() #30

Description

@rbutera

My console is littered with error statements (particularly when running tests) with the following:
FB.init has already been called - this could indicate a problem

so far I have yet to encounter where this is problematic.

For reference, I have included the following files in my index.html:
parse-angular-patch/dist/parse-angular.js
parse-angular-demo/services/ParseServices.js
parse-angular-demo/services/FacebookAngularPatch.js

and I have the following async sdk code there too:

    <script type="text/javascript">
      (function(doc, script) {
        var js,
            fjs = doc.getElementsByTagName(script)[0],
            add = function(url, id) {
                if (doc.getElementById(id)) {return;}
                js = doc.createElement(script);
                js.src = url;
                id && (js.id = id);
                fjs.parentNode.insertBefore(js, fjs);
            };
        // Facebook SDK
        add('//connect.facebook.net/en_US/all.js', 'facebook-jssdk');
      }(document, 'script'));
    </script>

    <!-- Async resolve promise when FB SDK is loaded, this triggers Parse.FacebookUtils.init() -->
    <script>
      var fbDeferred = $.Deferred();
      window.fbPromise = fbDeferred.promise();
      window.fbAsyncInit = function() {
        fbDeferred.resolve();
      };
    </script>

    <script type="text/javascript">
      // manual bootstrap
      angular.element(document).ready(function() {
        angular.bootstrap(document, ['cloakroomApp']);
      });

    </script>

What can I do to remove this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions