• Stars
    star
    953
  • Rank 47,732 (Top 1.0 %)
  • Language
  • Created about 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Example OS X applications written in JavaScript.

JavaScript OS X App Examples

Updates

06/15 - OS X 10.11 Release Notes

OS X 10.11 includes a number of updates to JSX https://developer.apple.com/library/prerelease/mac/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/OSX10-11.html#//apple_ref/doc/uid/TP40014508-CH110-SW1

Sandboxing info: https://developer.apple.com/library/prerelease/mac/qa/qa1888/_index.html#//apple_ref/doc/uid/DTS40015156

09/02/14 - YOSEMITE DEVELOPER PREVIEW 7 NOTE:

Developer preview 7 has fixed the major issues that were in dev preview 5. All of the demos are working again.

I updated the Radar: http://openradar.appspot.com/radar?id=6472227281174528

08/14/14 - YOSEMITE DEVELOPER PREVIEW 5/6 NOTE:

A good number of the demos are crashing. Any demo that has a button that you can click that does something will crash. (HandleBtnClick, NSOpenPanel, etc.)

I have a question up on the Apple dev forums: https://devforums.apple.com/thread/240935?tstart=150

I've submitted a bug to Apple, and it's copied on Radar: http://openradar.appspot.com/radar?id=6472227281174528

What is this?

Starting with OS X 10.10, Yosemite you can use JavaScript to create native Cocoa applications. I wrote a big ole post to help get you started.

This is a collection of examples showing how to create many of the common components used in OS X Applications. The goal is to help people learn how to build apps by showing clear, atomic examples.

These aren't exhaustive examples. Most of them are as basic as possible. The idea isn't to show everything that can be done, it's to give a solid foundation to get you started.

Running

You can run any of the example apps by double clicking them.

If you are running the app while editing from Script Editor, there are two different ways. Script > Run (cmd + r) is the normal run. This can be good for quick debugging, but the app will not act like the application and is usually not what you want. You'll want Script > Run Application (cmd + opt + r).

Editing

To view and edit the code for each example you will need to use the Script Editor application. It is located in Applications > Utilities > Script Editor. From there you can either File > Open any of the example apps or drag the example app icon to the Script Editor in the dock.

How to create an app

Since using JavaScript to create apps is new there's not much documentation. We've had the ability to do all of this with AppleScript for years, but I haven't had much luck finding thorough docs on that either.

Here's a couple of gotchas that had me scratching my head for some time.

To create a new application:

  • Open a new document in Script Editor cmd+n
  • Save the document cmd+s
  • When prompted with the Save dialog, name your app, set the file format to Application, and make sure you check the Stay open after run handler option.

NOTE: If you do not check the Stay open... option on the save dialog there does not appear to be a way to update this later. (I hope I'm wrong, but haven't found a way to do it yet). If the option isn't checked pretty much nothing is going to work how you expect it.

Code Signing

Apps created this way can be code signed. Signing your app is helpful if you are planning to distribute it to other people. Code Signing is a broad topic, for details check out http://macosxautomation.com/mavericks/codesign/index.html

Reference

JavaScript for Automation Release Notes

Check out the WWDC presentation on JavaScript for Automation You'll need an Apple Developer Account.

More Repositories

1

icon-stamper

A Sketch Plugin for creating multiple sizes of iOS icons
501
star
2

day-player

A Sketch Plugin for creating placeholder images from online services.
JavaScript
391
star
3

colorme

Visualize CSS Color Functions?
JavaScript
316
star
4

jribbble

A JavaScript library for the Dribbble API
JavaScript
304
star
5

css-shaky-animation

Shits shakin' yo
CSS
286
star
6

css-true-titles

CSS Title Sequence in the style of True Detective
CSS
80
star
7

skribbble

Sketch plugins for getting shots and info from Dribbble
JavaScript
50
star
8

themanfromhollywood

CSS Kinetic typography experiment
CSS
38
star
9

css-animated-sprites

Goofy CSS shit
CSS
31
star
10

media-query-events

Script to add a MatchMedia event for each media query in a page's stylesheets
JavaScript
29
star
11

starstuff

A UI library for JXA
JavaScript
18
star
12

css-write-on

CSS Write-on text effect
CSS
15
star
13

slenderman

A poorly drawn typeface
CSS
14
star
14

tylergaw.com

My personal website since 2006
Nunjucks
14
star
15

netlify-cms-github-oauth-provider-server-example

A working example of a custom GitHub OAuth Provider for NetlifyCMS.
JavaScript
14
star
16

css-slideshows

Revolving image galleries using CSS animations and a bit of trickery.
CSS
13
star
17

mpa-view-transitions-sandbox

A collection of example view transitions for multi-page sites
HTML
12
star
18

sketch-generate-posts

A WIP Sketch Plugin to generate blog post elements from JSON'd RSS feeds
10
star
19

astro-example-i18next

An opinionated approach to translation with Astro and i18next.
JavaScript
10
star
20

jquery.dragsort

jQuery native drag and drop plugin
JavaScript
7
star
21

netlify-cms-github-oauth-provider-client-example

A working example of a custom GitHub OAuth Provider for NetlifyCMS.
HTML
7
star
22

jribbble-no-dependencies

A jQuery-free version of Jribbble
JavaScript
7
star
23

colormix.site

Visualize the CSS color-mix function
Astro
6
star
24

RNUpgradePath

An example repo for getting RN 0.57.x working
JavaScript
4
star
25

papersaver

A place to self-host drawings from Paper on the Web.
JavaScript
4
star
26

againwiththis

A site of little life reminders. I am dumb.
CSS
4
star
27

fullcourtshots

An at-a-glance Dribbble shot viewer
JavaScript
4
star
28

css-gradient-transition-sorta

Semi-transparent gradient transition?
HTML
4
star
29

jribbble.com

Demo page for jquery.jribbble
CSS
3
star
30

jxa-build-process

A partially complete front-end tooling process for JXA stuffs
JavaScript
3
star
31

css-blend-modes

Playing with CSS blend modes and filters
3
star
32

webvtt-cuemarker

A super simple helper for creating WebVTT cue times for HTML video elements
JavaScript
3
star
33

5secondbookmarklet

A bookmarklet for viewing 5 second films
JavaScript
3
star
34

html5forms

Experimenting with new (in 2011) html form features.
CSS
3
star
35

dicomr

A web application for uploading and viewing DICOM images. (built for an interview process)
Python
2
star
36

triple-dare

My entry for The Unmatched Style CSS Off 2011
CSS
2
star
37

rushmore.fm

There used to be a great little music community here. Maybe there will be again.
HTML
2
star
38

media-seek-from-url

Seek to a time in a audio or video element using a URL query parameter.
JavaScript
2
star
39

astro-react-client-only-bug-example

Created with StackBlitz ⚡️
JavaScript
2
star
40

thisdesignisart.com

Another drunk idea and domain purchase. Let's see if I actually build this one.
2
star
41

node-test-runner-demo

A small demo of the native node test runner
JavaScript
1
star
42

custombodyworks

Karma Gaw's business website
JavaScript
1
star
43

ios-add-to-readability

1
star
44

bowlinggreenmo

My 1st Website
CSS
1
star
45

dem-2020-candidate-websites

Nerd stats and thoughts about 2020 Democratic Presidential Candidate Websites
1
star
46

building-firefox-addons

An attempt to organize some decent docs and examples for building Firefox Add-ons
1
star
47

bigtrip

Itinerary for a big trip. This code is bad, but I don't feel bad.
JavaScript
1
star
48

pigwithshitonballs.com

A pig with shit on his balls
HTML
1
star
49

whatsgoingonwithcss

A presentation on new features in CSS3
HTML
1
star
50

supporters-python-twilio

An example of signing up new Supporters using The Groundwork API through SMS and a Flask Application
Python
1
star
51

froogaloop-rdb-tester

CSS
1
star
52

anthologies

Hold on to something.
HTML
1
star
53

vacation

Ruby
1
star
54

chrisgeth.com

In progress
CSS
1
star
55

mycoffeespoon

Photographer website
JavaScript
1
star
56

begin-svelte-app

Begin app
JavaScript
1
star
57

astro-icon-issue-1-example

An isolated example of an issue i'm seeing with astro-icon
Astro
1
star
58

borrowers

ember-cli-101 book example app
JavaScript
1
star
59

contentful-metalsmith-feeds

Metalsmith plugin to generate RSS and JSON feeds from Contentful posts.
JavaScript
1
star
60

svg-track-matte

SVG Video Masks
Ruby
1
star
61

astro-keyframes-issue-example

An isolated example of an issue I'm seeing with @keyframes in Astro 0.21+
Astro
1
star
62

supporters-python-flask

An example of signing up new Supporters using The Groundwork API through a Flask application.
Python
1
star
63

timebomb

A script to download songs from http://timtimebomb.com. Don't tell Tim, I think he'd be pissed and punch me in the throat
Python
1
star
64

wax

A record collection viewer
Astro
1
star