Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require.JS ?? #132

Open
sombodi opened this issue Dec 15, 2015 · 3 comments
Open

Require.JS ?? #132

sombodi opened this issue Dec 15, 2015 · 3 comments

Comments

@sombodi
Copy link

sombodi commented Dec 15, 2015

Anyone know how to use this with requirejs? I am having some trouble bootsraping it in

@Steve-Mc
Copy link

+1

@bailinx
Copy link

bailinx commented Feb 16, 2016

I also encountered this problem, that is the problem of their own projects, a waste of two days.

My solution is (look at my project)

var socket = io.connect();
return {
    on: function (eventName, callback) {
        socket.on(eventName, function () {
            var args = arguments;
            $rootScope.$apply(function () {
                callback.apply(socket, args);
            })
        })
    },
    emit: function (eventName, data, callback) {
        socket.emit(eventName, data, function () {
            var args = arguments;
            $rootScope.$apply(function () {
                if( callback ) {
                    callback.apply(socket, args);
                }
            })
        })
    }
}

@sombodi
Copy link
Author

sombodi commented Feb 24, 2016

Awesome, works perfectly, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants