Mashup Builder > 移轉舊有混搭 > 取代混搭中的不安全運算式 > 支援的執行時間函數與物件
支援的執行時間函數與物件
取代混搭中的不安全函數時,您必須檢閱及更新函數運算式。為了避免混搭執行時間問題及新標準函數發生非預期行為,您必須移除下表中所列物件與函數的任何參考。
已淘汰的物件與函數
物件或函數名稱
範例
location
location.reload();
location.hostName !== 'localhost';
* 
此物件已由 TW.location 所取代。
widget
widget.getProperty('DisplayName') === ‘ptcs-grid2’;
widget.mashup.rootWidget.getProperty('remoteAccessibleThing') == null; widget.mashup.rootWidget.getWidgets()[1].getProperty('SelectedText') == null;
history
history.back();
TW.Runtime.<any object>.(<any function>)
Output = TW.Runtime.Widgets.PTC_SCA_SCO_CustomFunctions.isSecure();
TW.Runtime.showHideDataFilterWidgets($(\body"), false);
Output = TW.Runtime.Widgets.PTC_SCA_SCO_CustomFunctions.getURLParameter(“mashup",url);
TW.Runtime.Widgets.AssetMonitor.refreshNeeded(isSelected,selectedTreeNode,selectedContext);
TW.Runtime.AssetMonitor.assetPropertyTitles(widget);
TW.Runtime.AssetMonitor.assetPropertyTitles(widget);
jqElement
widget.jqElement.triggerHandler('Changed');
screen
* 
在 ThingWorx 9.3.8 與 9.2.13 或更新版本中,此物件已由 TW.screen 所取代。
screen.width
screen.height
screen.availHeight
screen.availWidth
self
const displayName = self['DisplayName'];
sessionStorage
sessionStorage.setItem('key', ‘value’);
* 
已淘汰的函數與物件僅在不安全函數中受支援。
支援的物件與函數
下表列出了最新標準版本「驗證器」與「運算式」函數中支援的物件與函數:
類別
物件與函數
範例
位置
TW.location.hash
TW.location.host
TW.location.hostname
TW.location.href
TW.location.origin
TW.location.pathname
TW.location.port
TW.location.protocol
TW.location.search
TW.location.reload()
TW.location.reload();
TW.location.hostName !== ‘localhost’;
當地語系化
TW.Runtime.convertLocalizableString('[[token name]]')
Output = TW.Runtime.convertLocalizableString(“[[userName”]]);
記錄
TW.log.info()
TW.log.debug()
TW.log.warning()
TW.log.error()
TW.log.debug('Logging to mashup console');
執行時間根混搭
TW.Runtime.pageMashupName
TW.Runtime.actualMasterName
TW.Runtime.RootMashup.ConfigurationTables
TW.Runtime.RootMashup.CustomMashupCss
TW.Runtime.RootMashup.Data
TW.Runtime.RootMashup.DataBindings
TW.Runtime.RootMashup.Events
TW.Runtime.RootMashup.UI
TW.Runtime.RootMashup.mashupName
Output = TW.Runtime.RootMashup.mashupName;
Output = TW.Runtime.Workspace.Mashups.Current.UI.Widgets[0].Properties.Id;
Output = TW.Runtime.Workspace.Mashups.Current.Events[0].EventHandlerService;
Output = TW.Runtime.Workspace.Mashups.Current.Data.Session.UserExtension.Services[0].APIMethod;
Output = TW.Runtime.RootMashup.UI.Widgets[1].properties.SelectedText;
執行時間工作區
TW.Runtime.Workspace.Mashups.CurrentMashupName
TW.Runtime.Workspace.Mashups.CurrentParameters
TW.Runtime.Workspace.Mashups.Current.ConfigurationTables
TW.Runtime.Workspace.Mashups.Current.CustomMashupCss
TW.Runtime.Workspace.Mashups.Current.Data
TW.Runtime.Workspace.Mashups.Current.DataBindings
TW.Runtime.Workspace.Mashups.Current.Events
TW.Runtime.Workspace.Mashups.Current.UI
TW.Runtime.Workspace.Mashups.Current.mashupName
Output = TW.Runtime.Workspace.Mashups.CurrentMashupName;
執行時間螢幕高度與寬度
TW.screen.width
TW.screen.height
TW.screen.availHeight
TW.screen.availWidth
Output = TW.screen.width
HTTP 請求
XMLHttpRequest
let xhr = new XMLHttpRequest(); xhr.open('GET', 'http://localhost:9000/Thingworx/Users/Administrator/Properties', true); xhr.onload = function () { console.log('the value is '+ xhr.responseText); }; xhr.send();
這是否有幫助?