input.addEventListener('change', function(event) {
Array.prototype.slice.call( this.files ).forEach(function(elem, indx) {
let uploadImageUrl = URL.createObjectURL(elem)
let blob = new Blob([uploadImageUrl], {type: "image/png"})
console.log( blob )
if( replaceImage ) {
obj[input.id][0] = blob
data.canvas[input.id] = ''
} else {
obj[input.id].push(blob)
}
}.bind(this))
data.inputs = obj
})
код var constructor = (function() {
constructor = function() {
this.init()
}
constructor.prototype = {
init() {
this.func1()
},
func1() {
var promise = new Promise(function(resolve) {
new editImage(parent, src)
setTimeout(() => resolve("result"), 1000);
})
promise.then(result => {
this.func2()
})
},
func2() {
let count = editImage.prototype.countImage()
console.log( count )
}
}
return constructor;
}())
var constructor = new constructor();
var editImage = (function() {
data = {
}
editImage = function() {
this.init()
}
editImage.prototype = {
init() {
this.editImageFunc1()
this.editImageFunc2()
},
editImageFunc1() {},
editImageFunc2() {},
countImage() {
return 'count';
}
}
return editImage;
}())