Comments (8)
It’s not a configurable sheet, it’s only a setting to use the sheet type of notification (NSAlert) rather than the notification center..
On Jun 15, 2014, at 7:46 PM, jeff-h [email protected] wrote:
I wonder if it would be easier to find the sheet-creation ability if it were in its own top-level command? I didn't expect to find it on the Notify command.
i.e.
MacGap.Sheet(...);
rather thanMacGap.Notice.nofify({
'type' : 'sheet',
...
});
—
Reply to this email directly or view it on GitHub.
from macgap2.
Ah, I see. I still don't feel the connection to notification centre is very strong. Could we provide an optional arg to our implementation of the JavaScript alert() command perhaps?
Also, in my documentation creation, I wasn't able to work out how to actually call the notification stuff. Would you mind giving me a tiny example when you have a moment?
from macgap2.
@jeff-h, you mean displaying a notification? This worked for me:
MacGap.hide(); // Hide since notification popup only show if the application is in background.
MacGap.Notify.notify({title: 'A title', content: 'Some content.'});
MacGap.unhide() didn't seem to work though (which would be logical to use in an example).
from macgap2.
Weird, thanks for that — it looks exactly like what I tried, but your code works for me. Not sure what I had wrong.
MacGap.Notify.notify({
type: 'sheet',
title: 'A title',
content: 'Some content.'
});
...also works. I still feel this API should somehow be tied in with alert();
Also, the double notify
i.e. Notify.notify()
seems redundant, although I understand why it's there from an Obj-C point of view. Is there any way around it?
from macgap2.
There's no need to hide the app to get the notification to pop up, the notice command in MacGap1 did not include to the code to allow notifications to always show, so they only were shown when the app was hidden.
As for moving the sheet to the js alert() function, you can't pass arguments to the alert() function, only the alert message that is to be displayed. This means that while it's possible to show a sheet instead of the regular alert pop-up, you can't do both, it's either one or the other for all instances of alert().
The Notify command is meant to be a means to handle notifying users of something, there's multiple ways to do that in an app, so I don't see why it would need to solely be for notification center messages. As for the notify() method itself, yeah it's redundant, since the class only has one command, it can just be moved to the App class and be part of the MG object itself.
from macgap2.
Thanks for clarifying things — I've tidied the docs accordingly.
Re: the redundant notify() method, do you think we may end up adding more kinds of notifications that would need their own command? I can't think of any particularly, and since you're accepting a dictionary as the arg and are already switching on type
it looks pretty safe to roll into the App command. However, I'm certainly happy to leave it as-is if you think it's better long-term.
from macgap2.
I added a notify method to the App command yesterday, along with a sound flag to disable the sound if desired, default is on. I left the notify command in place temporarily just for backwards compat so it wasn't a breaking change immediately, but note it in the docs that Notify has been deprecated and will be removed and to use MacGap.notify() instead.
from macgap2.
Thanks — docs updated.
from macgap2.
Related Issues (20)
- Help/Q - ReferenceError: Can't find variable: macgap HOT 1
- My app not closed HOT 1
- Support for macOS Big Sur HOT 1
- Signing my App for Appstore distribution HOT 3
- Transparent titlebar seems not work on Big Sur
- Persistent Cookies
- Contribution? HOT 4
- Commands from Obj-C to JS and vice-versa?
- is it possible to allow generic HTML5 notifications by default? HOT 8
- Invalidated connection to com.apple.nsurlstorage-cache
- Refreshing app doesn't reload javascript or html files
- NSURLConnection finished with error - code -1100
- Download a file via HTML5 Blob API: Failed to get remote object proxy HOT 2
- can't use html input element which is under toolbar HOT 1
- Any plans for FFI? HOT 1
- MacGap bad behaviour in Mojave 10.14.4 beta HOT 1
- macOS Catalina support? HOT 2
- Remember passwords? HOT 2
- Flashing top bar while scrolling HOT 6
- How to modify the scrollbar color? HOT 2
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 macgap2.