spl_autoload_register( function($className){
if ( strpos($className, 'Model') !== false ) return false; // иначе при использование \R, пытается загрузить 'Model_TableName'
$className = str_replace('\\', '/', $className);
require_once $_SERVER['DOCUMENT_ROOT'].'/'.$className.'.php';
})
loadImages(){
let promises = [];
this._imagesUrl.forEach( elem => {
let obj = {};
for (let prop in elem) {
let promise = new Promise( resolve => {
let image = new Image();
image.classList.add('plane-image');
image.setAttribute('src', elem[prop]);
obj[prop] = image;
image.onload = () => resolve(image);
})
promises.push(promise);
}
this._images.push(obj);
})
Promise.all(promises)
.then ( () => this._imagesLoaded = true )
.catch( () => this.loadImages() );
}
function createRootReducer(reducers){
return function(state, action){
for (let i = 0; i < reducers.length; i++){
let newState = reducers[i](state, action);
if ( isEmpty(newState) == false ) return newState;
}
return state;
}
}
const reducer = createRootReducer([
//reducers array
])