Lazing('Garry')
// 输出 'hello Garray'
Lazing('Garry').sleep(10).eat('rice')
// 输出 'hello Garray'
// 等待10秒...
// 输出 'eating rice'
Lazing('Garry').eat('rice').eat('bread')
// 输出 'eating rice'
// 输出 'eating bread'
Lazing('Garry').sleepFirst(5).eat('rice')
// 等待5秒...
// 输出 'hello Garray'
// 输出 'eating rice'
难点是定时器该怎么处理?如果sleepFirst定时器是后置的怎么来实现?
Lazing('Garry').eat('rice').sleepFirst(5)
// 等待5秒...
// 输出 'hello Garray'
// 输出 'eating rice'
粗略的demo,定时器放在后面老衲一时想不通,此demo按顺序执行