Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

[Nativescript] Plugin Development Help Please #124

Open
roblav96 opened this issue Aug 29, 2016 · 0 comments
Open

[Nativescript] Plugin Development Help Please #124

roblav96 opened this issue Aug 29, 2016 · 0 comments

Comments

@roblav96
Copy link

Hello! I just started getting into native app development using NativeScript and I'm attempting to develop a plugin for this repository.

Here are the TypeScript declarations file generated for Bolts-Android:
(Sorry, I would make a gist but there's no TypeScript syntax support 😭 )

/// <reference path="./java.io.PrintStream.d.ts" />
/// <reference path="./java.io.PrintWriter.d.ts" />
/// <reference path="./java.lang.String.d.ts" />
/// <reference path="./java.lang.Throwable.d.ts" />
/// <reference path="./java.util.List.d.ts" />
declare module bolts {
    export class AggregateException exports java.lang.Exception {
        public constructor();
        public constructor(param0: string);
        public constructor(param0: string, param1: java.lang.Throwable);
        public constructor(param0: java.lang.Throwable);
        public constructor(param0: string, param1: native.Array<java.lang.Throwable>);
        public constructor();
        public constructor(param0: string);
        public constructor(param0: string, param1: java.lang.Throwable);
        public constructor(param0: java.lang.Throwable);
        public constructor(param0: string, param1: java.util.List);
        public constructor();
        public constructor(param0: string);
        public constructor(param0: string, param1: java.lang.Throwable);
        public constructor(param0: java.lang.Throwable);
        public constructor(param0: java.util.List);
        public getInnerThrowables(): java.util.List;
        public printStackTrace(): void;
        public printStackTrace(param0: java.io.PrintWriter): void;
        public printStackTrace(param0: java.io.PrintStream): void;
        public printStackTrace(): void;
        public printStackTrace(param0: java.io.PrintStream): void;
        public printStackTrace(param0: java.io.PrintWriter): void;
        public getErrors(): java.util.List;
        public getCauses(): native.Array<java.lang.Throwable>;
    }
}

/// <reference path="./java.lang.Runnable.d.ts" />
/// <reference path="./java.util.concurrent.Executor.d.ts" />
/// <reference path="./java.util.concurrent.ExecutorService.d.ts" />
/// <reference path="./java.util.concurrent.ThreadFactory.d.ts" />
/// <reference path="./java.util.concurrent.ThreadPoolExecutor.d.ts" />
declare module bolts {
    export class AndroidExecutors exports java.lang.Object {
        public static newCachedThreadPool(): java.util.concurrent.ExecutorService;
        public static newCachedThreadPool(param0: java.util.concurrent.ThreadFactory): java.util.concurrent.ExecutorService;
        public static allowCoreThreadTimeout(param0: java.util.concurrent.ThreadPoolExecutor, param1: boolean): void;
        public static uiThread(): java.util.concurrent.Executor;
    }
    export module AndroidExecutors {
        export class UIThreadExecutor exports java.lang.Object {
            public execute(param0: java.lang.Runnable): void;
        }
    }
}

/// <reference path="./java.lang.Runnable.d.ts" />
/// <reference path="./java.util.concurrent.ExecutorService.d.ts" />
declare module bolts {
    export class BoltsExecutors exports java.lang.Object {
        public static background(): java.util.concurrent.ExecutorService;
    }
    export module BoltsExecutors {
        export class ImmediateExecutor exports java.lang.Object {
            public execute(param0: java.lang.Runnable): void;
        }
    }
}

/// <reference path="./bolts.CancellationTokenRegistration.d.ts" />
/// <reference path="./java.lang.Runnable.d.ts" />
declare module bolts {
    export class CancellationToken exports java.lang.Object {
        public isCancellationRequested(): boolean;
        public register(param0: java.lang.Runnable): bolts.CancellationTokenRegistration;
        public throwIfCancellationRequested(): void;
        public toString(): string;
    }
}

declare module bolts {
    export class CancellationTokenRegistration exports java.lang.Object {
        public close(): void;
    }
}

/// <reference path="./bolts.CancellationToken.d.ts" />
declare module bolts {
    export class CancellationTokenSource exports java.lang.Object {
        public constructor();
        public isCancellationRequested(): boolean;
        public getToken(): bolts.CancellationToken;
        public cancel(): void;
        public cancelAfter(param0: number): void;
        public close(): void;
        public toString(): string;
    }
}

/// <reference path="./java.lang.Object.d.ts" />
declare module bolts {
    export class Capture exports java.lang.Object {
        public constructor();
        public constructor();
        public constructor(param0: java.lang.Object);
        public get(): java.lang.Object;
        public set(param0: java.lang.Object): void;
    }
}

/// <reference path="./bolts.Task.d.ts" />
/// <reference path="./java.lang.Object.d.ts" />
declare module bolts {
    export class Continuation exports java.lang.Object {
        public then(param0: bolts.Task): java.lang.Object;
    }
}

/// <reference path="./java.lang.Exception.d.ts" />
/// <reference path="./java.lang.String.d.ts" />
/// <reference path="./java.lang.Throwable.d.ts" />
declare module bolts {
    export class ExecutorException exports java.lang.RuntimeException {
        public constructor();
        public constructor(param0: string);
        public constructor(param0: string, param1: java.lang.Throwable);
        public constructor(param0: java.lang.Throwable);
        public constructor(param0: java.lang.Exception);
    }
}

/// <reference path="./bolts.CancellationToken.d.ts" />
/// <reference path="./bolts.Continuation.d.ts" />
/// <reference path="./bolts.Task.d.ts" />
/// <reference path="./bolts.UnobservedTaskException.d.ts" />
/// <reference path="./java.lang.Exception.d.ts" />
/// <reference path="./java.lang.Object.d.ts" />
/// <reference path="./java.util.Collection.d.ts" />
/// <reference path="./java.util.concurrent.Callable.d.ts" />
/// <reference path="./java.util.concurrent.Executor.d.ts" />
/// <reference path="./java.util.concurrent.ExecutorService.d.ts" />
/// <reference path="./java.util.concurrent.TimeUnit.d.ts" />
declare module bolts {
    export class Task exports java.lang.Object {
        public static getUnobservedExceptionHandler(): bolts.Task.UnobservedExceptionHandler;
        public static setUnobservedExceptionHandler(param0: bolts.Task.UnobservedExceptionHandler): void;
        public static create(): bolts.Task.TaskCompletionSource;
        public isCompleted(): boolean;
        public isCancelled(): boolean;
        public isFaulted(): boolean;
        public getResult(): java.lang.Object;
        public getError(): java.lang.Exception;
        public waitForCompletion(): void;
        public waitForCompletion(param0: number, param1: java.util.concurrent.TimeUnit): boolean;
        public static forResult(param0: java.lang.Object): bolts.Task;
        public static forError(param0: java.lang.Exception): bolts.Task;
        public static cancelled(): bolts.Task;
        public static delay(param0: number): bolts.Task;
        public static delay(param0: number, param1: bolts.CancellationToken): bolts.Task;
        public cast(): bolts.Task;
        public makeVoid(): bolts.Task;
        public static callInBackground(param0: java.util.concurrent.Callable): bolts.Task;
        public static callInBackground(param0: java.util.concurrent.Callable, param1: bolts.CancellationToken): bolts.Task;
        public static call(param0: java.util.concurrent.Callable, param1: java.util.concurrent.Executor): bolts.Task;
        public static call(param0: java.util.concurrent.Callable, param1: java.util.concurrent.Executor, param2: bolts.CancellationToken): bolts.Task;
        public static call(param0: java.util.concurrent.Callable): bolts.Task;
        public static call(param0: java.util.concurrent.Callable, param1: bolts.CancellationToken): bolts.Task;
        public static whenAnyResult(param0: java.util.Collection): bolts.Task;
        public static whenAny(param0: java.util.Collection): bolts.Task;
        public static whenAllResult(param0: java.util.Collection): bolts.Task;
        public static whenAll(param0: java.util.Collection): bolts.Task;
        public continueWhile(param0: java.util.concurrent.Callable, param1: bolts.Continuation): bolts.Task;
        public continueWhile(param0: java.util.concurrent.Callable, param1: bolts.Continuation, param2: bolts.CancellationToken): bolts.Task;
        public continueWhile(param0: java.util.concurrent.Callable, param1: bolts.Continuation, param2: java.util.concurrent.Executor): bolts.Task;
        public continueWhile(param0: java.util.concurrent.Callable, param1: bolts.Continuation, param2: java.util.concurrent.Executor, param3: bolts.CancellationToken): bolts.Task;
        public continueWith(param0: bolts.Continuation, param1: java.util.concurrent.Executor): bolts.Task;
        public continueWith(param0: bolts.Continuation, param1: java.util.concurrent.Executor, param2: bolts.CancellationToken): bolts.Task;
        public continueWith(param0: bolts.Continuation): bolts.Task;
        public continueWith(param0: bolts.Continuation, param1: bolts.CancellationToken): bolts.Task;
        public continueWithTask(param0: bolts.Continuation, param1: java.util.concurrent.Executor): bolts.Task;
        public continueWithTask(param0: bolts.Continuation, param1: java.util.concurrent.Executor, param2: bolts.CancellationToken): bolts.Task;
        public continueWithTask(param0: bolts.Continuation): bolts.Task;
        public continueWithTask(param0: bolts.Continuation, param1: bolts.CancellationToken): bolts.Task;
        public onSuccess(param0: bolts.Continuation, param1: java.util.concurrent.Executor): bolts.Task;
        public onSuccess(param0: bolts.Continuation, param1: java.util.concurrent.Executor, param2: bolts.CancellationToken): bolts.Task;
        public onSuccess(param0: bolts.Continuation): bolts.Task;
        public onSuccess(param0: bolts.Continuation, param1: bolts.CancellationToken): bolts.Task;
        public onSuccessTask(param0: bolts.Continuation, param1: java.util.concurrent.Executor): bolts.Task;
        public onSuccessTask(param0: bolts.Continuation, param1: java.util.concurrent.Executor, param2: bolts.CancellationToken): bolts.Task;
        public onSuccessTask(param0: bolts.Continuation): bolts.Task;
        public onSuccessTask(param0: bolts.Continuation, param1: bolts.CancellationToken): bolts.Task;
        public static BACKGROUND_EXECUTOR: java.util.concurrent.ExecutorService;
        public static UI_THREAD_EXECUTOR: java.util.concurrent.Executor;
    }
    export module Task {
        export class TaskCompletionSource exports bolts.TaskCompletionSource {
        }
        export class UnobservedExceptionHandler exports java.lang.Object {
            public unobservedException(param0: bolts.Task, param1: bolts.UnobservedTaskException): void;
        }
    }
}

/// <reference path="./bolts.Task.d.ts" />
/// <reference path="./java.lang.Exception.d.ts" />
/// <reference path="./java.lang.Object.d.ts" />
declare module bolts {
    export class TaskCompletionSource exports java.lang.Object {
        public constructor();
        public getTask(): bolts.Task;
        public trySetCancelled(): boolean;
        public trySetResult(param0: java.lang.Object): boolean;
        public trySetError(param0: java.lang.Exception): boolean;
        public setCancelled(): void;
        public setResult(param0: java.lang.Object): void;
        public setError(param0: java.lang.Exception): void;
    }
}

/// <reference path="./bolts.Task.d.ts" />
declare module bolts {
    export class UnobservedErrorNotifier exports java.lang.Object {
        public constructor();
        public constructor(param0: bolts.Task);
        public finalize(): void;
        public setObserved(): void;
    }
}

/// <reference path="./java.lang.String.d.ts" />
/// <reference path="./java.lang.Throwable.d.ts" />
declare module bolts {
    export class UnobservedTaskException exports java.lang.RuntimeException {
        public constructor();
        public constructor(param0: string);
        public constructor(param0: string, param1: java.lang.Throwable);
        public constructor(param0: java.lang.Throwable);
    }
}

I'm following the README.md in an attempt to create a Task on a background thread. In the part on creating-async-methods, what class is the new GetCallback() method in?

My basic Task looks like this:

doSomethingAsync() {
    return bolts.Task.call(new bolts.Continuation(class {
        done(t) {
            console.dump(t);
            return t
        }
    }), bolts.Task.BACKGROUND_EXECUTOR)
}

But I get an error, could not resolve method bolts.Task.call.

Does anyone have an experience with TypeScript that can point me in the right direction?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant