Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24100] Windows: Ability to define native custom class

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 5.4.0
Fix Version/sn/a
ComponentsWindows
Labelshyperloop-windows
ReporterKota Iguchi
AssigneeKota Iguchi
Created2016-11-04T06:22:17.000+0000
Updated2017-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)

Comments

No comments

JSON Source