Created
November 14, 2019 11:39
-
-
Save dlashua/0a893c73baa5997e62669a4b86c0e069 to your computer and use it in GitHub Desktop.
Example App Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Events | |
class OtherApp: | |
def initialize(self): | |
self.fire_event('spotify.start', volume=100) | |
# Using get_app() | |
class OtherApp: | |
def initialize(self): | |
self.get_app('start_spotify').start(volume=100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using Events | |
class StartSpotify: | |
def initialize(self): | |
self.listen_event(self.start, event="spotify.start") | |
def start(self, event, event_data, kwargs): | |
volume = event_data.get('volume', 0) | |
self.spotify_thing(volume=volume) | |
# Using get_app() | |
class StartSpotify: | |
def initialize(self): | |
pass | |
def start(self, volume=0): | |
self.spotify_thing(volume=volume) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment