blob: f689e9cd10feb7363faa98bfe09a849d969915ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
var deprecated = {
method: function(msg, log, fn) {
var called = false;
return function(){
if (!called) {
called = true;
log(msg);
}
return fn.apply(this, arguments);
};
},
field: function(msg, log, parent, field, val) {
var called = false;
var getter = function(){
if (!called) {
called = true;
log(msg);
}
return val;
};
var setter = function(v) {
if (!called) {
called = true;
log(msg);
}
val = v;
return v;
};
Object.defineProperty(parent, field, {
get: getter,
set: setter,
enumerable: true
});
return;
}
};
module.exports = deprecated;
|