monterail / angular-faye

Faye client wrapper for angular
MIT License
46 stars 16 forks source link

Adds faye initialization options. Fixes #2 #5

Open blackxored opened 10 years ago

blackxored commented 10 years ago

Allow passing initialization options to faye constructor invocation.

teamon commented 10 years ago

Thanks, but isn't the https://github.com/monterail/angular-faye#configure-faye-client enough? Besides that, $faye takes now three parameters: url, fun, opts so $faye("url", {...}) syntax will not work.

blackxored commented 10 years ago

I'm not sure what part of that syntax won't work, the third parameter is optional. The callback invocation (yield client) should also work as well. This is for initialization, under some cases I might want to initialize vs edit it later, poor argument but in the async world you never know :trollface:

teamon commented 10 years ago

I mean:

$faye = (url, fun, opts = {}) -> ...

$faye("some url", { my: opt }) 
# inside:
url == "some url"
fun == { my: opt }
opts == {}
blackxored commented 10 years ago

Actually no, iirc correctly you're using "?()" right, existential operator, that should parameter checking so if fun is not a function it will work correctly. Thanks.

teamon commented 10 years ago

But if you pass options as second parameter then variable fun will hold those options and options variable will be empty hash so options will not be applied and fun not executed