[TIMOB-24100] Windows: Ability to define native custom class
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 5.4.0 |
Fix Version/s | n/a |
Components | Windows |
Labels | hyperloop-windows |
Reporter | Kota Iguchi |
Assignee | Kota Iguchi |
Created | 2016-11-04T06:22:17.000+0000 |
Updated | 2017-04-29T13:54:18.000+0000 |
Description
Need ability to dynamically create your own WinRT classes at runtime. Once created, these classes can be used as normal in either Hyperloop or passed to native calls.
Here's how Hyperloop for iOS does:
var MyView = Hyperloop.defineClass('MyClass', 'UIView', ['UIAppearance']);
MyView.addMethod({
selector: 'drawRect:',
instance: true,
arguments: ['CGRect'],
callback: function (rect) {
// this code is executed when the drawRect: delegate is called
}
});
Here's how Hyperloop for Android does:
var Activity = require('android.app.Activity'),
activity = new Activity(Ti.Android.currentActivity),
View = require('android.view.View');
var MyView = android.view.View.extend({
onDraw: function(canvas) {
// implementation here
}
});
FYI: [iOS Hyperloop Programming Guide](http://docs.appcelerator.com/platform/latest/#!/guide/iOS_Hyperloop_Programming_Guide) and [Android Hyperloop Programming Guide](http://docs.appcelerator.com/platform/latest/#!/guide/Android_Hyperloop_Programming_Guide)
No comments