サポートされているランタイム関数とオブジェクト
マッシュアップ内のセキュリティで保護されていない関数を置き換える際、関数式をレビューして更新しなければなりません。マッシュアップのランタイムの問題と、新しい標準関数による予期しない動作を回避するには、次の表に示すオブジェクトおよび関数への参照を削除しなければなりません。
廃止予定のオブジェクトと関数
オブジェクト名または関数名
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
ランタイムドキュメントのタイトル
TW.Runtime.updateDocumentTitle('')
TW.Runtime.updateDocumentTitle('Title')
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();
セッションストレージ
TW.sessionStorage.getItem()
TW.sessionStorage.setItem()
TW.sessionStorage.removeItem()
TW.sessionStorage.clear()
Timeout
TW.setTimeout
TW.setTimeout(() => {
TW.log.info("Delayed for 1 second.")
}, "1000");
これは役に立ちましたか?