Last active
May 4, 2016 17:22
-
-
Save sethdorris/d96562e6c818a7cd23070605a0945a3f to your computer and use it in GitHub Desktop.
Async
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
const gulp = require('gulp'); | |
const browserify = require('browserify'); | |
const babelify = require('babelify'); | |
const source = require('vinyl-source-stream'); | |
const babel = require('gulp-babel'); | |
gulp.task('server-to-es2015', () => { | |
return gulp.src('./server/server.js') | |
.pipe(babel({ | |
presets: ['es2015'] | |
})) | |
.pipe(gulp.dest(__dirname + "/build/server")); | |
}); | |
gulp.task('client-transform', () => { | |
return browserify('./client/app.js', { debug: true }) | |
.transform(babelify, { | |
presets: ['es2015', 'react', 'stage-2', 'stage-3'], | |
plugins: ['transform-runtime','transform-regenerator']}) | |
.bundle() | |
.pipe(source('app.js')) | |
.pipe(gulp.dest(__dirname + "/build/client")); | |
}); | |
gulp.task('copy', () => { | |
return gulp.src(['index.html', 'main.css']) | |
.pipe(gulp.dest('./build')) | |
}); | |
gulp.task('default', ['server-to-es2015', 'client-transform', 'copy']); |
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
connectButton() { | |
const {dispatch} = this.props; | |
let login = document.getElementById("usernameinput").value | |
//let promise = new Promise((resolve, reject) => { | |
// let connected = ws.connect(); | |
// resolve(connected); | |
//}); | |
//promise.then((data) => { | |
// console.log("Connected:", data); | |
// dispatch(socketOnOpen()); | |
// dispatch(setUsername(login)); | |
// this.context.router.push({ | |
// pathname: '/main' | |
// }) | |
//}); | |
(async function() { | |
await ws.connect(); | |
console.log('CONNECTED!') | |
console.log(ws.connected); | |
}()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment