// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {
  // LIFE-CYCLE CALLBACKS:

  // onLoad () {}
  event:cc.Event.EventCustom = null
  onAnimCompleted(state) {
    this.event.detail = {
      state
    }
    cc.find('Canvas').dispatchEvent(this.event)
    console.log(cc.find('Canvas'))
  }
  start() {
    this.event = new cc.Event.EventCustom("test", true)
  }

  // update (dt) {}
}
