0
如何將此語言環境變量放入主腳本中。我怎樣才能從它做一個全局變量?此變體不起作用,感謝您的幫助。如何將此語言環境變量放入主腳本。
//Test Script local to global
(function (exampleCode) {
\t "use strict";
\t
var wert = 0.5;
var name = 'wert';
Object.assign(exampleCode, {
\t getValue: function() {
\t return name;
\t }
\t });
\t
})(window.exampleCode = window.exampleCode || {});
/////////////////////////////////////////////////////////////////////
//main script get 'var wert = 0.5' from Test Script
var update = function() {
\t \t requestAnimationFrame(update); \t \t \t \t \t \t
\t \t \t //var value = wert; //0.5
\t \t \t console.log(exampleCode.getValue());
\t \t \t mesh.morphTargetInfluences[ 40 ] = params.influence1 = value; \t \t
\t \t }; \t
\t \t \t
\t \t update(); \t \t
是,此後正是我尋覓了,謝謝您 – Tom