DefinitelyTyped/types/systemjs/systemjs-tests.ts
Aluan Haddad be50516c67 Modernize the declaration as a hybrid UMD + explicit global (#20512)
* Modernize the declaration as a hybrid UMD + explicit global

* fix failing tests

* remove dependency on lib.dom.d.ts

* append own name to maintainers list

* add a tslint.json file; lint declaration; lint tests

* remove SystemJSSystemFields interface
move SystemJSSystemFields properties to System interface
add comments to additional members. reference: https://github.com/systemjs/systemjs/blob/master/docs/config-api.md#warnings

https://github.com/systemjs/systemjs/blob/master/docs/config-api.md#pluginfirst

* Update header as per code review.
2017-10-12 13:51:02 -07:00

69 lines
1.2 KiB
TypeScript

import SystemJS = require('systemjs');
SystemJS.config({
baseURL: '/app'
});
SystemJS.import('main.js');
SystemJS.config({
// 'plugin-traceur' or 'plugin-typescript' or 'babel' or 'traceur' or 'typescript' or false.
transpiler: 'plugin-babel',
// or traceurOptions or typescriptOptions
babelOptions: {
}
});
SystemJS.config({
map: {
traceur: 'path/to/traceur.js'
}
});
SystemJS.config({
meta: {
'*': {
authorization: true
}
}
});
SystemJS.config({
meta: {
'*': {
authorization: 'Basic YWxhZGRpbjpvcGVuc2VzYW1l'
}
}
});
SystemJS.config({
map: {
'local/package': {
x: 'vendor/x.js'
},
'another/package': {
x: 'vendor/y.js'
}
}
});
SystemJS.transpiler = 'traceur';
const mockModule = {
default: () => {
return 42;
}
};
SystemJS.set('./app.js', SystemJS.newModule(mockModule));
SystemJS.import('./app.js').then((m: typeof mockModule) => {
m.default();
});
SystemJS.import('lodash').then((_: (...args: any[]) => any) => {
_(1, '2', {}, []);
});
const clonedSystemJSJS = new SystemJS.constructor();