mirror of
https://github.com/lucaspalomodevelop/varkeeper.git
synced 2026-03-12 23:37:21 +00:00
add prettier
This commit is contained in:
parent
7474937bf6
commit
520072d31d
11
src/index.js
11
src/index.js
@ -35,6 +35,9 @@ Prop.prototype = {
|
||||
on: function (eventname, callback) {
|
||||
on(this.name, eventname, callback);
|
||||
},
|
||||
use: function (callback) {
|
||||
use(this.name, callback);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@ -118,4 +121,12 @@ function on_function(eventname, name, value) {
|
||||
}
|
||||
}
|
||||
|
||||
function use(name, callback) {
|
||||
let value = getprop(name);
|
||||
|
||||
callback(value);
|
||||
|
||||
deleteprop(name);
|
||||
}
|
||||
|
||||
module.exports = { setprop, getprop, deleteprop, on, Prop };
|
||||
|
||||
@ -133,4 +133,13 @@ describe("varkeeper", () => {
|
||||
assert.equal(result, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("varkeeper use funtion OOP", () => {
|
||||
let x = new varkeeper.Prop("test", "value");
|
||||
x.use((value) => {
|
||||
console.log(value);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user