mirror of
https://github.com/gnh1201/welsonjs.git
synced 2026-02-15 15:18:26 +00:00
Intoduce UseObject(<string>, <function>) in app.js
Intoduce UseObject(<string>, <function>) in app.js
This commit is contained in:
parent
fe74f360d9
commit
1398c1b359
15
app.js
15
app.js
|
|
@ -187,6 +187,17 @@ if (typeof CreateObject === "undefined") {
|
|||
};
|
||||
}
|
||||
|
||||
if (typeof UseObject === "undefined") {
|
||||
var UseObject = function(progId, callback) {
|
||||
var obj = CreateObject(progId);
|
||||
try {
|
||||
return callback(obj);
|
||||
} finally {
|
||||
obj = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @FN {string} The name of the file.
|
||||
*/
|
||||
|
|
@ -283,7 +294,9 @@ function require(pathname) {
|
|||
return filename;
|
||||
})({
|
||||
existsSync: function(filename) {
|
||||
return CreateObject("Scripting.FileSystemObject").FileExists(filename);
|
||||
return UseObject("Scripting.FileSystemObject", function(fso) {
|
||||
return fso.FileExists(filename);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
join: function() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user