fix(code style): fix lint and rename vars

This commit is contained in:
wryk 2019-03-18 15:48:21 +01:00
parent 061b739ad2
commit d7132f95e5
4 changed files with 34 additions and 38 deletions

View file

@ -47,7 +47,7 @@ export function capture (mediaStream, duration) {
step()
function step() {
function step () {
canvasContext.drawImage(
video,
soureRectangle.x,
@ -83,7 +83,7 @@ export function capture (mediaStream, duration) {
}
}
})
.catch(error => emitter.emit('error', error))
.catch(error => emitter.emit('error', error))
return emitter;
return emitter
}

View file

@ -1,7 +1,5 @@
import EventEmitter from 'eventemitter3'
import genericPool from 'generic-pool'
import pEvent from 'p-event'
import { write } from '/services/encode-core.js'
import { promisesProgress, calcProgress } from '/services/util.js'
import { GIF_PALETTE_SIZE } from '/constants.js'
@ -17,7 +15,6 @@ export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }) {
max: 2
})
const indexedColorImagesP = imageDataList
.map(async imageData => {
const worker = await quantizeColorWorkerPool.acquire()
@ -77,7 +74,7 @@ export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }) {
delayTime
})
})
.catch(error => emitter.emit('error', error))
.catch(error => emitter.emit('error', error))
return emitter
}

View file

@ -44,43 +44,43 @@ export default new Vuex.Store({
state.mediaStream = null
},
inverseFacingMode (store) {
store.capturing.shouldFaceUser = !store.capturing.shouldFaceUser
inverseFacingMode (state) {
state.capturing.shouldFaceUser = !state.capturing.shouldFaceUser
},
updateTimer (store, time) {
store.timer.selected = time
updateTimer (state, time) {
state.timer.selected = time
},
startCapture (store) {
store.capturing.status = true
startCapture (state) {
state.capturing.status = true
},
stopCapture (store) {
store.capturing.status = false
stopCapture (state) {
state.capturing.status = false
},
updateCaptureState (store, percent) {
store.capturing.state = percent
updateCaptureState (state, percent) {
state.capturing.state = percent
},
startEncoding (store) {
store.encoding.status = true
startEncoding (state) {
state.encoding.status = true
},
stopEncoding (store) {
store.encoding.status = false
stopEncoding (state) {
state.encoding.status = false
},
updateEncodingState (store, percent) {
store.encoding.state = percent
updateEncodingState (state, percent) {
state.encoding.state = percent
},
startDownloading (store, objectUrl) {
store.downloading.status = true
store.downloading.objectUrl = objectUrl
store.downloading.timestamp = Date.now()
startDownloading (state, objectUrl) {
state.downloading.status = true
state.downloading.objectUrl = objectUrl
state.downloading.timestamp = Date.now()
},
stopDownloading (store) {
if (store.downloading.objectUrl) {
URL.revokeObjectURL(store.downloading.objectUrl)
stopDownloading (state) {
if (state.downloading.objectUrl) {
URL.revokeObjectURL(state.downloading.objectUrl)
}
store.downloading.status = false
store.downloading.objectUrl = null
store.downloading.timestamp = null
state.downloading.status = false
state.downloading.objectUrl = null
state.downloading.timestamp = null
}
},
actions: {
@ -112,7 +112,7 @@ export default new Vuex.Store({
commit('updateWelcomed', false)
})
},
capture ({ commit, dispatch, state }) {
capture ({ state, commit, dispatch }) {
commit('startCapture')
const capturing = capture(state.mediaStream, state.timer.selected * 1000)

View file

@ -9,7 +9,7 @@
<video ref="preview" class="preview-visual" preload="yes" autoplay muted playsinline webkit-playsinline></video>
</div>
<button class="capture-btn" :class="{ 'capture-btn--capturing': capturing.status }" @click.prevent="startCapture" :disabled="!mediaStream">Capture</button>
<button class="capture-btn" :class="{ 'capture-btn--capturing': capturing.status }" :disabled="!mediaStream" @click.prevent="startCapture">Capture</button>
<encoding-overlay v-if="encoding.status"></encoding-overlay>
</div>
@ -20,7 +20,7 @@ import captureOptions from '/views/components/capture-options'
import captureProgress from '/views/components/capture-progress'
import encodingOverlay from '/views/components/encoding'
import objectFitPolyfill from 'objectFitPolyfill'
import 'objectFitPolyfill'
import { mapState } from 'vuex'
@ -53,7 +53,7 @@ export default {
this.ensureCameraStarted()
}
},
updatePreviewMediaStream() {
updatePreviewMediaStream () {
this.$refs.preview.srcObject = this.mediaStream
}
},
@ -69,7 +69,6 @@ export default {
window.objectFitPolyfill(this.$refs.preview)
this.ensureCameraStarted()
},
updated: function () {
this.updatePreviewMediaStream()