NativeScript / NativeScript/docs

Document @NativeClass and co.

Đang mở
#12 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
17
Fork
31
Merge trung bình
8 giờ 51 phút
Pull request đã merge (30 ngày)
2

Mô tả

From @vallemar

...how and when to use the @NativeClass or @Interface annotations, also how to add delegates in iOS. In general, how to access native under the most common situations

Example android class
@NativeClass()
@Interfaces([android.hardware.SensorEventListener])
class SensorEventListenerAndroid
  extends java.lang.Object
  implements android.hardware.SensorEventListener
{
  callback: (event: number[]) => void;
  callbackOnAccuracyChanged: (
    sensor: android.hardware.Sensor,
    accuracy: number
  ) => void;

  constructor(callback: (data) => void) {
    super();
    this.callback = callback;
    return global.__native(this);
  }

  onAccuracyChanged(sensor: android.hardware.Sensor, accuracy: number): void {
    if (this.callbackOnAccuracyChanged) {
      this.callbackOnAccuracyChanged(sensor, accuracy);
    }
  }

  onSensorChanged(event: android.hardware.SensorEvent): void {
    if (!event || (event.values.length === 0 && event.values[0])) return;
    this.callback(event.values as number[]);
  }
}

export { SensorEventListenerAndroid };

Document:

  • @NativeClass
  • @ObjCProtocols
  • @JavaProxy
  • @Interfaces
  • ... ?

Eventually, we'll consolidate all of these into the @NativeClass as parameters, but until then, let's document all of these.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng việc xem xét cấu trúc tài liệu NativeScript hiện có và ví dụ Android trong issue này, sau đó xác định hướng dẫn hiện tại cho @NativeClass, @ObjCProtocols, @JavaProxy và @Interfaces. Tài liệu hóa các mẫu truy cập native phổ biến trên Android và iOS, bao gồm cả delegate, đồng thời đảm bảo giải thích cách sử dụng và mục đích của từng annotation.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
android, ios, typescript
Lĩnh vực
documentation, mobile-dev
Loại issue
Tài liệu
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.