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
0963f5c4
Commit
0963f5c4
authored
Oct 22, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'override' method for overriding converse Views and Models.
parent
bb54874f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
converse.js
converse.js
+23
-0
No files found.
converse.js
View file @
0963f5c4
...
...
@@ -4676,6 +4676,29 @@
'
off
'
:
function
(
evt
,
handler
)
{
converse
.
off
(
evt
,
handler
);
},
'
override
'
:
function
(
obj
,
attributes
)
{
/* Helper method for overriding or extending Converse's Backbone Views or Models
*
* When a method is overriden, the original will still be available
* on the _super attribute of the object being overridden.
*
* obj: The Backbone View or Model
* attributes: A hash of attributes, such as you would pass to Backbone.Model.extend or Backbone.View.extend
*/
if
(
!
obj
.
prototype
.
_super
)
{
obj
.
prototype
.
_super
=
{};
}
_
.
each
(
attributes
,
function
(
value
,
key
)
{
if
(
key
===
'
events
'
)
{
obj
.
prototype
[
key
]
=
_
.
extend
(
value
,
obj
.
prototype
[
key
]);
}
else
{
if
(
typeof
key
===
'
function
'
)
{
obj
.
prototype
.
_super
[
key
]
=
obj
.
prototype
[
key
];
}
obj
.
prototype
[
key
]
=
value
;
}
});
},
'
registerPlugin
'
:
function
(
name
,
callback
)
{
converse
.
plugins
[
name
]
=
callback
;
},
...
...
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