@quick-game/cli
Version:
Command line interface for rapid qg development
42 lines • 2.05 kB
JavaScript
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import * as Host from '../host/host.js';
import { Capability } from './Target.js';
import { SDKModel } from './SDKModel.js';
export class LogModel extends SDKModel {
#logAgent;
constructor(target) {
super(target);
target.registerLogDispatcher(this);
this.#logAgent = target.logAgent();
void this.#logAgent.invoke_enable();
if (!Host.InspectorFrontendHost.isUnderTest()) {
void this.#logAgent.invoke_startViolationsReport({
config: [
{ name: "longTask" /* Protocol.Log.ViolationSettingName.LongTask */, threshold: 200 },
{ name: "longLayout" /* Protocol.Log.ViolationSettingName.LongLayout */, threshold: 30 },
{ name: "blockedEvent" /* Protocol.Log.ViolationSettingName.BlockedEvent */, threshold: 100 },
{ name: "blockedParser" /* Protocol.Log.ViolationSettingName.BlockedParser */, threshold: -1 },
{ name: "handler" /* Protocol.Log.ViolationSettingName.Handler */, threshold: 150 },
{ name: "recurringHandler" /* Protocol.Log.ViolationSettingName.RecurringHandler */, threshold: 50 },
{ name: "discouragedAPIUse" /* Protocol.Log.ViolationSettingName.DiscouragedAPIUse */, threshold: -1 },
],
});
}
}
entryAdded({ entry }) {
this.dispatchEventToListeners(Events.EntryAdded, { logModel: this, entry });
}
requestClear() {
void this.#logAgent.invoke_clear();
}
}
// TODO(crbug.com/1167717): Make this a const enum again
// eslint-disable-next-line rulesdir/const_enum
export var Events;
(function (Events) {
Events["EntryAdded"] = "EntryAdded";
})(Events || (Events = {}));
SDKModel.register(LogModel, { capabilities: Capability.Log, autostart: true });
//# sourceMappingURL=LogModel.js.map