Skip to content

3.0.0-beta1

Pre-release
Pre-release
Compare
Choose a tag to compare
@tbuschto tbuschto released this 02 Oct 10:28
· 653 commits to master since this release

Workers

You can now run code in parallel. Not only can that give you a performance boost for CPU intensive tasks, it prevents the UI from becoming unresponsive. The Worker API follows the w3c worker API so it should be very familiar.

const worker = new Worker('worker-add-numbers.js');
  worker.onmessage = (event) => {
    console.log(`result: ${event.data}`);
    worker.terminate();
  };
  worker.onerror = (error) => {
    console.log(`onerror: ${JSON.stringify(error)}`);
    worker.terminate();
  };
  worker.postMessage([number1, number2]);

New Event API

For Tabris 3.0 we ported the enhanced event API introduced in the tabris-decorators project to the core module. It does not replace the old API, but offers a more convenient, higher level interface especially useful for TypeScript projects and asynchronous programming via async/await.

(async function() {  
  textView.onTextChanged(handleTextChanged);   
  textView.text = 'Tap here!';  
  await textView.onTap.resolve();  
  textView.text = 'Thank you!';
}());

JSX and TypeScript improvements

For Beta 1 we revised many internals to help with future JSX and TypeScript enhancements. A number of APIs have been tweaked for convenience and consistency. Most notably, JSX elements now always need to be imported.

Also, ActionSheet popups can now be created via JSX:

  ActionSheet.open(
    <ActionSheet title='Actions' onSelect={onSelect} onClose={onClose}>
      Select any of the actions below to proceed.
      <ActionSheetItem title='Search' image='resources/search-black-24dp@3x.png' />
      <ActionSheetItem title='Share' image='resources/share-black-24dp@3x.png' />
      <ActionSheetItem title='Settings' image='resources/settings-black-24dp@3x.png' />
      <ActionSheetItem title='Delete' style='destructive' image='resources/delete-black-24dp@3x.png' />
      <ActionSheetItem title='Cancel' style='cancel' image='resources/close-black-24dp@3x.png' />
    </ActionSheet>
  );

Image scale by convention

Providing images for high density displays does not require you to give a scale factor explicitly if it can be determined by the file name:

<ActionSheetItem image={{src: 'resources/search-black-24dp@3x.png', scale: 3}} />

Can be replaced by this:

<ActionSheetItem image='resources/search-black-24dp@3x.png' />

New property scrollbarVisible on ScrollView

The ScrollView received a new property to scrollbarVisible which allows to hide the scrollbars.