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
195a9781
Commit
195a9781
authored
May 30, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an event instead of an override
parent
5e97db95
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
26 deletions
+35
-26
docs/source/events.rst
docs/source/events.rst
+25
-16
src/converse-core.js
src/converse-core.js
+1
-0
src/converse-minimize.js
src/converse-minimize.js
+9
-10
No files found.
docs/source/events.rst
View file @
195a9781
...
...
@@ -294,6 +294,25 @@ Also available as an `ES2015 Promise <http://es6-features.org/#PromiseUsage>`_:
// Your code here...
});
privateChatsAutoJoined
~~~~~~~~~~~~~~~~~~~~~~
Emitted once any private chats have been automatically joined as specified by
the _`auto_join_private_chats` settings.
.. code-block:: javascript
_converse.api.listen.on('privateChatsAutoJoined', function () { ... });
Also available as an `ES2015 Promise <http://es6-features.org/#PromiseUsage>`_.
.. code-block:: javascript
_converse.api.waitUntil('privateChatsAutoJoined').then(function () {
// Your code here...
});
reconnecting
~~~~~~~~~~~~
...
...
@@ -311,24 +330,14 @@ have to be registered anew.
_converse.api.listen.on('reconnected', function () { ... });
registeredGlobalEventHandlers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
privateChatsAutoJoined
~~~~~~~~~~~~~~~~~~~~~~
Called once Converse has registered its global event handlers (for events such
as window resize or unload).
Emitted once any private chats have been automatically joined as specified by
the _`auto_join_private_chats` settings.
.. code-block:: javascript
_converse.api.listen.on('privateChatsAutoJoined', function () { ... });
Also available as an `ES2015 Promise <http://es6-features.org/#PromiseUsage>`_.
.. code-block:: javascript
_converse.api.waitUntil('privateChatsAutoJoined').then(function () {
// Your code here...
});
Plugins can listen to this event as cue to register their own global event
handlers.
roomsAutoJoined
---------------
...
...
src/converse-core.js
View file @
195a9781
...
...
@@ -726,6 +726,7 @@
if
(
document
[
hidden
]
!==
undefined
)
{
_
.
partial
(
_converse
.
saveWindowState
,
_
,
hidden
)({
type
:
document
[
hidden
]
?
"
blur
"
:
"
focus
"
});
}
_converse
.
emit
(
'
registeredGlobalEventHandlers
'
);
};
this
.
enableCarbons
=
function
()
{
...
...
src/converse-minimize.js
View file @
195a9781
...
...
@@ -52,16 +52,6 @@
//
// New functions which don't exist yet can also be added.
registerGlobalEventHandlers
()
{
const
{
_converse
}
=
this
.
__super__
;
window
.
addEventListener
(
"
resize
"
,
_
.
debounce
(
function
(
ev
)
{
if
(
_converse
.
connection
.
connected
)
{
_converse
.
chatboxviews
.
trimChats
();
}
},
200
));
return
this
.
__super__
.
registerGlobalEventHandlers
.
apply
(
this
,
arguments
);
},
ChatBox
:
{
initialize
()
{
this
.
__super__
.
initialize
.
apply
(
this
,
arguments
);
...
...
@@ -541,6 +531,15 @@
_converse
.
emit
(
'
minimizedChatsInitialized
'
);
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
_converse
.
on
(
'
registeredGlobalEventHandlers
'
,
function
()
{
window
.
addEventListener
(
"
resize
"
,
_
.
debounce
(
function
(
ev
)
{
if
(
_converse
.
connection
.
connected
)
{
_converse
.
chatboxviews
.
trimChats
();
}
},
200
));
});
_converse
.
on
(
'
controlBoxOpened
'
,
function
(
chatbox
)
{
// Wrapped in anon method because at scan time, chatboxviews
// attr not set yet.
...
...
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