define(["lib/underscore"], function(_) {
"use strict";
/**
* @privconstructor
* @class Represents the binding of a function to an event. Allows apps to
* clear this binding.
* @name Binding
*/
var Binding = function(onClear, context) {
/** @alias Binding.prototype */
var self = {};
onClear = _.once(onClear);
/**
* Clears this binding: the bound function will no longer be called.
*/
self.clear = function() {
onClear.call(context);
};
Object.freeze(self);
return self;
};
return Binding;
});