History

fix thread safety issue on JS based fliters

Brad Hefta-Gaub committed 11 years ago

Commit 7956d731 parent 7d48fe95 files · +74 −26Browse files

Showing the changes to examples/example/scripts/controllerScriptingExamples.js (1 of 5 files). Show all

Unified · Split

examples/example/scripts/controllerScriptingExamples.js+10−6
@@ -23,17 +23,21 @@ function findAction(name) { · 22 unmodified lines
2323 }
2424
2525
26−var hydra = Controller.Hardware.Hydra2;
26+var hydra = Controller.Hardware.Hydra;
2727 if (hydra !== undefined) {
2828 print("-----------------------------------");
29− var mapping = NewControllers.newMapping("Default");
29+ var mapping = Controller.newMapping("Test");
3030 var standard = Controller.Standard;
3131 print("standard:" + standard);
32− mapping.from(hydra.LeftButton1).to(standard.A);
33− mapping.from(hydra.LeftButton2).to(standard.B);
34− mapping.from(hydra.LeftButton3).to(standard.X);
35− NewControllers.enableMapping("Default");
32+ mapping.from(hydra.L1).to(standard.A);
33+ mapping.from(hydra.L2).to(standard.B);
34+ mapping.from(hydra.L3).to(function (newValue, oldValue, source) {
35+ print("hydra.L3 newValue:" + newValue + ", oldValue:" + oldValue + ", source:" + source);
36+ });
37+ Controller.enableMapping("Test");
3638 print("-----------------------------------");
39+} else {
40+ print("couldn't find hydra");
3741 }
3842
3943 Object.keys(Controller.Standard).forEach(function (input) {