JSFiddle - React, Tailwind, and code Playground

by vishalvasani

HTML

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<!DOCTYPE html>
<html ng-app="MyModule" xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Main</title>
    <script>
        /**
* Copyright (C) 2013 Rafael Almeida Erthal Hermano
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
(function () {
    'use strict';

    var queue = [],
        ready = false;

    (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/all.js";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));

    window.fbAsyncInit = function () {
        var i;
        for (i = 0; i < queue.length; i++) {
            queue[i]();
        }
        ready = true;
    };

    function handler (fn) {
        if (ready) {
            return fn();
        }
        queue.push(fn);
    }

    angular
    .module('facebook', [])
    .provider('$facebook', function () {
        var module = {
            init : function (params) {
                return handler(function () {
                    return FB.init(params);
                });
            },
            api : function (path, method, params, cb) {
                return handler(function () {
                    return FB.api(path, method,...

JavaScript

angular.module('MyModule', ['facebook']).config(function($facebookProvider) {
  
  $facebookProvider.init({
    appId : '',
    channelUrl : '',
    status : true,
    cookie : true,
    xfbml : true
    /*...*/
  });
  
  $facebookProvider.Event.subscribe('auth.authResponseChange', function () {
    /*...*/
  });
  
  $facebookProvider.api('/me', function (response) {
    /*...*/
  });
  
  console.log($facebookProvider.getAuthResponse());
  
  /*...*/
});