So for this main.js
var prime = require('prime');
var A = prime({
// things
});
var B = prime({
inherits: A,
constructor: function() {
console.log('do', this);
}
});
var b = new B();
You can build it with wrapup, on the command line, after you installed it
from npm: wrup -r ./main.js -o built-file.js
Finally you can <script src="built-file.js"></script>
On Wed, Dec 4, 2013 at 11:01 AM, Dimitar Christoff <[email protected]>wrote:
>
>
> On Wednesday, 4 December 2013 01:33:40 UTC, Arian Stolwijk wrote:
>>
>> well, use wrapup or browserify if you want to use it in the browser.
>>
>> Then you can simply
>>
>> var prime = require('prime');
>>
>> var A = prime({
>> // things
>> });
>>
>> var B = prime({
>> inherits: A,
>> constructor: function() {
>> console.log('do', this);
>> }
>> });
>>
>
> Similar with primish, eg if you have AMD:
>
>
> define('B', function(require){
> var prime = require('primish/prime'),
> options = require('primish/options'),
> emitter = require('primish/emitter');
>
> var A = prime({
> foo: function(){
> console.log(this.options.name);
> this.trigger('foo');
> }
> });
>
> return prime({
> implement: [options, emitter],
> extend: A,
> constructor: function(options) {
> this.setOptions(options);
> },
> foo: function(){
> this.parent('foo', arguments);
> }
> });
>
> });
>
> // consume this module later...
> require(['B'], function(B){
> var b = new B({
> name: 'bob',
> onFoo: function(){
> console.log('foo');
> }
> });
>
> b.foo();
> });
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "MooTools Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
---
You received this message because you are subscribed to the Google Groups
"MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.