Comments (10)
All global names (osascript -l JavaScript <<< 'Object.getOwnPropertyNames(this)' 2>&1 | tr ',' $'\n' | sort -u | pbcopy
):
$
Application
Array
ArrayBuffer
Automation
Boolean
DataView
Date
Error
EvalError
Float32Array
Float64Array
Function
Infinity
Int16Array
Int32Array
Int8Array
JSON
Library
Map
Math
Number
ObjC
Object
ObjectSpecifier
Path
Progress
RangeError
Ref
ReferenceError
RegExp
Set
String
Symbol
SyntaxError
TypeError
URIError
Uint16Array
Uint32Array
Uint8Array
Uint8ClampedArray
WeakMap
WeakSet
__private__
console
decodeURI
decodeURIComponent
delay
encodeURI
encodeURIComponent
escape
eval
isFinite
isNaN
parseFloat
parseInt
undefined
unescape
NaN
from jxa-cookbook.
Great (well not great since there seems to be stuff missing from ECMAScript)
Thanks
from jxa-cookbook.
setTimeout
and others are part of the HTML5 standard, where they live on the window
DOM object, which is not part of ECMAScript.
The equivalent is not delay
because delay
is synchronous.
Like any other non-web environment, you need the system equivalent. Those are things like select()
and kqueue()
in C. How you get those in and call them properly is a bit of trial and error, but I would like to see a shim of setTimeout()/setInterval() via C calls if you end up making one.
from jxa-cookbook.
@Tatsh
FYI, I ended up with NSTimer
based implementation for shimming setTimeout
, etc.
https://gist.github.com/umireon/d1d449be666053b005e48db48aad6c46
from jxa-cookbook.
Very neat. If that's up to the standards of the Wiki code, you can add that in for those who want to use it.
from jxa-cookbook.
There are still many things missing to make this compatible with (web) JavaScript without DOM stuff. Just a few things:
atob
btoa
crypto
File
FileList
FileReader
from jxa-cookbook.
FYI, I ended up with NSTimer based implementation for shimming setTimeout, etc.
https://gist.github.com/umireon/d1d449be666053b005e48db48aad6c46
@umireon , thanks for sharing this.
For those of us not well-versed in ObjC, can you please give us a JXA example of how this is used, should be used?
How does it compare with the AppleScript delay()
?
Thanks.
from jxa-cookbook.
how this is used, should be used?
My answer on SO would help.
https://stackoverflow.com/questions/37834749/settimout-with-javascript-for-automation/41087510#41087510
How does it compare with the AppleScript delay()?
delay()
is blocking and mine is non-blocking.
IMO, delay()
suffices in usual situations.
from jxa-cookbook.
@umireon Nice! just a couple of days ago before seeing this issue, I added a stub for a new section in the ObjC Bridge page of the wiki about asynchronous functions calls through
from jxa-cookbook.
Closing due to age.
from jxa-cookbook.
Related Issues (20)
- Possible to intercept http link clicks from an app?? HOT 3
- better integrating Objective-C Bridge documentation + proposed expansions HOT 6
- JXA chat network HOT 1
- Problems with Mojave? HOT 20
- Can't import a custom framework HOT 4
- Using IconRef HOT 2
- How can I create a http request with JXA? HOT 5
- How to copy image or file to clipboard? HOT 15
- Integrating with JXA-Snippets example scripts HOT 1
- Object specifiers and Apple Music HOT 4
- How do you get a random number in JXA? HOT 2
- How to make FSEventStream Work HOT 4
- NSInvalidArgumentException: NSGetSizeAndAlignment(): unsupported type encoding spec 'G' at 'GPoint}"size"{CGSize}}' in '{CGPoint}"size"{CGSize}}' HOT 7
- Arrow functions now work in shebang files HOT 2
- Please state a license for use/reuse of the text
- How do I initialize a pointer to a specific C struct? HOT 3
- Mismatched method names in ObjC example
- writeToFileAtomicallyEncodingError has "getFileSystemRepresentation:maxLength"
- Add Missing Event Function `GURLGURL` (JXA-equivalent of `open location`)
- Library impoting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jxa-cookbook.