无法在Firefox扩展程序中加载某些js文件

时间:2019-06-12 05:23:15

标签: javascript jquery typescript firefox-addon

我有两个打字稿文件:Manager.tsContentManagement.ts。我将它们编译成js扩展名-> Manager.jsContentManagement.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();
});

实际上有两个问题:

  1. Firefox扩展管理器仅加载Manager.js文件,而不加载ContentManagement.js
  2. 未显示来自StartMonitor()的警报

我该如何解决?

0 个答案:

没有答案