Skip to content

Instantly share code, notes, and snippets.

View thomastuts's full-sized avatar

Thomas Tuts thomastuts

View GitHub Profile
'use strict';
angular
.module('test')
.factory('Animal', function () {
function Animal(name) {
this.name = name;
}
@thomastuts
thomastuts / bundle.js
Created April 1, 2015 18:10
Gulp workflow with Browserify, Babel, React & BrowserSync
// tasks/bundle.js
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var concat = require('gulp-concat');

I'm working on an application that plays audio clips. The audio clips that are currently playing are stored in the Redux store (you can play more than one clip at once). Everything is working just fine, but I'm wondering what the cleanest way to play/stop the audio would be. (See below JS files for the full source of my store and audio manager file)

Currently, I am triggering the play/stop actions from within the store itself, but this feels kind of wrong:

// store.js

// ...
case 'AUDIO_PLAY':
      const audioObject = createAudioObject({