Details
-
Type:
New Feature
-
Status: Closed
-
Priority:
High
-
Resolution: Fixed
-
Affects Version/s: Hyperloop 3.0.3
-
Fix Version/s: Hyperloop 3.1.0
-
Component/s: Windows
-
Labels:
-
Story Points:8
-
Sprint:2018 Sprint 07 SDK
Description
ES6 import doesn't work for Hyperloop Windows because Hyperloop scans require and generates glue code before transpile (import to require) runs at compile time.
// ES5-style require call
|
var Int32 = require('System.Int32'); |
|
// ES6-style import
|
import Button from 'Windows.UI.Xaml.Controls.Button'; |
import PropertyValue from 'Windows.Foundation.PropertyValue'; |
import MessageDialog from 'Windows.UI.Popups.MessageDialog'; |
import UICommand from 'Windows.UI.Popups.UICommand'; |
|
let win = Ti.UI.createWindow({ backgroundColor: 'green' }), |
button = new Button(); |
|
button.Content = "PUSH"; |
button.addEventListener('Tapped', () => { |
const dialog = new MessageDialog('My Message'); |
dialog.Title = 'My Title'; |
dialog.DefaultCommandIndex = 0;
|
dialog.Commands.Add(new UICommand('OK', null, PropertyValue.CreateInt32(0))); |
dialog.Commands.Add(new UICommand('Cancel', null, PropertyValue.CreateInt32(1))); |
dialog.ShowAsync().then(function (command) { |
const id = Int32.cast(command.Id);
|
alert((id == 0) ? 'Pushed "OK"' : 'Pushed "Cancel"') |
});
|
});
|
|
win.add(button);
|
win.open();
|
Attachments
Issue Links
- relates to
-
TIMOB-25908 Windows: require/import with namespace for Hyperloop
-
- Closed
-