This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prompts to choose a file from filesystem, converts to base64 (in background), and returns base64 when conversion ends. | |
* @param {number} maxFileSize Maximum size of file. | |
* @param {boolean} multiple Indicates whether to accept one or more files. | |
* @param {string} contentType MIME type of media to require from filesystem (can be 'image/*', etc). | |
* @param {string} source (For mobile devices only) If set to 'camera', tells device to capture image from camera. | |
* @returns {Promise} A Promise that resolves when files are read; rejects with error text if files are heavier than allowed. | |
*/ | |
onClickSendMedia(maxFileSize, multiple = false, contentType = '*/*', source) { | |
return new Promise((resolve, reject) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
var fruits = ['apple', 'orange', 'banana', 'pear'], | |
middleJoiner = ', ', | |
endJoiner = ' and ', | |
result = listJoiner(fruits, middleJoiner, endJoiner); | |
*/ | |
// result will be this string: 'apple, orange, banana and pear' | |
//Iterative way | |
function listJoinerIter(elems, middleJoiner, endJoiner) { |
NewerOlder