How to get OS type in JS without callback wrapper

New Here ,
Jan 26, 2021

Copy link to clipboard

Copied

Hi, i want to get OS type without callback wrapper

 

let say in JS code if i do

 

getOStype(); // it should give either MAC or Windows

 

QUESTION: i want to avoid callback wrapper  

getOStype(function(ostype){
    //os type
});

 

Here is how i'm doing 

.jsx file

 

$._QEPPRO_={
     getOStype: function(){
         if (Folder.fs == 'Macintosh') {
            return 'MAC'
        } else {
            return 'WINDOWS';
        }
     }
};

var csInterface = new CSInterface();
csInterface.evalScript('$._QEPPRO_.getOStype()',function(osType){
      // osType
});

 

TOPICS
How to, SDK

Views

92

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Explorer , Jan 27, 2021
Ivan Stepanov Explorer , Jan 27, 2021
console.log(process.platform); // returns "darwin" for mac // returns "win32" for win // I think you should have nodejs enabled in manifest.xml var csInterface = new CSInterface(); // console.log(csInterface.getOSInformation()); // mac example: "Mac OS X 10.14.6" // win example: "Windows 10 64-bit"

Likes

Translate

Translate
Jump to answer Jump to answer
Explorer ,
Jan 27, 2021

Copy link to clipboard

Copied

console.log(process.platform);
// returns "darwin" for mac
// returns "win32" for win
// I think you should have nodejs enabled in manifest.xml

var csInterface = new CSInterface(); //
console.log(csInterface.getOSInformation());
// mac example: "Mac OS X 10.14.6"
// win example: "Windows 10 64-bit"

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more