Skip to content

Commit

Permalink
Merge pull request visionmedia#29 from HenrikJoreteg/master
Browse files Browse the repository at this point in the history
I wanted this for my use case, thought it may be useful to others.
  • Loading branch information
tj committed Feb 6, 2012
2 parents a086dc9 + 41f62b5 commit 8358a21
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions build/ui.js
Expand Up @@ -965,13 +965,19 @@ exports.error = type('error');
*/

function Notification(options) {
ui.Emitter.call(this);
options = options || {};
this.template = html;
this.el = $(this.template);
this.render(options);
if (Notification.effect) this.effect(Notification.effect);
};

/**
* Inherit from `Emitter.prototype`.
*/

Notification.prototype = new ui.Emitter;

/**
* Render with the given `options`.
Expand All @@ -991,6 +997,11 @@ Notification.prototype.render = function(options){
return false;
});

el.click(function(e){
e.preventDefault();
self.emit('click', e);
});

el.find('h1').text(title);
if (!title) el.find('h1').remove();

Expand Down
11 changes: 11 additions & 0 deletions lib/components/notification/notification.js
Expand Up @@ -77,13 +77,19 @@ exports.error = type('error');
*/

function Notification(options) {
ui.Emitter.call(this);
options = options || {};
this.template = html;
this.el = $(this.template);
this.render(options);
if (Notification.effect) this.effect(Notification.effect);
};

/**
* Inherit from `Emitter.prototype`.
*/

Notification.prototype = new ui.Emitter;

/**
* Render with the given `options`.
Expand All @@ -103,6 +109,11 @@ Notification.prototype.render = function(options){
return false;
});

el.click(function(e){
e.preventDefault();
self.emit('click', e);
});

el.find('h1').text(title);
if (!title) el.find('h1').remove();

Expand Down

0 comments on commit 8358a21

Please sign in to comment.