Comments (5)
Yes, you can open a Pull Request to add a feature to support both "OS.js notifications" and "Native notifications" at the same time.
But just to make sure we're talking about the same thing here; this needs to be implemented in the actual client module.
I.e.: https://github.com/os-js/osjs-client/blob/master/src/notification.js where existing functionality exists.
from os.js.
I'm not really sure if there's a use-case for this to be provided by default.
But if you create a service provider package (npm compatible) and provide the full source I will gladly add it to the documentation.
from os.js.
Looks like this is actually creating native notifications. I thought by "synchronize" that it was the other way around.
Creating native notifications is actually already supported globally with configuration notifications.native
or the native
option in the service API.
If you want the option to do both, simply publish a PR for the client with changes to the Notification to allow that :)
from os.js.
There is no need for a service provider, here you only need a file for notification that is written with JavaScript and called in the index.js
Also, a listener is used in the index file to listen to create notifications
from os.js.
this file called in index.js and in
osjs.on('osjs/notification:create', (notification) => {
let message = notification.options.message;
sendNotification(notification.options.title,message,'#');
console.log('notificationnotificationnotification',message);
});
this is Notification.js:
export default function sendNotification(title, message, url) {
//First, check notification is supported or not in your browser!
if (!Notification) {
console.log('Push notifications are not supported in your browser..');
return;
}
//Ask for permission from user
if (Notification.permission !== "granted") {
Notification.requestPermission();
} else {
var notification = new Notification(title, {
icon: 'favicon.png',
body: message,
});
// Remove the notification when clicked and open the URL.
notification.onclick = function() {
};
// Callback function when the notification is closed.
notification.onclose = function() {
console.log('Notification closed');
};
}
}
from os.js.
Related Issues (20)
- Disable Download option in File Manager HOT 9
- Hide OS.js folder from view in File Manager HOT 7
- Can't open files HOT 5
- unify with daedalOS? HOT 2
- PWA support for OS.js applications and framework HOT 7
- Add requirements in README.md HOT 1
- Some questions with contextmenu HOT 2
- VFS Capability detection, other extensions HOT 6
- Security consideration in OSjs HOT 4
- Use Notification in login osjs HOT 3
- Needed Interface for OSjs Search Engine HOT 21
- update npm lockfile version
- How to handle node_modules in production mode HOT 1
- add finnish HOT 5
- people are uploading virus and malwares in demo page HOT 1
- Crashing the osjs when uploading a file in osjs mountpoint HOT 3
- Remove clock widget in demo HOT 4
- Dynamic service providers and arguments HOT 5
- Failure to cancel file upload correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from os.js.