本文整理匯總了TypeScript中@hpcc-js/requirejs-shim.require類的典型用法代碼示例。如果您正苦於以下問題:TypeScript require類的具體用法?TypeScript require怎麽用?TypeScript require使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了require類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: dev
export function dev(additionalPaths: { [key: string]: string } = {}): any {
window.__hpcc_topoJsonFolder = `${hostUrl}/map/TopoJSON`;
const thirdPartyPaths: { [key: string]: string } = {};
for (const key in npmPackages) {
thirdPartyPaths[key] = `${hostUrl}/../node_modules/${npmPackages[key]}`;
}
const paths: { [key: string]: string } = {
...thirdPartyPaths,
...additionalPaths
};
const rjsPackages: any = [];
hpccShims.forEach(shim => {
paths[`@hpcc-js/${shim}`] = `${hostUrl}/${shim}/dist/index`;
});
packages.forEach(pckg => {
paths[`@hpcc-js/${pckg}`] = `${hostUrl}/${pckg}`;
rjsPackages.push({
name: `@hpcc-js/${pckg}`,
main: "lib-umd/index"
});
});
return requirejs.config({
context: hostUrl,
paths,
packages: rjsPackages,
shim: requireShims
});
}
示例2: reqListener
function reqListener() {
const pkg = JSON.parse(this.responseText);
console.log(`Configuring require from ${pkg.name}@${pkg.version} from ${url}`);
const topoJsonUrl = `${pkgUrl(pkg, "@hpcc-js/map")}/TopoJSON`;
window.__hpcc_topoJsonFolder = topoJsonUrl;
const paths: { [key: string]: string } = {
"@hpcc-js/map/TopoJSON": topoJsonUrl,
...additionalPaths
};
for (const key in pkg.dependencies) {
paths[key] = `${pkgUrl(pkg, key)}/dist/index${minStr}`;
}
resolve(requirejs.config({
context: url,
paths
}));
}
示例3: cdn
export function cdn(url: string, min: boolean = true, additionalPaths: { [key: string]: string } = {}): any {
console.log("Deprecated - please use 'amd'");
window.__hpcc_topoJsonFolder = `${url}/map/TopoJSON`;
const minStr = min ? ".min" : "";
const paths: { [key: string]: string } = {
"@hpcc-js/map/TopoJSON": `${url}/map/TopoJSON`,
...additionalPaths
};
hpccShims.forEach(shim => {
paths[`@hpcc-js/${shim}`] = `${url}/${shim}/dist/index${minStr}`;
});
packages.forEach(pckg => {
paths[`@hpcc-js/${pckg}`] = `${url}/${pckg}/dist/index${minStr}`;
});
return requirejs.config({
context: url,
paths
});
}