我有一个为我创建类的单身汉。每个类都在一个单独的文件中。
// singleton.js
angular.module('mymodule')
.service('singleton', SingletonClass)
// someclass1.js, someclass2.js, ...
// Multiple files with same layout. Each web page has different # of these files.
// Therefore, it's hard to inject them statical
如何加载以.js显示的.csv文件中包含的.css和Node.js文件?(没有像Express这样的框架)
例如<script src="clock.js"></script>
在Firefox中,它显示页面fs.readFile('./index.html')请求clock.js、jquery.js等作为html文件,这可能是因为response.writeHead是text/html。
有没有办法:
if file included in index.html = .js
set writeHead to application/ja
在file1.js上,我有以下代码:
$(document).trigger("method1",param);
在file2.js上,我有这样的代码:
代码块1 :
$(document).on("method1",function(event,param){
//do something here
});
代码块2 :
function method1(){
// do something here also
}
以下是我的问题:
(1)你能解释一下这些代码块的区别吗?
2)文件1.js将触发哪些代码块?