You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError('Expected the reducer to be a function.')
389
+
thrownewError('É esperado que o reducer seja uma função.')
390
390
}
391
-
//current reducer
391
+
// reducer atual
392
392
let currentReducer = reducer
393
-
//current state
393
+
// state atual
394
394
let currentState = preloadedState
395
-
//current listener array
395
+
//atual listener array
396
396
let currentListeners = []
397
-
//this is a very important design. The purpose is that currentListeners array is an invariant when the listeners are iterated every time
398
-
//we can consider if only currentListeners exists. If we execute subscribe again in some subscribe execution, or unsubscribe, it would change the length of the currentListeners array, so there might be an index error
397
+
//esse é um design muito importante. O proposito é que o currentListeners array seja invariante quando os listeners estiverem sendo interado
398
+
//Nós podemos considerar se apenas um currentListeners existe. Se nós executarmos o subscribe novamente em alguma execução do subscribe, ou unsubscribe isso mudaria o tamanho do currentListeners array, então devemos ter um index erro
399
399
let nextListeners = currentListeners
400
-
//if reducer is executing
400
+
//se o reducer está executando
401
401
let isDispatching =false
402
-
//if currentListeners is the same as nextListeners, assign the value back
402
+
//se o currentListeners é o mesmo que o nextListeners, atribua o valor de volta
Before that I need to introduce a concept called function Currying. Currying is a technology for changing a function with multiple parameters to a series of functions with a single parameter.
414
+
Antes eu preciso introduzir um conceito chamado Currying. Currying é uma tecnologia para mudar uma função com multiplos parâmetros em uma série de funções com um único parâmetro.
415
415
416
416
```js
417
417
functionadd(a,b) { return a + b }
418
418
add(1, 2) =>3
419
-
//for the above function, we can use Currying like so
419
+
//para a função abaixo, nós usamos Currying igual a
420
420
functionadd(a) {
421
421
returnb=> {
422
422
return a + b
423
423
}
424
424
}
425
425
add(1)(2) =>3
426
-
//you can understand Currying like this:
427
-
//we store an outside variable with a closure, and return a function that takes a parameter. In this function, we use the stored variable and return the value.
426
+
//você pode entender Currying como:
427
+
//nós armazenamos uma variável do lado de fora com um closure, e retornamos uma função que leva um parâmetro. Nessa função, nós usamos a variável armazenada e retornamos um valor.
428
428
```
429
429
430
430
```js
431
-
//this function should be the most abstruse part of the whole source code
432
-
//this function returns a function Curried
433
-
//therefore the funciton should be called like so: applyMiddleware(...middlewares)(createStore)(...args)
431
+
//essa função deve ser a parte mais obstrusa de todo código
432
+
//essa função retorna um função Curried
433
+
//assim sendo a função deve se chamada como: applyMiddleware(...middlewares)(createStore)(...args)
0 commit comments