mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
updated camera & console
This commit is contained in:
@ -36,8 +36,7 @@ function topViewControllerWithRootViewController(rootViewController: any) {
|
||||
export var takePicture = function (options?: types.Options): promises.Promise<imageSource.ImageSource> {
|
||||
var d = promises.defer<imageSource.ImageSource>();
|
||||
|
||||
// FIXME: this is done to prevent listener from being freed by JS garbage collector
|
||||
// we will try to fix this at JS Bridge level
|
||||
// This is done to prevent listener from being freed by JS garbage collector
|
||||
var listener;
|
||||
|
||||
var ImagePickerControllerListener = Foundation.NSObject.extends({
|
||||
@ -49,7 +48,6 @@ export var takePicture = function (options?: types.Options): promises.Promise<im
|
||||
imagePickerControllerDidFinishPickingMediaWithInfo: function (picker, info) {
|
||||
console.log('takeImage received');
|
||||
picker.presentingViewController.dismissViewControllerAnimatedCompletion(true, null);
|
||||
// FIXME: do not work with listener here
|
||||
listener = null;
|
||||
var image = imageSource.fromNativeSource(info.valueForKey(UIKit.UIImagePickerControllerOriginalImage));
|
||||
d.resolve(image);
|
||||
@ -58,7 +56,6 @@ export var takePicture = function (options?: types.Options): promises.Promise<im
|
||||
imagePickerControllerDidCancel: function (picker) {
|
||||
console.info('takeImage canceled');
|
||||
picker.presentingViewController.dismissViewControllerAnimatedCompletion(true, null);
|
||||
// FIXME: do not work with listener here
|
||||
listener = null;
|
||||
d.reject(new Error('takePicture canceled by user'));
|
||||
}
|
||||
|
5
console/console.d.ts
vendored
5
console/console.d.ts
vendored
@ -61,4 +61,9 @@ export declare class Console {
|
||||
* @param obj The object instance to be dumped.
|
||||
*/
|
||||
public dump(obj: any): void;
|
||||
|
||||
/**
|
||||
* Prints the state of the specified object to the console.
|
||||
*/
|
||||
public dir(obj: any): void;
|
||||
}
|
@ -320,4 +320,6 @@ export class Console {
|
||||
result.push('=== dump(): finished ===');
|
||||
this.log(result.join('\n'));
|
||||
}
|
||||
|
||||
public dir = this.dump;
|
||||
}
|
1
declarations.d.ts
vendored
1
declarations.d.ts
vendored
@ -20,6 +20,7 @@ declare module i {
|
||||
log(message: any, ...optionalParams: any[]): void;
|
||||
trace(): void;
|
||||
dump(obj: any): void;
|
||||
dir(obj: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user