This file contains 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
<script type="module"> | |
import {addTextToBody} from './utils.mjs'; | |
addTextToBody('Modules are pretty cool.'); | |
</script> |
This file contains 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
export function addTextToBody(text) { | |
const div = document.createElement('div'); | |
div.textContent = text; | |
document.body.appendChild(div); | |
} |
This file contains 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
<script type="module"> | |
import Vue from 'https://unpkg.com/vue@2.6.0/dist/vue.esm.browser.min.js'; | |
new Vue({ | |
... | |
}); | |
</script> |
This file contains 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
async mounted () { | |
this.message = 'updated' | |
console.log(this.$el.textContent) // 'not updated' | |
await this.$nextTick() | |
console.log(this.$el.textContent) // 'updated' | |
} |
This file contains 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
Vue.nextTick(function () { | |
// do something cool | |
}) |
This file contains 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
mounted() { | |
this.$nextTick(() => { | |
// The whole view is rendered, so I can safely access or query | |
// the DOM. ¯\_(ツ)_/¯ | |
}) | |
} |
This file contains 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
Queue::after(function (JobProcessed $event) { | |
$result = ... // get the job result from the DB | |
SendEmail::dispatch($event->data["email"], $result); | |
}); |
This file contains 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
public function store(Request $request) | |
{ | |
if ($request->hasFile('csv')) { | |
ProcessCSV::dispatch($request->file("csv"), $request->email); | |
return response("File received for processing!", 202); | |
} else { | |
return response("No file provided.", 400); | |
} | |
} |
This file contains 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
<form id="upload" enctype="multipart/form-data" @submit.prevent="submit"> | |
<p>Please select the file you'd like to upload. Provide an email address and we'll inform you of the result and spam you later.</p> | |
<input type="file" name="csv" /> | |
<input type="email" name="email" /> | |
<input type="submit" value="Upload" /> | |
</form> |
This file contains 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
public function store(Request $request) | |
{ | |
if ($request->hasFile('csv')) { | |
ProcessCSV::dispatch($request->file("csv")); | |
return response("File received for processing!", 202); | |
} else { | |
return response("No file provided.", 400); | |
} | |
} |