Skip to content

Latest commit

 

History

History

example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Example

A example code for @jxa packages.

Usage

import "@jxa/global-type";
import { run } from "@jxa/run";

/**
 * get safari version
 * This function execute JXA code
 */
export const safariVersion = () => {
    return run(() => {
        const Safari = Application("Safari");
        return Safari.version();
    });
};

/**
 * get current mac system user
 * This function execute JXA code
 */
export const currentUserName = () => {
    return run(() => {
        const sys = Application("System Events");
        return sys.currentUser().name();
    });
};

// This main is just a Node.js code
export const example = async () => {
    const version = await safariVersion();
    const userName = await currentUserName();
    return `User: ${userName}, Safari: ${version}`;
};

Run example

yarn 
yarn run build
node lib/cli.js

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu