Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
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
Xiaowu Zhang
renderjs
Commits
d5500b31
Commit
d5500b31
authored
Apr 19, 2013
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define functions on prototype on on every Gadget instance.
parent
91db0a4a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
40 deletions
+41
-40
renderjs.js
renderjs.js
+41
-40
No files found.
renderjs.js
View file @
d5500b31
...
@@ -436,45 +436,6 @@ var RenderJs = (function () {
...
@@ -436,45 +436,6 @@ var RenderJs = (function () {
this
.
id
=
gadget_id
;
this
.
id
=
gadget_id
;
this
.
dom
=
dom
;
this
.
dom
=
dom
;
this
.
is_ready
=
false
;
this
.
is_ready
=
false
;
this
.
getId
=
function
()
{
return
this
.
id
;
};
this
.
getDom
=
function
()
{
return
this
.
dom
;
};
this
.
isReady
=
function
()
{
/*
* Return True if remote gadget is loaded into DOM.
*/
return
this
.
is_ready
;
};
this
.
setReady
=
function
()
{
/*
* Return True if remote gadget is loaded into DOM.
*/
this
.
is_ready
=
true
;
};
this
.
remove
=
function
()
{
/*
* Remove gadget (including its DOM element).
*/
var
gadget
;
// unregister root from GadgetIndex
RenderJs
.
GadgetIndex
.
unregisterGadget
(
this
);
// gadget might contain sub gadgets so before remove entire
// DOM we must unregister them from GadgetIndex
this
.
getDom
().
find
(
"
[data-gadget]
"
).
each
(
function
()
{
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
$
(
this
).
attr
(
"
id
"
));
RenderJs
.
GadgetIndex
.
unregisterGadget
(
gadget
);
});
// remove root's entire DOM element
$
(
this
.
getDom
()).
remove
();
};
},
},
TabbularGadget
:
(
function
()
{
TabbularGadget
:
(
function
()
{
...
@@ -896,3 +857,43 @@ var RenderJs = (function () {
...
@@ -896,3 +857,43 @@ var RenderJs = (function () {
}())
}())
};
};
}());
}());
// Define Gadget prototype
RenderJs
.
Gadget
.
prototype
.
getId
=
function
()
{
return
this
.
id
;
};
RenderJs
.
Gadget
.
prototype
.
getDom
=
function
()
{
return
this
.
dom
;
};
RenderJs
.
Gadget
.
prototype
.
isReady
=
function
()
{
/*
* Return True if remote gadget is loaded into DOM.
*/
return
this
.
is_ready
;
};
RenderJs
.
Gadget
.
prototype
.
setReady
=
function
()
{
/*
* Return True if remote gadget is loaded into DOM.
*/
this
.
is_ready
=
true
;
};
RenderJs
.
Gadget
.
prototype
.
remove
=
function
()
{
/*
* Remove gadget (including its DOM element).
*/
var
gadget
;
// unregister root from GadgetIndex
RenderJs
.
GadgetIndex
.
unregisterGadget
(
this
);
// gadget might contain sub gadgets so before remove entire
// DOM we must unregister them from GadgetIndex
this
.
getDom
().
find
(
"
[data-gadget]
"
).
each
(
function
()
{
gadget
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
$
(
this
).
attr
(
"
id
"
));
RenderJs
.
GadgetIndex
.
unregisterGadget
(
gadget
);
});
// remove root's entire DOM element
$
(
this
.
getDom
()).
remove
();
};
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