Giter VIP home page Giter VIP logo

brackets-notifications's Introduction

brackets-notifications

Brackets - Notifications

-- WHAT AND WHY ---

Implementing notifications in your brackets extension

Your extension should include the Brackets CommandManager module.
Use the execute function from the module to send a notification to the user.

ID of the notifications extension is notifications.notification

Example
var notification = {
	title: 'Sample notification title',
	message: 'Sample notification body',
	time: null // Default is 2000
}
var CommandManager = brackets.getModule("command/CommandManager");
CommandManager.execute("notifications.notification", notification);
Possible options
Option Description
title The title shown in the notification.
message The body of the notification.
time Number of milliseconds before the notification dissapears automatically. Default: 2000
actions Array of actions to be added to the notification
  • None of the options are required
  • Adding html to the title or message is possible
  • Setting the time to 0 makes the notification a permanent notification
Actions

An action will be displayed as a button in the notification. The notification will be removed after the user clicks on a action button.

Property Description
label A short label describing the action.
callback Function to be called after the user clicks this action

brackets-notifications's People

Contributors

halleyinteractive avatar griffinsauce avatar

Watchers

 avatar

brackets-notifications's Issues

Create working actions callback

In the "Actions" branch I have done the initial development for notifs with actions. But there is a problem: the callback to the original script.

It is asynchronous to the creation of the notif, so simply returning the text is a no-go.
The second idea is to return an object:

{
notification: <notification_element>
actions:
    [
        <action_element_one>,
        <action_element_two>
    ]
}

The creating script can then add eventlisteners to the whole notification or actions at will. Even for instance using hover to show extra info. That is open to the dev to work on.

One problem: return does not work.
The callback function of CommandManager.execute is never called.

Please advise..

Add an accent colour

Add an accent colour that will be shown in the notif in a dot or border.

Developers could use this to identify their extension or specific notifs like red for a warning.

Creating support

How can we create support (a userbase) for this extension? It is dependent on use by other extensions.

We can create our own extensions that implement it, or for instance create issues or pull-requests for other extensions. The last seems a bit spammy, but when it means a genuine improvement I think it's okay.

Add a callback

The callback will be called when the notification has been created, with as parameter the element of the notif.

CommandManager.execute("notifications.notification",
{
    title: "Message title",
    message: "Message body"
    callback:function(element){  /* do stuff */  }
});

This can be used by the firing script to manipulate the notification afterwards. Like updating information or adding customized interaction.

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.