Effectively an easy way to call setTimeout()
from within an async function.
note: This will only wait at least this many ms before execution continues.
const sleep = ms => new Promise(res => setTimeout(res, ms));
// Usage
/** | |
* (Note: Depends on window.requestAnimationFrame for polling.) | |
* | |
* An experimental Gamepad object for detecting | |
* and parsing gamepad input. | |
* | |
* Current code borrows heavily from Marcin Wichary's work: | |
* http://www.html5rocks.com/en/tutorials/doodles/gamepad/ | |
* | |
* Also uses deadzone values from |
import axios from 'axios'; | |
// You can use any cookie library or whatever | |
// library to access your client storage. | |
import cookie from 'cookie-machine'; | |
axios.interceptors.request.use(function(config) { | |
const token = cookie.get(__TOKEN_KEY__); | |
if ( token != null ) { | |
config.headers.Authorization = `Bearer ${token}`; |
<?php | |
namespace App\Models; | |
use Ramsey\Uuid\Uuid; | |
/** | |
* App\Models\UuidModel. | |
* | |
* @mixin \Eloquent |