vue-computed-promise
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"src_folders" : ["tests"], | ||
"output_folder" : "reports", | ||
"custom_commands_path" : "", | ||
"custom_assertions_path" : "", | ||
"page_objects_path" : "", | ||
"globals_path" : "", | ||
"src_folders" : ["tests"], | ||
"output_folder" : "reports", | ||
"custom_commands_path" : "", | ||
"custom_assertions_path" : "", | ||
"page_objects_path" : "", | ||
"globals_path" : "", | ||
"selenium" : { | ||
"start_process" : true, | ||
"server_path" : "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.3.1.jar", | ||
"log_path" : "", | ||
"port" : 4444, | ||
"cli_args" : { | ||
"webdriver.chrome.driver" : "", | ||
"webdriver.gecko.driver" : "node_modules/geckodriver/bin/geckodriver", | ||
"webdriver.edge.driver" : "" | ||
} | ||
}, | ||
"selenium" : { | ||
"start_process" : true, | ||
"server_path" : "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.4.0.jar", | ||
"log_path" : "", | ||
"port" : 4444, | ||
"cli_args" : { | ||
"webdriver.chrome.driver" : "", | ||
"webdriver.gecko.driver" : "node_modules/geckodriver/bin/geckodriver", | ||
"webdriver.edge.driver" : "" | ||
} | ||
}, | ||
"test_settings" : { | ||
"default" : { | ||
"launch_url" : "http://localhost", | ||
"selenium_port" : 4444, | ||
"selenium_host" : "localhost", | ||
"silent": true, | ||
"screenshots" : { | ||
"enabled" : false, | ||
"path" : "" | ||
}, | ||
"desiredCapabilities": { | ||
"browserName": "firefox", | ||
"marionette": true | ||
} | ||
}, | ||
"test_settings" : { | ||
"default" : { | ||
"launch_url" : "http://localhost", | ||
"selenium_port" : 4444, | ||
"selenium_host" : "localhost", | ||
"silent": true, | ||
"screenshots" : { | ||
"enabled" : false, | ||
"path" : "" | ||
}, | ||
"desiredCapabilities": { | ||
"browserName": "firefox", | ||
"marionette": true | ||
} | ||
}, | ||
"chrome" : { | ||
"desiredCapabilities": { | ||
"browserName": "chrome" | ||
} | ||
}, | ||
"chrome" : { | ||
"desiredCapabilities": { | ||
"browserName": "chrome" | ||
} | ||
}, | ||
"edge" : { | ||
"desiredCapabilities": { | ||
"browserName": "MicrosoftEdge" | ||
} | ||
} | ||
} | ||
} | ||
"edge" : { | ||
"desiredCapabilities": { | ||
"browserName": "MicrosoftEdge" | ||
} | ||
} | ||
} | ||
} |
{ | ||
"name": "vue-computed-promise", | ||
"version": "1.0.2", | ||
"description": "Plugin for Vue.js, allows promises to be returned for computed properties", | ||
"main": "vue-computed-promise.js", | ||
"scripts": { | ||
"test": "node_modules/nightwatch/bin/nightwatch" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Polarisation/vue-computed-promise.git" | ||
}, | ||
"keywords": [ | ||
"vuejs", | ||
"promise" | ||
], | ||
"author": "Justin Emery", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/Polarisation/vue-computed-promise/issues" | ||
}, | ||
"homepage": "https://github.com/Polarisation/vue-computed-promise#readme", | ||
"devDependencies": { | ||
"geckodriver": "^1.4.0", | ||
"nightwatch": "^0.9.14", | ||
"selenium-server-standalone-jar": "3.3.1" | ||
}, | ||
"dependencies": {} | ||
"name": "vue-computed-promise", | ||
"version": "1.0.3", | ||
"description": "Plugin for Vue.js, allows promises to be returned for computed properties", | ||
"main": "vue-computed-promise.js", | ||
"scripts": { | ||
"test": "node_modules/nightwatch/bin/nightwatch" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Polarisation/vue-computed-promise.git" | ||
}, | ||
"keywords": [ | ||
"vuejs", | ||
"promise" | ||
], | ||
"author": "Justin Emery", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/Polarisation/vue-computed-promise/issues" | ||
}, | ||
"homepage": "https://github.com/Polarisation/vue-computed-promise#readme", | ||
"devDependencies": { | ||
"geckodriver": "^1.8.0", | ||
"nightwatch": "^0.9.16", | ||
"selenium-server-standalone-jar": "3.4.0" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -50,3 +50,3 @@ # vue-computed-promise | ||
To return a Promise which may be re-computed when reactive dependencies change, you will need to return a function which in turn returns a Promise: | ||
To return a Promise which may be re-computed when reactive dependencies change, you will need to return a parameter-less function which in turn returns a Promise: | ||
@@ -53,0 +53,0 @@ ``` |
@@ -18,2 +18,2 @@ module.exports = { | ||
} | ||
} | ||
} |
@@ -16,14 +16,14 @@ (function (global, factory) { | ||
this.$options.data = function() { | ||
let newData = ( | ||
(typeof oldData === 'function') | ||
? oldData.call(this) | ||
: oldData | ||
) || {}; | ||
Object.keys(oldComputed).forEach(key => { | ||
newData[key + "VueComputedPromisePlaceholder"] = null; | ||
}) | ||
return newData; | ||
let newData = ( | ||
(typeof oldData === 'function') | ||
? oldData.call(this) | ||
: oldData | ||
) || {}; | ||
Object.keys(oldComputed).forEach(key => { | ||
newData[key + "VueComputedPromisePlaceholder"] = null; | ||
}) | ||
return newData; | ||
}; | ||
// wrap computed properties | ||
// wrap computed properties | ||
this.$options.computed = {}; | ||
@@ -42,16 +42,16 @@ Object.keys(oldComputed).forEach(key => { | ||
if(result && typeof result === "function") { | ||
if(result && typeof result === "function" && result.length === 0) { | ||
if(!promiseInitiated) { | ||
promiseInitiated = true; | ||
var promise = result(); | ||
if(promise && promise.then && promise.catch) { // looks like a Promise | ||
// var oldValue = data[key + "VueComputedPromisePlaceholder"]; | ||
promise.then(r => { | ||
data[key + "VueComputedPromisePlaceholder"] = r; | ||
}); | ||
// return placeholder until Promise result is ready | ||
return data[key + "VueComputedPromisePlaceholder"]; | ||
} else { // not actually a promise | ||
throw new Error("VueComputedPromise: "+key+" function returned must return a Promise"); | ||
} | ||
var promise = result(); | ||
if(promise && promise.then && promise.catch) { // looks like a Promise | ||
// var oldValue = data[key + "VueComputedPromisePlaceholder"]; | ||
promise.then(r => { | ||
data[key + "VueComputedPromisePlaceholder"] = r; | ||
}); | ||
// return placeholder until Promise result is ready | ||
return data[key + "VueComputedPromisePlaceholder"]; | ||
} else { // not actually a promise | ||
throw new Error("VueComputedPromise: "+key+" function returned must return a Promise"); | ||
} | ||
} else { | ||
@@ -61,9 +61,9 @@ promiseInitiated = false; | ||
} | ||
} | ||
} | ||
if(result && result.then && result.catch) { // looks like a Promise | ||
if(result && result.then && result.catch) { // looks like a Promise | ||
result.then(r => { | ||
oldComputed[key] = () => r; // ensure promise will not be called in loop | ||
// overwrite placeholder with final result of Promise | ||
// overwrite placeholder with final result of Promise | ||
data[key + "VueComputedPromisePlaceholder"] = r; | ||
@@ -75,3 +75,3 @@ }) | ||
else // standard vue behavior | ||
else // standard vue behavior | ||
return result; | ||
@@ -78,0 +78,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136
10565