bugcore
Version:
bugcore is a JavaScript library that provides a foundational architecture for object oriented JS
101 lines (71 loc) • 2.9 kB
JavaScript
/*
* Copyright (c) 2016 airbug Inc. http://airbug.com
*
* bugcore may be freely distributed under the MIT license.
*/
//-------------------------------------------------------------------------------
// Annotations
//-------------------------------------------------------------------------------
//@Export('MethodSupplier')
//@Require('Class')
//@Require('Supplier')
//-------------------------------------------------------------------------------
// Context
//-------------------------------------------------------------------------------
require('bugpack').context("*", function(bugpack) {
//-------------------------------------------------------------------------------
// BugPack
//-------------------------------------------------------------------------------
var Class = bugpack.require('Class');
var Supplier = bugpack.require('Supplier');
//-------------------------------------------------------------------------------
// Declare Class
//-------------------------------------------------------------------------------
/**
* @class
* @extends {Supplier}
*/
var MethodSupplier = Class.extend(Supplier, {
_name: "MethodSupplier",
//-------------------------------------------------------------------------------
// Constructor
//-------------------------------------------------------------------------------
/**
* @constructs
* @param {function(Supplier)} method
*/
_constructor: function(method) {
this._super();
//-------------------------------------------------------------------------------
// Private Properties
//-------------------------------------------------------------------------------
/**
* @private
* @type {function(Supplier)}
*/
this.method = method;
},
//-------------------------------------------------------------------------------
// Getters and Setters
//-------------------------------------------------------------------------------
/**
* @return {function(Supplier)}
*/
getMethod: function() {
return this.method;
},
//-------------------------------------------------------------------------------
// Supplier Methods
//-------------------------------------------------------------------------------
/**
*
*/
doStart: function() {
this.method(this);
}
});
//-------------------------------------------------------------------------------
// Exports
//-------------------------------------------------------------------------------
bugpack.export('MethodSupplier', MethodSupplier);
});