2016-10-06 7 views
0

타사 네이티브 플러그인을 사용하는 tns 플러그인을 만들려고합니다.typescript를 컴파일 할 수 없습니다

제 3 자 네이티브 플러그인을이 응용 프로그램에서 바로 사용할 수있었습니다. http://developer.telerik.com/featured/using-native-libraries-in-nativescript/

tns 플러그인에서 어떻게 api를 사용할 수 있습니까?

  1. 은 내가
  2. android { 
    productFlavors { 
        "nativescriptcardview" { 
         dimension "nativescriptcardview" 
        } 
    } 
    } 
    
    dependencies { 
        def supportVer = "22.2.0"; 
    
        if(project.hasProperty("supportVersion")) { 
        supportVer = supportVersion 
        } 
    
    compile 'hanks.xyz:smallbang-library:0.1.2' 
    } 
    
  3. 이 같은 plugin.android.ts에서 호출을 시도

    include.gradle에 추가 include.gradle 플랫폼/안드로이드를 생성/
  4. https://github.com/NathanWalker/nativescript-plugin-seed를 복제 .

    import {Common} from "./plugin.common"; 
    import * as app from "application"; 
    
    export class Plugin extends Common { 
        bangThis(args) { 
        var mSmallBang = new xyz.hanks.library.SmallBang.attach2Window(app.android.foregroundActivity); 
        mSmallBang.bang(args.object.android); 
        } 
    } 
    

그러나 TSC가 컴파일되지 않습니다는 plugin.android.ts(7,26): error TS2304: Cannot find name 'xyz'.

+0

나는 알았다. 정의가 필요했습니다. like https://github.com/NativeScript/nativescript-fresco/blob/master/nativescript-fresco.android-map.d.ts – matar

답변

관련 문제