Skip to content

Wrap and compose functions #51

@frostney

Description

@frostney

Allow to wrap and compose function

var self = this;
this.on('reset', function() {});
this.on('pause', function() {});

this.behavior('reset', function() { self.trigger('reset'); });
this.behavior('newgame', function() {
  self.trigger('reset'); 
  self.trigger('pause');
});

would become

this.on('reset', function() {});
this.on('pause', function() {});

this.behavior('reset', this.wrap(this.trigger, 'reset'));
this.behavior('newgame', this.compose([this.wrap(this.trigger, 'reset'), this.wrap(this.trigger, 'pause')]));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions