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() step()
function step() { function step () {
canvasContext.drawImage( canvasContext.drawImage(
video, video,
soureRectangle.x, soureRectangle.x,
@ -85,5 +85,5 @@ 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 EventEmitter from 'eventemitter3'
import genericPool from 'generic-pool' 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 { promisesProgress, calcProgress } from '/services/util.js'
import { GIF_PALETTE_SIZE } from '/constants.js' import { GIF_PALETTE_SIZE } from '/constants.js'
@ -17,7 +15,6 @@ export function encode ({ imageDataList, imageWidth, imageHeight, delayTime }) {
max: 2 max: 2
}) })
const indexedColorImagesP = imageDataList const indexedColorImagesP = imageDataList
.map(async imageData => { .map(async imageData => {
const worker = await quantizeColorWorkerPool.acquire() const worker = await quantizeColorWorkerPool.acquire()

View file

@ -44,43 +44,43 @@ export default new Vuex.Store({
state.mediaStream = null state.mediaStream = null
}, },
inverseFacingMode (store) { inverseFacingMode (state) {
store.capturing.shouldFaceUser = !store.capturing.shouldFaceUser state.capturing.shouldFaceUser = !state.capturing.shouldFaceUser
}, },
updateTimer (store, time) { updateTimer (state, time) {
store.timer.selected = time state.timer.selected = time
}, },
startCapture (store) { startCapture (state) {
store.capturing.status = true state.capturing.status = true
}, },
stopCapture (store) { stopCapture (state) {
store.capturing.status = false state.capturing.status = false
}, },
updateCaptureState (store, percent) { updateCaptureState (state, percent) {
store.capturing.state = percent state.capturing.state = percent
}, },
startEncoding (store) { startEncoding (state) {
store.encoding.status = true state.encoding.status = true
}, },
stopEncoding (store) { stopEncoding (state) {
store.encoding.status = false state.encoding.status = false
}, },
updateEncodingState (store, percent) { updateEncodingState (state, percent) {
store.encoding.state = percent state.encoding.state = percent
}, },
startDownloading (store, objectUrl) { startDownloading (state, objectUrl) {
store.downloading.status = true state.downloading.status = true
store.downloading.objectUrl = objectUrl state.downloading.objectUrl = objectUrl
store.downloading.timestamp = Date.now() state.downloading.timestamp = Date.now()
}, },
stopDownloading (store) { stopDownloading (state) {
if (store.downloading.objectUrl) { if (state.downloading.objectUrl) {
URL.revokeObjectURL(store.downloading.objectUrl) URL.revokeObjectURL(state.downloading.objectUrl)
} }
store.downloading.status = false state.downloading.status = false
store.downloading.objectUrl = null state.downloading.objectUrl = null
store.downloading.timestamp = null state.downloading.timestamp = null
} }
}, },
actions: { actions: {
@ -112,7 +112,7 @@ export default new Vuex.Store({
commit('updateWelcomed', false) commit('updateWelcomed', false)
}) })
}, },
capture ({ commit, dispatch, state }) { capture ({ state, commit, dispatch }) {
commit('startCapture') commit('startCapture')
const capturing = capture(state.mediaStream, state.timer.selected * 1000) 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> <video ref="preview" class="preview-visual" preload="yes" autoplay muted playsinline webkit-playsinline></video>
</div> </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> <encoding-overlay v-if="encoding.status"></encoding-overlay>
</div> </div>
@ -20,7 +20,7 @@ import captureOptions from '/views/components/capture-options'
import captureProgress from '/views/components/capture-progress' import captureProgress from '/views/components/capture-progress'
import encodingOverlay from '/views/components/encoding' import encodingOverlay from '/views/components/encoding'
import objectFitPolyfill from 'objectFitPolyfill' import 'objectFitPolyfill'
import { mapState } from 'vuex' import { mapState } from 'vuex'
@ -53,7 +53,7 @@ export default {
this.ensureCameraStarted() this.ensureCameraStarted()
} }
}, },
updatePreviewMediaStream() { updatePreviewMediaStream () {
this.$refs.preview.srcObject = this.mediaStream this.$refs.preview.srcObject = this.mediaStream
} }
}, },
@ -69,7 +69,6 @@ export default {
window.objectFitPolyfill(this.$refs.preview) window.objectFitPolyfill(this.$refs.preview)
this.ensureCameraStarted() this.ensureCameraStarted()
}, },
updated: function () { updated: function () {
this.updatePreviewMediaStream() this.updatePreviewMediaStream()