in app.js
define('app', [], function(require, exports, module){
var sayHello = function() {
alert('hello');
};
//u can expose the sayHello func here or not
exports.sayHello = sayHello;
});
//in use
seajs.use('app', function(app){
//just expose the method in here
window.sayHello = app.sayHello;
});
//so, u can do like your code
<a href='javascript:sayHello();'>say hello</a>
this is my solution. I'm also new to seajs.We can discuss.
in app.js
define('app', [], function(require, exports, module){
var sayHello = function() {
alert('hello');
};
//u can expose the sayHello func here or not
exports.sayHello = sayHello;
});
//in use
seajs.use('app', function(app){
//just expose the method in here
window.sayHello = app.sayHello;
});
//so, u can do like your code
<a href='javascript:sayHello();'>say hello</a>
this is my solution. I'm also new to seajs.We can discuss.
发布评论
评论(4)
example plz
export the method to global. Then you can do like this.