UNPKG

okam-core

Version:

The extension for small program framework

18 lines (15 loc) 348 B
/** * @file Simple nextTick implementation * @author sparklewhy@gmail.com */ 'use strict'; export default function nextTick(callback) { /* istanbul ignore next */ if (typeof Promise === 'function') { Promise.resolve().then(callback); } else { /* istanbul ignore next */ setTimeout(callback, 0); } }