| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import onfire from 'onfire';
- export default class BehaviorBase
- {
- constructor(behaviorName)
- {
- this._name = behaviorName;
- this._guid = onfire.getGuid();
- this._slice = Function.call.bind(Array.prototype.slice);
- }
- getBehaviorName()
- {
- return this._name;
- }
- on(evntName,handler,context)
- {
- return onfire.on(evntName ,handler,context);
- }
- off(event)
- {
- var type = typeof event;
- if (type === 'string') {
- onfire.un(attributeName);
- }
- else if (type === 'object' || type === 'function') {
- onfire.un(event);
- }
- }
- onDestoy()
- {
- }
- destroy()
- {
- onfire.fireSync('destroy',this);
- this.onDestoy();
- }
- setData(msgId,pb)
- {
- }
-
- emit(eventName)
- {
- onfire.fireSync(eventName,this,this._slice(arguments,1));
- }
- }
|