我有两个打字稿文件:Manager.ts
和ContentManagement.ts
。我将它们编译成js
扩展名-> Manager.js
和ContentManagement.js
。
这些文件位于ts
文件夹中。扩展的结构如下:
ts/Manager.js
ts/ContentManagement.js
jquery.js
manifest.json
Manifest.json:
{
"name": "Management",
"short_name": "Management",
"version": "1.0",
"manifest_version": 2,
"description": "This extension will help you to manage stuff!",
"content_scripts": [
{
"matches": [
"http://blablabla"
],
"js": [
"jquery.js",
"ts/Manager.js",
"ts/ContentManagement.js"
]
}
]
}
Manager.ts:
export class Manager {
private _$trSelector: JQuery;
constructor(trSelector: string) {
this._$trSelector = $(trSelector);
}
/**
* ManageIt
*/
public ManageIt(): void {
try {
this.Prepare();
this.Fetch();
} catch (error) {
alert("An error occurred. See console window");
console.log(error);
}
}
private Prepare(): void {
//
}
private Fetch(): void {
//
}
}
ContentManagement.ts
import { Manager } from "./Manager";
class ContentManagement {
public static StartMonitor(): void {
alert("start");
//
}
}
$(function () {
ContentManagement.StartMonitor();
});
实际上有两个问题:
Manager.js
文件,而不加载ContentManagement.js
StartMonitor()
的警报我该如何解决?