This commit is contained in:
lucasdevelop 2021-07-21 20:22:45 +02:00
parent 1e45bc2444
commit f71fd73cbb
4 changed files with 10 additions and 31 deletions

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# varkeeper
![npm](https://img.shields.io/npm/v/varkeeper) ![NPM](https://img.shields.io/npm/l/varkeeper) ![npm](https://img.shields.io/npm/dw/varkeeper)

View File

@ -4,21 +4,18 @@
"description": "",
"main": "dist/index.js",
"devDependencies": {
"mocha": "^9.0.2",
"chai": "^4.3.4",
"chai-arrays": "^2.2.0",
"gulp": "^4.0.2",
"gulp-minify": "^3.1.0"
"gulp-minify": "^3.1.0",
"mocha": "^9.0.2"
},
"scripts": {
"test": "mocha",
"build": "gulp build",
"publish": "npm publish --access publish"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lucaspalomodevelop/varkeeper.git"
},
"repository": "git+https://github.com/lucaspalomodevelop/varkeeper.git",
"keywords": [
"varkeeper",
"var",

View File

@ -9,7 +9,6 @@ function setprop(name, value) {
props[name] = value;
onchange_func(name, value);
ifis_func(name, value)
}
@ -40,19 +39,5 @@ function onchange_func(name,value){
}
}
function ifis(name, condition , callback) {
events.push({ name: name, callback: callback, condition: condition, type: 'ifis' });
}
function ifis_func(name, value) {
let ifisevent = getEventsFromTypeAndName(name, 'ifis');
ifisevent.forEach(element => {
if(element.condition){
element.callback(value);
}
});
}
module.exports = { setprop, getprop, onchange, ifis }
module.exports = { setprop, getprop, onchange }

View File

@ -47,13 +47,5 @@ describe('varkeeper', () => {
assert.equal(a, true);
});
});
describe('ifis', () => {
it('will call funtion by change prop value', (done) => {
varkeeper.ifis('test', varkeeper.getprop('test').length > 1 , (value) => {
done();
});
varkeeper.setprop('test', [1,2,3]);
throw new Error();
});
});
});