Skip to content

Commit

Permalink
Remove call and add basename
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed Dec 21, 2024
1 parent 87ff750 commit 86bdfb0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions extensions/web-base/www/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,10 @@ var homePage = new Vue({
]).then(apply(this, function(schemaData, configData) {
this.schema = schemaData;
this.config = configData.value;
})).catch(call(this, function() {
})).catch(function() {
this.schema = false;
this.config = {};
}));
}.bind(this));
},
backup: function() {
var self = this;
Expand Down
4 changes: 2 additions & 2 deletions extensions/web-base/www/app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ function onShowExtension(extensionId) {
this.schema = false;
}
this.extension = extension;
})).catch(call(this, function() {
})).catch(function() {
this.schema = false;
this.extension = {config: {}, info: {}, manifest: {}};
}));
}.bind(this));
}

new Vue({
Expand Down
17 changes: 13 additions & 4 deletions extensions/web-base/www/app/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function apply(to, fn) {
}

function call(to, fn) {
console.warn('call is deprecated, please use bind', new Error());
return function() {
return fn.apply(to, arguments);
};
Expand Down Expand Up @@ -197,13 +198,21 @@ function startsWith(value, search, position) {
return value.substring(position, position + search.length) === search;
}

function extname(path, invert) {
function basename(path, invert) {
var slashIndex = path.lastIndexOf('/');
var dotIndex = path.lastIndexOf('.');
if (invert) {
return dotIndex <= slashIndex ? path : path.substring(0, dotIndex);
return slashIndex < 0 ? '' : path.substring(0, slashIndex);
}
return slashIndex < 0 ? path : path.substring(slashIndex + 1);
}

function extname(path, invert) {
var name = basename(path);
var dotIndex = name.lastIndexOf('.');
if (invert) {
return dotIndex < 0 ? name : name.substring(0, dotIndex);
}
return dotIndex <= slashIndex ? '' : path.substring(dotIndex + 1);
return dotIndex < 0 ? '' : name.substring(dotIndex + 1);
}

function getJson(response) {
Expand Down

0 comments on commit 86bdfb0

Please sign in to comment.