Skip to content

Commit

Permalink
Changed name of webpack JSONP function and handled null streamURLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsbree committed Dec 4, 2015
1 parent 7bbfacd commit f079020
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Gruntfile.js
Expand Up @@ -113,7 +113,8 @@ module.exports = function(grunt) {
output: {
chunkFilename: 'toneden.js',
crossOriginLoading: 'anonymous',
filename: 'toneden.loader.js'
filename: 'toneden.loader.js',
jsonpFunction: 'TDSDKjsonp'
},
module: {
loaders: [{
Expand All @@ -140,7 +141,8 @@ module.exports = function(grunt) {
output: {
chunkFilename: 'toneden.js',
crossOriginLoading: 'anonymous',
filename: 'toneden.loader.js'
filename: 'toneden.loader.js',
jsonpFunction: 'TDSDKjsonp'
},
module: {
loaders: [{
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"async": "~1.2.1",
"d3": "~3.5.5",
"fluxxor": "~1.6.0",
"fluxxor": "~1.7.3",
"immutable": "~3.7.4",
"jquery": "~2.1.4",
"jsonp": "^0.2.0",
Expand All @@ -27,6 +27,6 @@
"react": "~0.13.3",
"style-loader": "~0.12.3",
"superagent": "~1.2.0",
"webpack": "~1.9.12"
"webpack": "~1.12.9"
}
}
9 changes: 9 additions & 0 deletions sdk/js/index.js
@@ -1,6 +1,7 @@
require('../css');

var _merge = require('lodash/object/merge');
var BatchingStrategy = require('react/lib/ReactDefaultBatchingStrategy');
var Fluxxor = require('fluxxor');
var ReactInjection = require('react/lib/ReactInjection');

Expand Down Expand Up @@ -29,6 +30,14 @@ var doNotLogEventTypes = [
if(!flux) {
flux = new Fluxxor.Flux(require('./flux/stores'), require('./flux/actions'));

// Custom dispatch wrapper to prevent errors when dispatching actions in componentDidMount method:
// https://github.com/BinaryMuse/fluxxor/pull/100
flux.setDispatchInterceptor(function(action, dispatch) {
BatchingStrategy.batchedUpdates(function() {
dispatch(action);
});
});

// Debug logging.
flux.on('dispatch', function(type, payload) {
if(doNotLogEventTypes.indexOf(type) === -1) {
Expand Down
4 changes: 2 additions & 2 deletions sdk/js/player/AudioInterface.js
Expand Up @@ -140,9 +140,9 @@ var AudioInterface = function(flux, parameters) {

async.waterfall([
function(next) {
if(streamUrl.search(/soundcloud\.com/i) !== -1) {
if(streamUrl && streamUrl.search(/soundcloud\.com/i) !== -1) {
return soundcloud.resolve(originalTrack, tracksPerArtist, next);
} else if(streamUrl.match(urlRegex)) {
} else if(streamUrl && streamUrl.match(urlRegex)) {
return next(null, [{
stream_url: streamUrl
}]);
Expand Down

0 comments on commit f079020

Please sign in to comment.