The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
// Based on: https://stackoverflow.com/a/46814952/283851 | |
/** | |
* Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed. | |
* | |
* Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails. | |
*/ | |
export async function getImageUrl(file: File, maxWidth: number|undefined) { | |
return readOrientation(file).then(orientation => applyRotation(file, orientation || 1, maxWidth || 999999)); | |
} |
Running a script in the background in linux can be done using nohup
, using nohup we can run node application in the background
$ nohup node server.js > /dev/null 2>&1 &
nohup
means: Do not terminate this process even when the stty is cut off> /dev/null
means: stdout goes to /dev/null
(which is a dummy device that does not record any output)