Skip to content

Instantly share code, notes, and snippets.

Created March 18, 2017 18:20
Show Gist options
  • Save anonymous/83839532b70d8337bafac03d2b4053f7 to your computer and use it in GitHub Desktop.
Save anonymous/83839532b70d8337bafac03d2b4053f7 to your computer and use it in GitHub Desktop.
import { LOAD_IMG, WALLPAPER_PATH_PREFIX } from '../../constants';
export default function (url) {
const bigImg = new Image();
bigImg.src = `${WALLPAPER_PATH_PREFIX}${url}`;
bigImg.onload = () => {
return {
type: LOAD_IMG,
payload: true
}
}
bigImg.onerror = () => {
return {
type: LOAD_IMG,
payload: false,
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment