UNPKG

prepack

Version:

Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.

42 lines (35 loc) 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _index = require("../../values/index.js"); /** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ /* strict-local */ const consoleMethods = ["assert", "clear", "count", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "table", "time", "timeEnd", "trace", "warn"]; function _default(realm) { let obj = new _index.ObjectValue(realm, realm.intrinsics.ObjectPrototype, "console"); for (let method of consoleMethods) { obj.defineNativeMethod(method, 0, (context, args) => { realm.outputToConsole(method, args); return realm.intrinsics.undefined; }); } obj.defineNativeMethod("time", 0, (context, args) => { realm.outputToConsole("time", args); return realm.intrinsics.undefined; }); obj.defineNativeMethod("timeEnd", 0, (context, args) => { realm.outputToConsole("timeEnd", args); return realm.intrinsics.undefined; }); return obj; } //# sourceMappingURL=console.js.map