Files
JiboSDK/node_modules/jibo/lib/behaviors/start-on-anim-event.js
2026-03-22 03:21:45 +02:00

1 line
721 B
JavaScript

"use strict";var t=function(t){return t&&t.__esModule?t["default"]:t},e=require("../bt/main"),n=e.Status,i=e.createDecorator,r=e.factory,o=t(require("../behavior-emitter"));module.exports=i({constructor:function(t,e){this.eventName=t,this.onReceived=e,this.didStart=!1,this.onEventBind=this.onEvent.bind(this)},start:function(){return this.didStart=!1,0!==this.eventName.length&&o.on(this.eventName,this.onEventBind),n.WAIT},onEvent:function(t,e){this.onReceived&&this.onReceived(t,e),this.didStart=!0,o.removeListener(this.eventName,this.onEventBind)},stop:function(){0!==this.eventName.length&&o.removeListener(this.eventName,this.onEventBind)},update:function(t){return this.didStart?t:n.WAIT}}),r.addBehavior(module);