kfix / MacPin

a webapp container & site specific browser made from WebKit.swift and JavaScriptCore
GNU General Public License v3.0
331 stars 27 forks source link

refactor JS API #11

Closed kfix closed 5 years ago

kfix commented 8 years ago

Most of the API surface I want to use & support is now exposed, but its a bit clunky.

delegate:

$ is also vague and intones jQuery.

kfix commented 8 years ago

extend and JSExport NSURL()s as URL(), behaving roughly like the URL() in most browser DOMs. That would standardize all the delegate methods and launch()

JS polyfills:

kfix commented 8 years ago

this could be handy for aliasing some exported methods: https://gist.github.com/zeitiger/1387f7d996f64b493608

kfix commented 8 years ago

support fetch API instead of XMLHttpRequest??

kfix commented 8 years ago

Its possible to renamed exported vars/funcs with @objc(betterJSName:) and exclude overloads with @nonobjc https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html#//apple_ref/doc/uid/TP40014216-CH4-ID55

kfix commented 8 years ago

another URI lib: https://github.com/medialize/URI.js Consider including SystemJS/jspm, and allowing module loads before MacPin API is extended in.

kfix commented 8 years ago

a good listing of available JS features: https://webkit.org/status/

kfix commented 8 years ago

Chrome's chrome.tabs API is not synchronous at all. Safari's is but doesn't support .push()ing a tab.

Both fire events for tab actions.

kfix commented 8 years ago

rather than app.js having to explicitly return an object that will become the jsdelegate, this should just be that object.

kfix commented 8 years ago

Firefox is going to support a majority of Chrome's API as 'chrome.'

https://github.com/mdn/webextensions-examples

kfix commented 7 years ago

expose NSUserDefaults to app.js as localStorage()

kfix commented 7 years ago

URL() is being added to WebCore (yay!) hopefully for Safari 10 macgap: https://github.com/MacGapProject/MacGap1/wiki/API-Reference

kfix commented 7 years ago

nodejs APIs can be shimmed in: https://github.com/nodekit-io/nodekit-darwin