minor fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-09-02 00:12:08 +03:00
parent d3a457131c
commit 8905152126
4 changed files with 16 additions and 10 deletions

View File

@ -849,6 +849,11 @@ module.Cache = ImageGridFeatures.Feature({
// Create a debounced action... // Create a debounced action...
// //
// debounce(<func>)
// debounce(<timeout>, <func>)
// debounce(<options>, <func>)
// -> function
//
// options format: // options format:
// { // {
// timeout: number, // timeout: number,
@ -860,8 +865,9 @@ var debounce =
module.debounce = module.debounce =
function(options, func){ function(options, func){
// parse args... // parse args...
func = options instanceof Function ? options : func var args = [...arguments]
options = options instanceof Function ? {} : options func = args.pop()
options = args.pop() || {}
if(typeof(options) == typeof(123)){ if(typeof(options) == typeof(123)){
options.timeout = options options.timeout = options
@ -903,7 +909,8 @@ function(options, func){
} }
f.toString = function(){ f.toString = function(){
return `// debounced...\n${doc([func.toString()])}` return `// debounced...\n${
doc([ func instanceof Function ? func.toString() : func ])}`
} }
return f return f

View File

@ -59,9 +59,8 @@ var ExampleActions = actions.Actions({
console.log(' <', args) console.log(' <', args)
return args return args
})], })],
exampleAliasDebounced: ['Test/',
testDebounce: ['Test/', core.debounce(1000, 'exampleAction: ...')],
core.debounce(1000, 'exampleAction: ... -- docs...')],
// a normal method... // a normal method...
exampleMethod: function(){ exampleMethod: function(){

View File

@ -1141,9 +1141,9 @@
"integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
}, },
"ig-actions": { "ig-actions": {
"version": "3.20.1", "version": "3.20.2",
"resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.20.1.tgz", "resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.20.2.tgz",
"integrity": "sha512-eLQBRwHE+XSkYBbxH15cDIzPbVX8mMoyROyLe9HsEQCiX4bCAsyHRI+Gh6i3f30PyI4evTxHPSI+WiGZXXZGMA==", "integrity": "sha512-B6tyFOgtg+9Pks8rtq0BgnDsU2kUbRm56/fCEOTeozCanl9Lm7atiKFa5ZonglzDdMLZpiXffLYW0vbYVgy9zw==",
"requires": { "requires": {
"ig-object": "^1.0.7" "ig-object": "^1.0.7"
} }

View File

@ -26,7 +26,7 @@
"fs-walk": "^0.0.1", "fs-walk": "^0.0.1",
"glob": "^4.0.6", "glob": "^4.0.6",
"guarantee-events": "^1.0.0", "guarantee-events": "^1.0.0",
"ig-actions": "^3.20.1", "ig-actions": "^3.20.2",
"ig-features": "^3.3.4", "ig-features": "^3.3.4",
"ig-object": "^1.0.7", "ig-object": "^1.0.7",
"moment": "^2.22.2", "moment": "^2.22.2",