mirror of
https://github.com/lucaspalomodevelop/varkeeper.git
synced 2026-03-12 23:37:21 +00:00
del ifis
This commit is contained in:
parent
1e45bc2444
commit
f71fd73cbb
5
README.md
Normal file
5
README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# varkeeper
|
||||
|
||||
  
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
17
src/index.js
17
src/index.js
@ -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 }
|
||||
10
test/test.js
10
test/test.js
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user