help with meld.js

83 views
Skip to first unread message

Devesh V

unread,
Aug 24, 2014, 5:33:00 AM8/24/14
to cuj...@googlegroups.com
HI,

I am new to cujojs ecosystem, and wondering whether meld.js can be used in html webpages as an AOP.
I tried integrating meld.js with a test page but it says ReferenceError: module is not defined.

I am attaching my test page for ready reference.

Thanks
Devesh


<!document html>
<head>
<script src="http://localhost/test/jquery-1.11.1.min.js"></script>    
<script type="text/javascript" src="http://localhost/test/meld.js"></script>
<script type="text/javascript">
function log(){
console
.log('hi');
}
$
(function(){
var obj=new x();
var obj1=new meld.around(obj, 'method', log);
obj1
.EventHandlers();
});
function x(){
var self=this;
self
.b_OnClick=function () {
   alert
('I am clicked');
};

self
.EventHandlers=function(){
$
("#myButton").on('click', self.b_OnClick);
};
return self;
}
</script>
</head>
<body>
<input type="button" value="Click Me" id='myButton'/>
</body>


Brian Cavalier

unread,
Aug 24, 2014, 11:12:40 PM8/24/14
to cuj...@googlegroups.com
Hi Devesh,

Welcome to cujoJS :) All cujoJS packages are designed to work in a modular JavaScript environment.  For browsers, that means using a module system, such as RequireJS [1], or a build tool, such as browserify [2].  You may also want to try RaveJS [3], a new module system we're working on that supports both AMD and CommonJS (and will support ES6 modules in the future), removes the need for configuration, and integrates with package managers such as npm and bower.

If you decide to try RaveJS, you can likely follow the bower quick start instructions [4] and then install meld like this: `bower install --save meld`.

If you decide to go with RequireJS, after downloading it, you can follow the instructions to configure meld as an AMD package [5].

Let us know how it goes.

Reply all
Reply to author
Forward
0 new messages