Mashup Builder > Migrazione dei mashup legacy > Sostituzione di espressioni non protette in un mashup > Funzioni e oggetti della fase di esecuzione supportati
Funzioni e oggetti della fase di esecuzione supportati
Quando si sostituiscono funzioni non protette in un mashup, è necessario esaminare e aggiornare le espressioni di funzione. Per evitare problemi in fase di esecuzione del mashup e comportamenti imprevisti con le nuove funzioni standard, è necessario rimuovere tutti i riferimenti alle funzioni e agli oggetti elencati nella tabella riportata di seguito.
Funzioni e oggetti obsoleti
Nome oggetto o funzione
Esempio
location
location.reload();
location.hostName !== ‘localhost’;
* 
L'oggetto viene sostituito da 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
* 
Questo oggetto viene sostituito da TW.screen in ThingWorx 9.3.8 e 9.2.13 o versioni successive.
screen.width
screen.height
screen.availHeight
screen.availWidth
self
const displayName = self['DisplayName'];
sessionStorage
sessionStorage.setItem('key', ‘value’);
* 
Le funzioni e gli oggetti obsoleti sono supportati solo nelle funzioni non protette.
Funzioni e oggetti supportati
Nella tabella seguente sono elencate le funzioni e gli oggetti supportati nelle versioni standard più recenti delle funzioni di espressione e di convalida:
Categoria
Oggetti e funzioni
Esempi
Posizione
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’;
Localizzazione
TW.Runtime.convertLocalizableString('[[token name]]')
Output = TW.Runtime.convertLocalizableString(“[[userName”]]);
Registrazione
TW.log.info()
TW.log.debug()
TW.log.warning()
TW.log.error()
TW.log.debug('Logging to mashup console');
Mashup radice fase di esecuzione
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;
Workspace fase di esecuzione
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;
Altezza e larghezza schermo fase di esecuzione
TW.screen.width
TW.screen.height
TW.screen.availHeight
TW.screen.availWidth
Output = TW.screen.width
Richieste 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();
È stato utile?