Source: chemistry/BunsenBurner.js

/**
 * @module
 */
define(function () {
    /**
     * @class
     */
    BunsenBurner = function () {
        // in kJ/sec
        this.power = 1;
        this.lastCall = -1;
    };

    BunsenBurner.prototype.start = function () {
        this.lastCall = new Date().getTime();
    };

    BunsenBurner.prototype.stop = function () {
        this.lastCall = -1;
    };

    /**
     * Returns the change in heat since last call
     * @param source Solution related to this object
     * @returns {number} Heat in kJ
     */
    BunsenBurner.prototype.getHeatSinceLastCall = function (source) {
        var time = new Date().getTime();
        var heat = (time - this.lastCall) / 1000 * this.power;
        this.lastCall = time;
        return heat;
    };
    return BunsenBurner;
});