JSFiddle - React, Tailwind, and code Playground

by sfoster

HTML

If I install Compose as a method on another module, 'this' becomes that module when Compose is invoked, which seems to tangle up the undefinedThis logic 

Yes, I can just require Compose directly, but then all my code needs to be aware of my module structure and individual dependencies like Compose, rather than leaning on a single known 'lang' module which aggregates them. Maybe there's a better way?

JavaScript

// define a 'lang' module with oo helpers and other stuff
  define(['compose'], function(Compose) {
    return { 
      Compose: Compose
    }
  });

// use it: 
  Thing = lang.Compose({   });
  new Thing(); // error, object is not a function