Giter Site home page Giter Site logo

Split sheet from notify? about macgap2 HOT 8 CLOSED

jeff-h avatar jeff-h commented on September 13, 2024
Split sheet from notify?

from macgap2.

Comments (8)

rawcreative avatar rawcreative commented on September 13, 2024

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 than

MacGap.Notice.nofify({
'type' : 'sheet',
...
});

Reply to this email directly or view it on GitHub.

from macgap2.

jeff-h avatar jeff-h commented on September 13, 2024

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.

perifer avatar perifer commented on September 13, 2024

@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.

jeff-h avatar jeff-h commented on September 13, 2024

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.

rawcreative avatar rawcreative commented on September 13, 2024

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.

jeff-h avatar jeff-h commented on September 13, 2024

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.

rawcreative avatar rawcreative commented on September 13, 2024

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.

jeff-h avatar jeff-h commented on September 13, 2024

Thanks — docs updated.

from macgap2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.