Giter Club home page Giter Club logo

Comments (5)

mlw avatar mlw commented on June 9, 2024 7

I dug through a bit of the docs you linked to and agree that it doesn't seem possible to set with the currently exposed electron API. We've discussed this internally and don't think we have any major reservations to add deliverImmediately. Will get a PR up soon.

from santa.

mlw avatar mlw commented on June 9, 2024 1

On the surface this seems maybe ok, though I am admittedly not super familiar with details on how distributed notifications work and have some minor concerns.

The documentation for Posting Distributed Notifications has some interesting tidbits:

An observer of a given notification may be in a suspended state and not processing notifications immediately. If an object posting a notification wants to ensure that all observers receive the notification immediately (for example, if the notification is a warning that a server is about to shut down), it can invoke postNotificationName:object:userInfo:deliverImmediately: with deliverImmediately:YES. The notification center delivers the notification as if the observers had registered with NSNotificationSuspensionBehaviorDeliverImmediately

(emphasis on that final sentence)

Looking into documentation for Registering for Distributed Notifications:

NSNotificationSuspensionBehaviorDeliverImmediately: The server delivers notifications matching this registration irrespective of whether it has received the setSuspended:YES message. When a notification with this suspension behavior is matched, it has the effect of first flushing any queued notifications. The effect is as if the server received setSuspended:NO while the application is suspended, followed by the notification in question being delivered, followed by a transition back to the previous suspended or unsuspended state.

Can you test if you get the desired behavior by setting the appropriate suspensionBehavior? If so this would likely be preferable rather than Santa forcing delivery.

from santa.

jamiestrachan-shopify avatar jamiestrachan-shopify commented on June 9, 2024

Thanks for the response!
I am looking, but so far I am not sure I can set the suspensionBehavior inside electron.

from santa.

jamiestrachan-shopify avatar jamiestrachan-shopify commented on June 9, 2024

Here is what I have found out:

The Electron code to register for a notification is here.
It is using the addObserverForName method.

As noted in the discussion, that method uses NSNotificationSuspensionBehaviorCoalesce for the suspensionBehaviour.

Still looking...

from santa.

jamiestrachan-shopify avatar jamiestrachan-shopify commented on June 9, 2024

Wow! Thanks very much!

from santa.

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.