mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-04-23 06:11:52 +02:00
24 lines
531 B
JavaScript
24 lines
531 B
JavaScript
|
import {get, set} from "./schedule.js";
|
||
|
|
||
|
function durationFunction(id, value) {
|
||
|
return function() {
|
||
|
set(this, id).duration = +value.apply(this, arguments);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function durationConstant(id, value) {
|
||
|
return value = +value, function() {
|
||
|
set(this, id).duration = value;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
export default function(value) {
|
||
|
var id = this._id;
|
||
|
|
||
|
return arguments.length
|
||
|
? this.each((typeof value === "function"
|
||
|
? durationFunction
|
||
|
: durationConstant)(id, value))
|
||
|
: get(this.node(), id).duration;
|
||
|
}
|