Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
3b71de7e
Commit
3b71de7e
authored
Dec 19, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace jQuery-based event emitter with Backbone.Events
parent
216606ae
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
28 additions
and
59 deletions
+28
-59
docs/CHANGES.md
docs/CHANGES.md
+5
-1
docs/source/configuration.rst
docs/source/configuration.rst
+1
-1
docs/source/developer_api.rst
docs/source/developer_api.rst
+4
-4
src/converse-api.js
src/converse-api.js
+3
-9
src/converse-core.js
src/converse-core.js
+6
-35
src/converse-mam.js
src/converse-mam.js
+1
-1
src/converse-minimize.js
src/converse-minimize.js
+2
-2
src/converse-notification.js
src/converse-notification.js
+5
-5
src/converse-vcard.js
src/converse-vcard.js
+1
-1
No files found.
docs/CHANGES.md
View file @
3b71de7e
# Changelog
## 2.0.5
## 3.0.0 (Unreleased)
-
Breaking change: Callbacks for
`converse.on`
now no longer receive an event
object as first parameter. [jcbrand]
## 2.0.5 (Unreleased)
-
#743, #751, #753 Update to Strophe 1.2.12. SASL-EXTERNAL now has reduced priority, so it won't
be prioritized above other auth mechanisms. [jcbrand]
-
#755: create composer.json to add this project in packagist.org [fabiomontefuscolo]
...
...
docs/source/configuration.rst
View file @
3b71de7e
...
...
@@ -1047,7 +1047,7 @@ Allows you to show or hide buttons on the chat boxes' toolbars.
Provides a button with a picture of a telephone on it.
When the call button is pressed, it will emit an event that can be used by a third-party library to initiate a call.::
converse.listen.on('callButtonClicked', function(
event,
data) {
converse.listen.on('callButtonClicked', function(data) {
console.log('Strophe connection is', data.connection);
console.log('Bare buddy JID is', data.model.get('jid'));
// ... Third-party library code ...
...
...
docs/source/developer_api.rst
View file @
3b71de7e
...
...
@@ -151,7 +151,7 @@ For example:
.. code-block:: javascript
converse.listen.on('serviceDiscovered', function (
event,
feature) {
converse.listen.on('serviceDiscovered', function (feature) {
if (feature.get('var') === converse.env.Strophe.NS.MAM) {
converse.archive.query()
}
...
...
@@ -687,7 +687,7 @@ grouping:
.. code-block:: javascript
converse.listen.on('message', function (
event,
messageXML) { ... });
converse.listen.on('message', function (messageXML) { ... });
* **once(eventName, callback, [context])**:
...
...
@@ -704,7 +704,7 @@ grouping:
.. code-block:: javascript
converse.listen.once('message', function (
event,
messageXML) { ... });
converse.listen.once('message', function (messageXML) { ... });
* **not(eventName, callback)**
...
...
@@ -719,5 +719,5 @@ grouping:
.. code-block:: javascript
converse.listen.not('message', function (
event,
messageXML) { ... });
converse.listen.not('message', function (messageXML) { ... });
src/converse-api.js
View file @
3b71de7e
...
...
@@ -160,15 +160,9 @@
}
},
'
listen
'
:
{
'
once
'
:
function
(
evt
,
handler
,
context
)
{
converse
.
once
(
evt
,
handler
,
context
);
},
'
on
'
:
function
(
evt
,
handler
,
context
)
{
converse
.
on
(
evt
,
handler
,
context
);
},
'
not
'
:
function
(
evt
,
handler
)
{
converse
.
off
(
evt
,
handler
);
},
'
once
'
:
converse
.
once
,
'
on
'
:
converse
.
on
,
'
not
'
:
converse
.
off
,
'
stanza
'
:
function
(
name
,
options
,
handler
)
{
if
(
typeof
options
===
'
function
'
)
{
handler
=
options
;
...
...
src/converse-core.js
View file @
3b71de7e
...
...
@@ -43,41 +43,10 @@
interpolate
:
/
\{\{([\s\S]
+
?)\}\}
/g
};
// We create an object to act as the "this" context for event handlers (as
// defined below and accessible via converse_api.listen).
// We don't want the inner converse object to be the context, since it
// contains sensitive information, and we don't want it to be something in
// the DOM or window, because then anyone can trigger converse events.
var
event_context
=
{};
var
converse
=
{
templates
:
{},
emit
:
function
(
evt
,
data
)
{
$
(
event_context
).
trigger
(
evt
,
data
);
},
once
:
function
(
evt
,
handler
,
context
)
{
if
(
context
)
{
handler
=
handler
.
bind
(
context
);
}
$
(
event_context
).
one
(
evt
,
handler
);
},
on
:
function
(
evt
,
handler
,
context
)
{
if
(
_
.
contains
([
'
ready
'
,
'
initialized
'
],
evt
))
{
converse
.
log
(
'
Warning: The "
'
+
evt
+
'
" event has been deprecated and will be removed, please use "connected".
'
);
}
if
(
context
)
{
handler
=
handler
.
bind
(
context
);
}
$
(
event_context
).
bind
(
evt
,
handler
);
},
off
:
function
(
evt
,
handler
)
{
$
(
event_context
).
unbind
(
evt
,
handler
);
}
};
var
converse
=
{};
converse
.
templates
=
{};
_
.
extend
(
converse
,
Backbone
.
Events
);
converse
.
emit
=
converse
.
trigger
;
// Make converse pluggable
pluggable
.
enable
(
converse
,
'
converse
'
,
'
pluggable
'
);
...
...
@@ -141,6 +110,8 @@
// out or disconnecting in the previous session.
// This happens in tests.
// We therefore first clean up.
converse
.
off
();
converse
.
stopListening
();
converse
.
_tearDown
();
}
...
...
src/converse-mam.js
View file @
3b71de7e
...
...
@@ -278,7 +278,7 @@
};
var
onFeatureAdded
=
function
(
evt
,
feature
)
{
var
onFeatureAdded
=
function
(
feature
)
{
var
prefs
=
feature
.
get
(
'
preferences
'
)
||
{};
if
(
feature
.
get
(
'
var
'
)
===
Strophe
.
NS
.
MAM
&&
prefs
[
'
default
'
]
!==
converse
.
message_archiving
)
{
// Ask the server for archiving preferences
...
...
src/converse-minimize.js
View file @
3b71de7e
...
...
@@ -505,7 +505,7 @@
}
});
var
renderMinimizeButton
=
function
(
evt
,
view
)
{
var
renderMinimizeButton
=
function
(
view
)
{
// Inserts a "minimize" button in the chatview's header
var
$el
=
view
.
$el
.
find
(
'
.toggle-chatbox-button
'
);
var
$new_el
=
converse
.
templates
.
chatbox_minimize
(
...
...
@@ -519,7 +519,7 @@
};
converse
.
on
(
'
chatBoxOpened
'
,
renderMinimizeButton
);
converse
.
on
(
'
controlBoxOpened
'
,
function
(
evt
,
chatbox
)
{
converse
.
on
(
'
controlBoxOpened
'
,
function
(
chatbox
)
{
// Wrapped in anon method because at scan time, chatboxviews
// attr not set yet.
if
(
converse
.
connection
.
connected
)
{
...
...
src/converse-notification.js
View file @
3b71de7e
...
...
@@ -205,7 +205,7 @@
}
};
converse
.
handleChatStateNotification
=
function
(
evt
,
contact
)
{
converse
.
handleChatStateNotification
=
function
(
contact
)
{
/* Event handler for on('contactStatusChanged').
* Will show an HTML5 notification to indicate that the chat
* status has changed.
...
...
@@ -215,7 +215,7 @@
}
};
converse
.
handleMessageNotification
=
function
(
evt
,
message
)
{
converse
.
handleMessageNotification
=
function
(
message
)
{
/* Event handler for the on('message') event. Will call methods
* to play sounds and show HTML5 notifications.
*/
...
...
@@ -229,19 +229,19 @@
}
};
converse
.
handleContactRequestNotification
=
function
(
evt
,
contact
)
{
converse
.
handleContactRequestNotification
=
function
(
contact
)
{
if
(
converse
.
areDesktopNotificationsEnabled
(
true
))
{
converse
.
showContactRequestNotification
(
contact
);
}
};
converse
.
handleFeedback
=
function
(
evt
,
data
)
{
converse
.
handleFeedback
=
function
(
data
)
{
if
(
converse
.
areDesktopNotificationsEnabled
(
true
))
{
converse
.
showFeedbackNotification
(
data
);
}
};
converse
.
requestPermission
=
function
(
evt
)
{
converse
.
requestPermission
=
function
()
{
if
(
converse
.
supports_html5_notification
&&
!
_
.
contains
([
'
denied
'
,
'
granted
'
],
Notification
.
permission
))
{
// Ask user to enable HTML5 notifications
...
...
src/converse-vcard.js
View file @
3b71de7e
...
...
@@ -132,7 +132,7 @@
}
};
var
updateVCardForChatBox
=
function
(
evt
,
chatbox
)
{
var
updateVCardForChatBox
=
function
(
chatbox
)
{
if
(
!
converse
.
use_vcards
)
{
return
;
}
var
jid
=
chatbox
.
model
.
get
(
'
jid
'
),
contact
=
converse
.
roster
.
get
(
jid
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment