Angular 2 with Google Drive Realtime API

前端 未结 1 760
感动是毒
感动是毒 2021-01-02 01:17

I\'m looking to create a new application based on the Drive Realtime API and want to do it with the shiny new Angular 2 framework. However

相关标签:
1条回答
  • 2021-01-02 02:04

    You can download the declaration file (*.d.ts) for the Google Drive Realtime API here. This provides a TypeScript wrapper for the API. Specifically, it defines a module named gapi.drive.realtime whose classes can be accessed in Angular2.

    To tell the compiler about the declaration file, you need to add the following line to your TypeScript source file:

    ///<reference path="google-drive-realtime-api.d.ts" />
    

    Then you need to import the module's features. One way to do this is with the following import command:

    import * as Drive from "gapi.drive.realtime";
    

    Then you can access the module's classes under the Drive namespace: Drive.Collaborator, Drive.CollaborativeObject, and so on.

    0 讨论(0)
提交回复
热议问题