plbrault / weasleyjs Goto Github PK
View Code? Open in Web Editor NEWA simple dependency registry for JavaScript
License: MIT License
A simple dependency registry for JavaScript
License: MIT License
This test fails on v0.2.0-beta.3:
it('should be possible to extend a lazy-loaded class', function () {
const BaseClass = lazyLoad(require.resolve('./testModules/sampleClassModule'));
class Cls extends BaseClass() {
constructor(...args) {
super(...args);
}
}
const inst = new Cls('Nitwit', 'Blubber', 'Oddment', 'Tweak');
expect(inst.albusQuote).to.be.equal(sampleDependency.speak());
expect(inst.constructorArgs[0]).to.be.equal('Nitwit');
expect(inst.constructorArgs[1]).to.be.equal('Blubber');
expect(inst.constructorArgs[2]).to.be.equal('Oddment');
expect(inst.constructorArgs[3]).to.be.equal('Tweak');
});
Cause:
Some JavaScript engines do not support ES6 proxies, and according to Babel documentation, they cannot be transpiled or polyfilled.
http://stackoverflow.com/questions/35025204/javascript-proxy-support-in-babel
To reproduce:
const myBaseClass = weasley.container.myBaseClass.new;
class MySubclass extends MyBaseClass {
constructor() {
super();
}
}
The same error happens if I don't use .new
when importing.
When registering dependencies with the same path, the ones declared before are overwritten to undefined.
// weasly.js
import Weasley from 'weasley';
const weasley = new Weasley();
export default weasley;
weasley.register('lib.Logger', () => require('./Logger'));
weasley.register('lib.Settings', () => require('./Settings'));
// Usage
import weasley from './weasley';
const Logger = weasley.container.lib.Logger;
Logger.getLogger(this.constructor.name); // Error cannot call `getLogger` of `undefined`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.