Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
19fbe3dc
Commit
19fbe3dc
authored
Dec 24, 2013
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
f7937942
2c1d1e6e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
6 deletions
+35
-6
dev.html
demo/dev.html
+3
-1
minder.command.js
src/core/minder.command.js
+1
-0
minder.module.js
src/core/minder.module.js
+21
-5
_example.js
src/module/_example.js
+10
-0
No files found.
demo/dev.html
View file @
19fbe3dc
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
</body>
</body>
<script>
<script>
minder
=
new
KityMinder
.
Minder
({
minder
=
new
KityMinder
.
Minder
({
modules
:[
"ExampleModule"
,
"RenderModule"
],
renderTo
:
document
.
body
renderTo
:
document
.
body
});
});
...
@@ -40,6 +41,7 @@
...
@@ -40,6 +41,7 @@
}]
}]
}]
}]
});
});
minder
.
execCommand
(
'renderroot'
);
minder
.
execCommand
(
'renderroot'
,
minder
);
minder
.
reset
();
</script>
</script>
</html>
</html>
\ No newline at end of file
src/core/minder.command.js
View file @
19fbe3dc
...
@@ -26,6 +26,7 @@ kity.extendClass( Minder, {
...
@@ -26,6 +26,7 @@ kity.extendClass( Minder, {
if
(
!
TargetCommand
)
{
if
(
!
TargetCommand
)
{
return
false
;
return
false
;
}
}
command
=
new
TargetCommand
();
command
=
new
TargetCommand
();
cmdArgs
=
Array
.
prototype
.
slice
.
call
(
arguments
,
1
);
cmdArgs
=
Array
.
prototype
.
slice
.
call
(
arguments
,
1
);
...
...
src/core/minder.module.js
View file @
19fbe3dc
// 模块声明周期维护
// 模块声明周期维护
kity
.
extendClass
(
Minder
,
{
kity
.
extendClass
(
Minder
,
{
_initModules
:
function
(
option
)
{
_initModules
:
function
()
{
this
.
_commands
=
{};
this
.
_commands
=
{};
this
.
_query
=
{};
this
.
_query
=
{};
this
.
_modules
=
{};
var
_modules
=
KityMinder
.
getModules
();
var
_modules
=
KityMinder
.
getModules
();
var
_modulesList
=
(
function
()
{
var
_modulesList
=
(
function
()
{
var
_list
=
[];
var
_list
=
[];
...
@@ -11,14 +12,16 @@ kity.extendClass( Minder, {
...
@@ -11,14 +12,16 @@ kity.extendClass( Minder, {
}
}
return
_list
;
return
_list
;
}
)();
}
)();
var
_configModules
=
option
.
modules
||
_modulesList
;
var
_configModules
=
this
.
_options
.
modules
||
_modulesList
;
console
.
log
(
_configModules
);
if
(
_modules
)
{
if
(
_modules
)
{
var
me
=
this
;
var
me
=
this
;
for
(
var
i
=
0
;
i
<
_configModules
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
_configModules
.
length
;
i
++
)
{
var
key
=
_configModules
[
i
];
var
key
=
_configModules
[
i
];
if
(
!
_modules
[
key
]
)
continue
;
//执行模块初始化,抛出后续处理对象
//执行模块初始化,抛出后续处理对象
var
moduleDeals
=
_modules
[
key
].
call
(
me
);
var
moduleDeals
=
_modules
[
key
].
call
(
me
);
this
.
_modules
[
key
]
=
moduleDeals
;
if
(
moduleDeals
.
initial
)
{
if
(
moduleDeals
.
initial
)
{
moduleDeals
.
initial
.
call
(
me
);
moduleDeals
.
initial
.
call
(
me
);
}
}
...
@@ -44,10 +47,23 @@ kity.extendClass( Minder, {
...
@@ -44,10 +47,23 @@ kity.extendClass( Minder, {
},
},
destroy
:
function
()
{
destroy
:
function
()
{
var
me
=
this
;
var
_modulesList
=
me
.
_options
.
modules
;
var
_modules
=
me
.
_modules
;
//解除事件绑定
me
.
_resetEvents
();
for
(
var
key
in
_modules
)
{
if
(
!
_modules
[
key
].
destroy
)
continue
;
_modules
[
key
].
destroy
.
call
(
me
);
}
},
},
reset
:
function
()
{
reset
:
function
()
{
var
me
=
this
;
var
_modules
=
this
.
_modules
;
for
(
var
key
in
_modules
)
{
if
(
!
_modules
[
key
].
reset
)
continue
;
_modules
[
key
].
reset
.
call
(
me
);
}
}
}
}
);
}
);
\ No newline at end of file
src/module/_example.js
View file @
19fbe3dc
...
@@ -93,6 +93,16 @@ KityMinder.registerModule( "ExampleModule", function () {
...
@@ -93,6 +93,16 @@ KityMinder.registerModule( "ExampleModule", function () {
"selectionchange"
:
function
(
e
)
{
"selectionchange"
:
function
(
e
)
{
// 选区改变后的事件
// 选区改变后的事件
}
}
},
// TODO: 定义模块的destroy方法
"destroy"
:
function
()
{
console
.
log
(
"destroy"
);
},
// TODO: 定义模块的reset方法
"reset"
:
function
()
{
console
.
log
(
"reset"
);
}
}
};
};
}
);
}
);
\ No newline at end of file
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