-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from derbyjs/debrowserified
Debrowserify module
- Loading branch information
Showing
3 changed files
with
36 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
var racer = require('racer'); | ||
var BCSocket = require('browserchannel/dist/bcsocket-uncompressed').BCSocket; | ||
const racer = require('racer'); | ||
const BCSocket = require('browserchannel/dist/bcsocket-uncompressed').BCSocket; | ||
|
||
var CLIENT_OPTIONS = {{clientOptions}}; | ||
const DEFAULT_CLIENT_OPTIONS = { | ||
reconnect: true, | ||
base: '/channel', | ||
} | ||
|
||
racer.Model.prototype._createSocket = function(bundle) { | ||
var options = CLIENT_OPTIONS; | ||
if (bundle.browserChannel) { | ||
options = racer.util.mergeInto({}, options); | ||
racer.util.mergeInto(options, bundle.browserChannel); | ||
module.exports = function init(clientOptions) { | ||
if (!process.browser) { | ||
return; | ||
} | ||
var base = options.base || '/channel'; | ||
return new BCSocket(base, options); | ||
}; | ||
const options = Object.assign({}, DEFAULT_CLIENT_OPTIONS, clientOptions); | ||
|
||
racer.Model.prototype._createSocket = function(bundle) { | ||
if (bundle.browserChannel) { | ||
racer.util.mergeInto(options, bundle.browserChannel); | ||
} | ||
return new BCSocket(options.base, options); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters