这非常令人讨厌..我想知道为什么我的更改没有反映出来,因为我注意到我的Web Worker的JavaScript文件总是从缓存中加载:
我已禁用缓存,但Ctrl + F5
命中也无效。
如何确保此文件 从缓存加载?
_worker = new Worker('js/toy-cpu.js');
答案 0 :(得分:0)
您可以添加一种版本号,例如:
class Person {
private int age;
private int math;
public Person(int age, int math) {
this.age = age;
this.math = math;
}
public int getAge() {
return this.age;
}
public int getMath() {
return this.math;
}
//setters avoided for this case
}
class TestScanner {
Scanner scanner;
public TestScanner(Scanner scanner) {
this.scanner = scanner;
}
public Person grabInput() {
System.out.println("What is my age: ");
int age = stdin.nextInt();
System.out.println("What is 2 +2: ");
int math = stdin.nextInt();
return new Person(age, math);
}
public void displayInput(Person person) {
System.out.print("My age: ");
System.out.println(person.getAge());
System.out.print("My value of 2 +2: ");
System.out.println(person.getMath());
}
public static void main(String[] args) {
TestScanner testScanner = new TestScanner(new Scanner(System.in));
Person person = testScanner.grabInput();
testScanner.displayInput(person);
}
}
答案 1 :(得分:0)