我有一个for循环,我正在循环.
我想制作一个自定义模态并在继续之前等待响应.
我怎样才能做到这一点?我知道我要等待回电.
像这个例子:
for(var x in array){
alert(x);
console.log(x);
}
Run Code Online (Sandbox Code Playgroud)
它完全符合我的要求.但我想要三个按钮.但警报不是javascript的一部分(?它在浏览器中.)
所以,你们有个主意吗?
我在考虑做这样的事情:
var run = true;
function foo(){
if (run){
setTimeout(foo, 500);
}
}
function stop(){
run = false;
}
foo();
Run Code Online (Sandbox Code Playgroud)
然后等待停止,在继续之前调用按钮单击.但这是非常好的做法吗?
或者使用lambda函数作为customAlert的参数和一个"全局"变量,该变量保存我正在经历的数组的当前位置并使用函数执行此操作.像:检查数组是否仍然保持大于X的键.然后再次执行该功能,每次增加全局X.
谢谢你输错代码:哦,我有个主意; 我只是在匿名函数中使用lostsource的解决方案,所以我不会得到全局变量.优秀.
(function(){
})();
Run Code Online (Sandbox Code Playgroud) 我们正在开发一个项目,有几个人拥有Mac,我在Windows上运行.我们在换行时遇到了一些问题.
我在GitHub上读到我可以添加这个:
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
Run Code Online (Sandbox Code Playgroud)
进入.gitattributes
但是我应该将该文件提交给GitHub,以便其他Mac用户获得相同的设置吗?
如果重要,我们正在编码网站.(PHP,JavaScript文件和东西).
为了记录,我是唯一一个拥有Windows的人...所以是的,我该怎么办?
我还在和Git挣扎.
事情是:
我们是两个人在一个项目上工作.
我创建了一个名为relation的master的新分支.
现在我的朋友已更新主人但需要我修复一些错误.
当我在Netbeans中切换到分支时,它给了我所有"关系" - 改变并希望我提交它们.
那不是我想要的!
Netbeans网站告诉我这个[切换到分支]:
Switch to Branch
Actor: User
Action: User wants to switch to a branch (see also Checkout)
"Priority:" 1
Scenario:
User selects a versioned context and invokes 'switch branch' from the main menu
User specifies the branch and additional options - keep local changes etc.
The working tree is switched to the specified branch
Run Code Online (Sandbox Code Playgroud)
和[结账]:
查看
Actor: User
Action: User wants to checkout a specific revision/tag/branch
"Priority:" 1
Scenario:
User selects …Run Code Online (Sandbox Code Playgroud) 我试图谷歌这个,但我想要一劳永逸的答案.
无论您是否可以将业务逻辑放在模型中,我们都在讨论工作.
例如,如果要确保您的id在数据库中设置为int.你可以intval($id)在模型课中做一个吗?或者如果文字输入太短.或者你"必须"在控制器中做到这一点?
哪种方法正确?
对我来说,诸如计算之类的东西以及你在模型中不想要的其他东西(应该非常干净)应该在控制器中.
我很抱歉可能重复.