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.

Reply via email to