forked from ksky521/nodeppt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
35 changed files
with
3,559 additions
and
38 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules | ||
/.sass-cache | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
var concatArr = [ | ||
'src/intro.js', | ||
'src/getCurrentScript.js', | ||
'src/vars.js', | ||
'src/typeof.js', | ||
'src/browser.js', | ||
'src/Module.js', | ||
'src/Promise.js', | ||
'src/getPath.js', | ||
'src/loadjs.js', | ||
'src/loadcss-img.js', | ||
'src/core.js', | ||
'src/outro.js']; | ||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
jshint: { | ||
options: { | ||
noarg: true, | ||
noempty: true, | ||
curly: true, | ||
asi: true, | ||
expr: true, | ||
browser: true, | ||
strict: true, | ||
unused: true, | ||
undef: true, | ||
loopfunc: false, | ||
sub: true, | ||
boss: true, | ||
eqnull: true | ||
}, | ||
files: ['tmp/<%= pkg.name %>.js'] | ||
}, | ||
watch: { | ||
files: ['src/*.js'], | ||
tasks: 'dev' | ||
}, | ||
concat: { | ||
MixJS: { | ||
options: { | ||
separator: '\n' | ||
}, | ||
src: concatArr, | ||
dest: 'lib/<%= pkg.name %>.<%= pkg.version %>.js' | ||
}, | ||
dev: { | ||
options: { | ||
separator: '\n' | ||
}, | ||
src: concatArr, | ||
dest: 'tmp/<%= pkg.name %>.js' | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
sourceMap: 'lib/<%= pkg.name %>.<%= pkg.version %>.map', | ||
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> by <%= pkg.author %> */\n' | ||
}, | ||
dist: { | ||
src: '<%= concat.MixJS.dest %>', | ||
dest: 'lib/<%= pkg.name %>.<%= pkg.version %>.min.js' | ||
} | ||
}, | ||
compress: { | ||
main: { | ||
options: { | ||
archive: '<%= pkg.name %>.zip' | ||
}, | ||
files: [{ | ||
expand: true, | ||
cwd: 'lib', | ||
src: ['**'], | ||
filter: 'isFile' | ||
}] | ||
} | ||
} | ||
}); | ||
|
||
// grunt.loadNpmTasks('grunt-regarde'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-compress'); | ||
|
||
grunt.registerTask('build', ['concat:MixJS', 'uglify']); | ||
grunt.registerTask('dev', ['concat:dev', 'jshint']); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright 2013 Theowang http://js8.in | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
MixJS - Just Another Javascript Module Loader | ||
============= | ||
MMMMMMMM MMMMMMMM iiii JJJJJJJJJJJ SSSSSSSSSSSSSSS | ||
M:::::::M M:::::::M i::::i J:::::::::J SS:::::::::::::::S | ||
M::::::::M M::::::::M iiii J:::::::::JS:::::SSSSSS::::::S | ||
M:::::::::M M:::::::::M JJ:::::::JJS:::::S SSSSSSS | ||
M::::::::::M M::::::::::Miiiiiii xxxxxxx xxxxxxx J:::::J S:::::S | ||
M:::::::::::M M:::::::::::Mi:::::i x:::::x x:::::x J:::::J S:::::S | ||
M:::::::M::::M M::::M:::::::M i::::i x:::::x x:::::x J:::::J S::::SSSS | ||
M::::::M M::::M M::::M M::::::M i::::i x:::::xx:::::x J:::::j SS::::::SSSSS | ||
M::::::M M::::M::::M M::::::M i::::i x::::::::::x J:::::J SSS::::::::SS | ||
M::::::M M:::::::M M::::::M i::::i x::::::::x JJJJJJJ J:::::J SSSSSS::::S | ||
M::::::M M:::::M M::::::M i::::i x::::::::x J:::::J J:::::J S:::::S | ||
M::::::M MMMMM M::::::M i::::i x::::::::::x J::::::J J::::::J S:::::S | ||
M::::::M M::::::Mi::::::i x:::::xx:::::xJ:::::::JJJ:::::::J SSSSSSS S:::::S | ||
M::::::M M::::::Mi::::::i x:::::x x:::::xJJ:::::::::::::JJ S::::::SSSSSS:::::S | ||
M::::::M M::::::Mi::::::i x:::::x x:::::x JJ:::::::::JJ S:::::::::::::::SS | ||
MMMMMMMM MMMMMMMMiiiiiiiixxxxxxx xxxxxxx JJJJJJJJJ SSSSSSSSSSSSSSS | ||
|
||
version: 0.3.0 butterfly | ||
|
||
Come back soon!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** | ||
* 广播事件处理 | ||
* 状态:稳定 | ||
* | ||
* 目标: 为了尽可能的减少模块之间业务逻辑的耦合度, 而开发了这个eventbus, 主要用于业务逻辑的事件传递 | ||
* 使用规范: 每个js模块尽可能通过事件去通信, 减少模块之间的直接调用和依赖(耦合) | ||
* 使用示例: | ||
* //触发 | ||
* MixJS.event.broadcast.fire('abc',{abc:1}) | ||
* //订阅 | ||
* MixJS.event.broadcast.on('abc',function(a){ | ||
* console.log(a); | ||
* }, scope); | ||
* @return {[type]} | ||
* @author theowang | ||
* $Id: broadcast.js 65871 2012-11-05 01:51:42Z theowang $ | ||
*/ | ||
MixJS.define('event/broadcast',function($){ | ||
var _cache = {}; | ||
var broadcast = { | ||
|
||
/** | ||
* 派发 | ||
* @param {[type]} type 事件类型 | ||
* @param {[type]} data 回调数据 | ||
* @return {[type]} [description] | ||
*/ | ||
fire:function(type, data){ | ||
var listeners = _cache[type],len = 0; | ||
if(!$.isUndefined(listeners)){ | ||
var args = [].slice.call(arguments, 0); | ||
args = args.length > 2 ? args.splice(2, args.length-1) : []; | ||
args = [data].concat(args); | ||
|
||
len = listeners.length; | ||
for(var i = 0; i<len;i++){ | ||
var listener = listeners[i]; | ||
if(listener && listener.callback) { | ||
args = args.concat(listener.args); | ||
listener.callback.apply(listener.scope, args); | ||
} | ||
} | ||
} | ||
return this; | ||
}, | ||
/** | ||
* 订阅广播事件 | ||
* @param {[type]} types 事件类型,支持,分隔符 | ||
* @param {Function} callback 回调函数 | ||
* @param {[type]} scope 回调函数上下文 | ||
* @return {[type]} this | ||
*/ | ||
on:function(types, callback, scope){ | ||
types = types || []; | ||
var args = [].slice.call(arguments); | ||
|
||
if($.isString(types)){ | ||
types = types.split(','); | ||
} | ||
var len = types.length; | ||
if(len===0){ | ||
return this; | ||
} | ||
args = args.length > 3 ? args.splice(3, args.length-1) : []; | ||
for(var i = 0;i<len;i++){ | ||
var type = types[i]; | ||
_cache[type] = _cache[type] || []; | ||
_cache[type].push({callback:callback,scope:scope,args:args}); | ||
} | ||
return this; | ||
}, | ||
/** | ||
* 退订 | ||
* @param {[type]} type [description] | ||
* @param {Function} callback 假如传入则移出传入的监控事件,否则移出全部 | ||
* @return {[type]} [description] | ||
*/ | ||
un:function(type, callback, scope){ | ||
var listeners = _cache[type]; | ||
if (!listeners) { | ||
return this; | ||
} | ||
if(callback){ | ||
var len = listeners.length, | ||
tmp = []; | ||
|
||
for(var i=0; i<len; i++) { | ||
var listener = listeners[i]; | ||
if(listener.callback == callback && listener.scope == scope) { | ||
} else { | ||
tmp.push(listener); | ||
} | ||
} | ||
listeners = tmp; | ||
}else{ | ||
listeners.length = 0; | ||
} | ||
return this; | ||
}, | ||
|
||
|
||
removeAll:function(){ | ||
_cache = {}; | ||
return this; | ||
} | ||
}; | ||
return broadcast; | ||
}); |
Oops, something went wrong.