模拟微任务 判断是否有对应的api
if(typeof Promise !=='undefined'&&isNative(Promise)){
}
function runMicrotask(func){
if(typeof Promise==='function'){
Promise.resolve().then(func)
return
}
if(typeof MutationObserver==='function'){
var ob=new MutationObserver(func)
var node=document.createTextNode('')
ob.observe(node,{characterData:true})
node.data=1;
}
if(process&&typeof process.nextTick==='function'){
process.nextTick(func)
return
}
if(typeof setImmediate==='function'){
setImmediate(func)
return
}
setTimeout(func)
}