Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
Conflicts:
	build/js/messenger.js
	build/js/messenger.min.js
	package.json
  • Loading branch information
zackbloom committed Mar 13, 2013
2 parents 53ad48d + de99662 commit 66f377e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 28 deletions.
57 changes: 34 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
1.2.2
-----

- Message strings (as opposed to full objects) can now be passed into message.update.

1.2.1
-----

- Added `ajax` alias for `run` with `$.ajax` as the action. This is essentially identical
to the default behavior, but is useful to those who wish to be more explicit.

1.2.0
-----

Added global Messenger object which can be removed with `Messenger.noConflict()`. The
Messenger object will provide a container other than the jQuery object for messenger
externals.
- Added global Messenger object which can be removed with `Messenger.noConflict()`. The
Messenger object will provide a container other than the jQuery object for messenger
externals.

Messenger may also be called to provide the same functionality as `$.globalMessenger`.
- Messenger may also be called to provide the same functionality as `$.globalMessenger`.

Messenger default options may now be set on `window.Messenger.options` as well as
`$._messengerDefaults`.
- Messenger default options may now be set on `window.Messenger.options` as well as
`$._messengerDefaults`.

The current instance of ActionMessenger which will be used by Messenger()/$.globalMessenger
calls is now accessable as `window.Messenger.instance`, not `$._messengerInstance`.
- The current instance of ActionMessenger which will be used by `Messenger()`/`$.globalMessenger`
calls is now accessable as `window.Messenger.instance`, not `$._messengerInstance`.

Added `run` alias for `go`. This change makes it easier for developers writing js.
In JavaScript, go, being a reserved word, always had to be referenced using array
notation, this provides a way around that limitation.
- Added `run` alias for `go`. This change makes it easier for developers writing js.
In JavaScript, go, being a reserved word, always had to be referenced using array
notation, this provides a way around that limitation.

Created common way for themes to define extra JavaScript. Themes can now define their
own Messenger and/or Message objects in the `window.Messenger.themes.<theme_name>` object.
If the theme name is provided in the options to globalMessenger as `options.theme`, the
defined classes will be used. As the theme now has to be passed in as a seperate option, the
`messenger-theme-x` class will now be automatically added, and does not need to be
provided in extraClasses.
- Created common way for themes to define extra JavaScript. Themes can now define their
own Messenger and/or Message objects in the `window.Messenger.themes.<theme_name>` object.
If the theme name is provided in the options to globalMessenger as `options.theme`, the
defined classes will be used. As the theme now has to be passed in as a seperate option, the
`messenger-theme-x` class will now be automatically added, and does not need to be
provided in extraClasses.

MagicMessage has been renamed RetryingMessage.
- `MagicMessage` has been renamed `RetryingMessage`.

The base classes Message and Messenger have been renamed _Message and _Messenger to
signify that they are only for the internal structuring of the code, and not expected
to be used directly.
- The base classes `Message` and `Messenger` have been renamed `_Message` and `_Messenger` to
signify that they are only for the internal structuring of the code, and not expected
to be used directly.

Messenger now exposes ActionMessenger (as Messenger) and RetryingMessage (as Message) for
use by theme which wish to extend them.
- Messenger now exposes `ActionMessenger` (as `Messenger`) and `RetryingMessage` (as `Message`) for
use by theme which wish to extend them.
14 changes: 13 additions & 1 deletion build/js/messenger.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! messenger 1.2.1 2013-03-12 */
/*! messenger 1.2.2 2013-03-12 */
(function() {
var $, ActionMessenger, RetryingMessage, _Message, _Messenger, _prevMessenger,
__hasProp = {}.hasOwnProperty,
Expand Down Expand Up @@ -64,6 +64,11 @@
_Message.prototype.update = function(opts) {
var _ref,
_this = this;
if (_.isString(opts)) {
opts = {
message: opts
};
}
$.extend(this.options, opts);
this.lastUpdate = new Date();
this.rendered = false;
Expand Down Expand Up @@ -712,6 +717,13 @@

ActionMessenger.prototype["do"] = ActionMessenger.prototype.run;

ActionMessenger.prototype.ajax = function() {
var args, m_opts;
m_opts = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
m_opts.action = $.ajax;
return this.run.apply(this, [m_opts].concat(__slice.call(args)));
};

return ActionMessenger;

})(_Messenger);
Expand Down
4 changes: 2 additions & 2 deletions build/js/messenger.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "messenger",
"description": "",
"version": "1.2.1",
"version": "1.2.2",
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-coffee": "~0.4.0",
Expand Down
9 changes: 8 additions & 1 deletion src/coffee/messenger.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class _Message extends Backbone.View
do @hide

update: (opts) ->
if _.isString opts
opts = {message: opts}

$.extend(@options, opts)

@lastUpdate = new Date()
Expand Down Expand Up @@ -591,8 +594,12 @@ class ActionMessenger extends _Messenger

return msg

# Alias
# Aliases
do: ActionMessenger::run
ajax: (m_opts, args...) ->
m_opts.action = $.ajax

@run(m_opts, args...)

$.fn.messenger = (func={}, args...) ->
$el = this
Expand Down

1 comment on commit 66f377e

@PavelKubes1984
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge branch
master
into gh-pa
Conflicts: build/js/messenger.js build/js/messenger.min.js package.json

Please sign in to comment.