-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
import demo from './demo.js'; | ||
import { version } from '../package.json'; | ||
import answer from 'the-answer'; | ||
import _merge from 'lodash/merge'; | ||
|
||
console.log('version:' + version); | ||
|
||
let users = { | ||
'data': [{ 'user': 'barney' }, { 'user': 'fred' }] | ||
}; | ||
let ages = { | ||
'data': [{ 'age': 36 }, { 'age': 40 }] | ||
}; | ||
const a = _merge(users, ages); | ||
console.log('-------lodash:', a); | ||
|
||
|
||
async function initDemo() { | ||
console.log('the answer is ' + answer); | ||
const obj = {} | ||
const newObj = Object.assign(obj, { age: 30 }); | ||
let data = await demo(); | ||
console.log('initDemo:', data, newObj); | ||
return data; | ||
const preload = (images, cb) => { | ||
const len = images.length; | ||
const imgArr = []; | ||
let count = 0; | ||
if (len) { | ||
images.forEach((url, i) => { | ||
const img = new Image(); | ||
img.src = url; | ||
img.onload = () => imgLoad(i); | ||
img.onerror = imgLoad; | ||
imgArr.push(img); | ||
}); | ||
function imgLoad(i) { | ||
console.log(`---------img-${i} load`); | ||
count++; | ||
if (count === len) { | ||
cb(); | ||
} | ||
} | ||
} else { | ||
cb(); | ||
} | ||
} | ||
|
||
initDemo(); | ||
|
||
export default initDemo; | ||
export default preload; |