OpenFin Notifications #7
OpenFin Notifications #7
Conversation
packages/api-openfin/README.md
Outdated
npm install ssf-desktop-api-openfin --save | ||
``` | ||
|
||
You need to include this code into the project by loading the javascript file directly (as Openfin does not support preloading). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaScript
OpenFin
Yes, I really am that pedantic!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beat me to it! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from a very pedantic comment about capitalisation, looks good to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions and some very minor comments, but overall looking really good to me!
"author": "", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"bootstrap": "^3.3.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is used - remove?
"license": "Apache-2.0", | ||
"dependencies": { | ||
"bootstrap": "^3.3.7", | ||
"jquery": "^3.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is used - remove?
"description": "", | ||
"name": "SSF API Demo Openfin" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: add newline at the end of the file
packages/api-openfin/README.md
Outdated
@@ -0,0 +1,13 @@ | |||
# Symphony API for Openfin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Openfin => OpenFin
packages/api-openfin/README.md
Outdated
@@ -0,0 +1,13 @@ | |||
# Symphony API for Openfin | |||
|
|||
This project provides an implementation of the Symphony Desktop Wrapper API Specification for Openfin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Openfin => OpenFin
packages/api-openfin-demo/README.md
Outdated
@@ -0,0 +1,11 @@ | |||
# Symphony API for Openfin Demo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Openfin has the f capitalised. Please can Openfin be changed to OpenFin?
packages/api-openfin-demo/README.md
Outdated
@@ -0,0 +1,11 @@ | |||
# Symphony API for Openfin Demo | |||
|
|||
This project provides a demonstration of the Symphony Desktop Wrapper API within Openfin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Openfin => OpenFin
packages/api-openfin/index.js
Outdated
@@ -0,0 +1,13 @@ | |||
/* globals fin */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be required in multiple files in the future - can this be added to a .eslintrc.json
file at the root of this package, packages/api-openfin/
?
{
"globals": {
"fin": true
}
}
packages/api-openfin/index.js
Outdated
window.Notification = function(title, options) { | ||
const message = { | ||
title: title, | ||
options: options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will these options do anything?
I.e. if I look in our API specification, the options include dir
, lang
etc. If they don't do anything then I think we can omit them from the object passed to OpenFin and only pass the message, but keep options
in our API and we can add support for dir,
lang` etc. later.
@@ -0,0 +1,11 @@ | |||
<h5 id="message">Message</h5> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that this page needs to be valid HTML, worth updating to something like this?
<!DOCTYPE html>
<meta charset="utf-8">
<title></title>
<style>
html {
border: solid 2px black;
}
</style>
<h5 id="message"></h5>
<script>
function onNotificationMessage(message) {
document.getElementById('message').innerText = message.title;
}
</script>
Might be worth keeping the h5
empty too, without the text Message
?
<h5 id="message"></h5>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenFin notifications are html pages in their own right, and this is just injected inside the body of that page. I can still change it to be like this (but without the <!DOCTYPE html>
) if you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenFin notifications are html pages in their own right, and this is just injected inside the body of that page.
Are you sure that this is just injected into the body? From the docs and examples it looks like it's the entire HTML page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK that's just the way Chrome handles minimal HTML5 documents. It adds in the html
, head
, body
elements in the correct locations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see - when using dev tools, you're not seeing the original HTML source of the page which has been loaded - it's showing the DOM, the browsers interpretation of the HTML.
The browser will try to add missing elements, correct invalid markup etc. Therefore the original HTML can differ from the DOM shown in the dev tools. I don't OpenFin is injecting the template into the body here, I think it's just the browser.
It's still very minor, as the browser can correct it, but I think it's worth ensuring the HTML is valid, with doctype et. al.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. 👍
82940cc
to
94db671
Compare
94db671
to
f4db645
Compare
Basic implementation of the OpenFin notifications.
The OpenFin API requires a html template to use as its notification. I have included a very simple html template that resembles the default electron notification. OpenFin does not support native notifications.
OpenFin does not allow preload scripts like electron. Because of this,
npm posinstall
copies the API into thesrc
directory, which is accessed via a script tag. I also included a blankindex.js
file in the specification project to avoid any 404 errors from electron/browsers.