SOURCE

// 链接地址 https://mp.weixin.qq.com/s/82tCRof2lcu4fzULXKhjtg
//  打工人的一天
 const workingPeople = {
    起床() {
      console.log('我起床了');
    },
    上班() {
      console.log('我上班了');
    },
    加班() {
      console.log('我加班了');
    },
    下班() {
      console.log('我下班了');
    },
  };

const TYPES = {
  FUNCTION: 'function'
}
// 老板监控中的打工人
const bossWorkMonitor = new Proxy(workingPeople, {
    get(target, key, value, receiver) {
        console.log('老板开始看你了~');
       const res = Reflect.get(target, key, value, receiver);
    //    打工人任务
       const workTask = typeof res === TYPES.FUNCTION ? res() : res;
        console.log('老板开始记你小本本了~');
        return () => workTask;
    }
});

 console.log(bossWorkMonitor.起床(),bossWorkMonitor.上班());
console 命令行工具 X clear

                    
>
console