草庐IT

fail_timeout

全部标签

javascript - 无法使用 polymer 元素 - "Failed to execute ' registerElement' on 'Document' "

我创建了一个元素,为简洁起见,我将在此处对其进行简化,我想执行一个端到端的流程,看看它是否有效。这是它的bower.json文件:{"name":"test-element","version":"0.0.1","authors":["myname"],"description":"Adescription","license":"MIT","ignore":["**/.*","node_modules","bower_components","test","tests"],"dependencies":{"polymer":"~0.9.0"}}我将它上传到我的测试仓库,并在WebSt

javascript - 类型错误 : $timeout is not a function

这里发生了什么:我希望“取消预订”按钮在单击后超时。第一次单击时,它会更改为显示“确认取消”按钮。几秒钟后返回“取消预订”。我的控制台给我:TypeError:$timeoutisnotafunction我正在使用AngularJS$timeout:Controller:'usestrict';module.controller('ReservationItemCtrl',['$scope','$stateParams','$RPC',function($scope,$stateParams,$RPC,$timeout){......otherstuff.............oth

javascript - AngularJS - 仅在 ng-change 上触发 $timeout 事件一次

我在绑定(bind)到范围变量的html输入字段上有一个ng-change。varchange=function(){redraw_graph()}现在,当我更改输入框时,它会为我输入的每个新字符重新绘制图形。我想要延迟(N秒),所以在ng-change事件触发之前,angular会等待用户完成输入。如果触发了多个ng-change事件,它会取消较早的事件,只执行最新的事件。我已将延迟与超时结合起来,但在N秒后,ng-change事件仍然触发不止一次。我以前解决过这个问题,但我目前不知道该怎么做。 最佳答案 对我来说,您所要求的似乎

javascript - 未捕获( promise )DOMException : Subscription failed - no active Service Worker

我正在尝试订阅用户,但这是我第一次遇到的错误。第二次,它正在工作,因为用户已经处于事件状态这是我的代码:if('serviceWorker'innavigator){console.log('ServiceWorkerissupported');navigator.serviceWorker.register('sw.js').then(function(reg){console.log(':^)',reg);reg.pushManager.subscribe({userVisibleOnly:true}).then(function(sub){console.log('endpoin

javascript - QUnit、Sinon.js 和 Backbone 单元测试受挫 : sinon spy appears to fail to detect Backbone Model event callbacks

在下面的单元测试代码中:TestModel=Backbone.Model.extend({defaults:{'selection':null},initialize:function(){this.on('change:selection',this.doSomething);},doSomething:function(){console.log("Somethinghasbeendone.");}});module("Test",{setup:function(){this.testModel=newTestModel();}});test("intra-modeleventbi

javascript - 未捕获的 InvalidStateError : Failed to execute 'transaction' on 'IDBDatabase' : A version change transaction is running

我必须承认我是indexedDB的新手我写了一段indexedDB的简单代码,如下:functiongo(){varreq=window.indexedDB.open("Uploader",1),db;req.onerror=function(e){console.log("Error");};req.onsuccess=function(e){db=e.target.result;};req.onupgradeneeded=function(e){console.log(db);db=e.target.result;varos=db.createObjectStore("Files"

javascript - $timeout 函数中的 AngularJS 'this' 引用不起作用

我有一个让我发疯的AngularJS问题。我有一个看起来像这样的服务(这是一个说明问题的例子)varapp=angular.module('test-module');app.service('ToolService',function($timeout){this.doSomething=function(){console.log("yunoreferencedasmethod?!?");}this.runTimeoutExample=function(){$timeout(function(){this.doSomething();},1000);}})我的Controller看

javascript - jasmine.clock().tick() 不适用于 $timeout 和 debounce,但适用于 setTimeout

下面我有3个功能完全相同。每种调用setTimeout的方式不同,delay1()直接使用setTimeout,delay2()使用angularjs$timeout和delay3()使用lodashdebounce。它们都工作正常。问题出现在我用Jasmine测试的时候。setTimeout可以与jasmine.clock().tick()方法配合使用,但$timeout和debounce不适用't我有兴趣使用Jasmine进行去抖动。我知道我可以将$timeout.flush()与angularjs一起使用,但是$timeout和setTimeout在我使用的代码的其他地方给我带来

javascript - [Vue 警告] : Invalid prop: type check failed for prop "X". 预期,得到字符串

给定这个Vue2组件:Vue.component('read-more',{props:{'text':String,'clamp':{type:String,default:'ReadMore'},'less':{type:String,default:'ReadLess'},'length':{type:Number,default:100}},template:`{{truncate(text)}}=length"@click="toggle()">{{clamp}}{{text}}=length">{{less}}`,methods:{truncate(string){if(s

javascript - 如何解决来自 YouTube 嵌入的 'Failed to execute ' postMessage' on 'DOMWindow' ' 错误

我尝试使用YouTubeJavaScript/iFrameAPI寻找视频的不同时间。我已经精简了一个演示:http://jsbin.com/yuliponuvarplayer;window.onYouTubeIframeAPIReady=function(){variframe=document.createElement("iframe");iframe.width=400;iframe.height=300;iframe.id="youtubeIframe";iframe.src="https://www.youtube.com/embed/yta1WRuiupk?autoplay