Service Interface
Last updated
Was this helpful?
Was this helpful?
function implement(implementations)var helloAppService = SYMPHONY.services.register("hello:app");
helloAppService.implement({
helloWorld: function() {
console.log("Hello World!");
}
});function invoke(methodName, ...)var helloAppService = SYMPHONY.services.register("hello:app");
helloAppService.implement("helloWorld", function() {
console.log("Hello World!");
});
helloAppService.invoke("helloWorld");function fire(eventName, ...)var helloAppService = SYMPHONY.services.register("hello:app");
helloAppService.fire('myEvent');function listen(eventName, callback)var uiService = SYMPHONY.services.subscribe("ui");
// themeChangeV2 is an event fired by the UI service when the user changes his theme or font. The themeV2 object which contains the theme name and font size is also passed along with the event.
uiService.listen("themeChangeV2", function() {
themeColor = data.themeV2.name;
themeSize = data.themeV2.size;
console.log("The user changed his theme color to " + themeColor " and font size to " + themeSize ".");
});function remove(eventName, handle)var uiService = SYMPHONY.services.subscribe("ui");
// themeChangeV2 is an event fired by the UI service when the user changes his theme or font. The themeV2 object which contains the theme name and font size is also passed along with the event.
var handle = uiService.listen("themeChangeV2", function() {
themeColor = data.themeV2.name;
themeSize = data.themeV2.size;
// Styling is achieved by specifying the appropriate classes on the app module's body element.
document.body.className = "symphony-external-app " + themeColor + " " + themeSize;
console.log("The user changed his theme color to " + themeColor " and font size to " + themeSize ".");
});
uiService.remove("themeChangeV2", handle);