mercury
Version:
A truly modular frontend framework
23 lines (17 loc) • 450 B
JavaScript
;
var setTimeout = require('timers').setTimeout;
function ResetHook(value, sink) {
if (!(this instanceof ResetHook)) {
return new ResetHook(value, sink);
}
this.value = value;
this.sink = sink;
}
ResetHook.prototype.hook = function hook(elem, propName) {
var self = this;
elem[propName] = self.value;
setTimeout(function lol() {
self.sink(false);
}, 0);
};
module.exports = ResetHook;