我尝试调用父方法,但我得到错误:
错误:在类构造函数之外调用super
我的例子:
class xo{
cool(x){
console.log(`parent init${x}`)
}
}
class boo extends xo{
cool(val){
super(val);
console.log(`child init${x}`)
}
}
x = new boo;
Run Code Online (Sandbox Code Playgroud) 昨天有效,但今天我遇到了这个错误。我重新安装全局和本地
npm i --save-dev typescript
npm i -g typescript
Run Code Online (Sandbox Code Playgroud)
和较低版本
npm install -g typescript@3.9.4
Run Code Online (Sandbox Code Playgroud)
从目录 AppData\Roaming\npm 中删除但这不起作用。也删除node_modules
tsconfig
{
"compilerOptions": {
"target": "es5",
"removeComments": true,
"outFile": "app.js",
"lib": ["es2017", "dom"]
},
"files":[
"app.ts",
"inter.ts",
]
}
Run Code Online (Sandbox Code Playgroud)
我运行命令
npx ts
Run Code Online (Sandbox Code Playgroud)
然后我得到了错误:
找不到模块“打字稿”
$ npm -v
6.13.4
$ node -v
v12.16.1
Run Code Online (Sandbox Code Playgroud) 我有去抖功能
function debounce(func, wait, immediate) {
// 'private' variable for instance
// The returned function will be able to reference this due to closure.
// Each call to the returned function will share this common timer.
var timeout;
// Calling debounce returns a new anonymous function
return function() {
// reference the context and args for the setTimeout function
var context = this,
args = arguments;
// Should the function be called now? If immediate is true
// and not …Run Code Online (Sandbox Code Playgroud) 启动应用程序的简单代码
define(['marionette'],function (Marionette) {
var MyApp = new Backbone.Marionette.Application();
MyApp.addInitializer(function(options) {
})
MyApp.addRegions({
mainRegion: "#content"
});
})
// MarionetteJS (Backbone.Marionette)
// ----------------------------------
// v3.1.0
// Backbone.js 1.3.3
Run Code Online (Sandbox Code Playgroud)
怎么修 ?
我有两个问题: 1. 我想在更新数据库版本时清除所有数据。
objectStore.clear();
Run Code Online (Sandbox Code Playgroud)
但我有错误: main1.js:42 Uncaught ConstraintError: Failed to execute 'createObjectStore' on 'IDBDatabase': 具有指定名称的对象存储已经存在。
当更新版本数据库只向我的数据库添加新项目时如何?
var browserDatabase={};
browserDatabase._db = null;
browserDatabase._dbVersion = 4;
browserDatabase._dbName = "mediaStorageDB";
browserDatabase._storeName = "myStore";
var idb = window.indexedDB
var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction;
var IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
var dbName='nameDb';
if (!window.indexedDB) {
// window.alert("??? ??????? ?? ??????????? ?????????? ?????? IndexedDB. ?????-?? ??????? ????? ??????????");
}
var request = window.indexedDB.open("MyTestDatabase", 7);
request.onupgradeneeded = function(e) {
console.log( e.oldVersion )
db = event.target.result;
//console.log(db) …Run Code Online (Sandbox Code Playgroud)