<commit_before>/// <reference path="../handler/queue.ts" />
/// <reference path="../third_party/typings/es6-promise/es6-promise.d.ts" />
/// <reference path="../third_party/typings/webrtc/RTCPeerConnection.d.ts" />

declare module WebRtc {

  interface Data {
    // Only one of these should be specified.
    // TODO: use union type once it is supported in TypeScript.
    str    ?:string;
    buffer ?:Uint8Array;
  }

  class DataChannel {
    constructor(rtcDataChannel: RTCDataChannel);

    // Guarenteed to be invarient for the life of the data channel.
    public getLabel :() => string;
    public getState :() => string;  // 'connecting', 'open', 'closed'

    // Promise for when the data channel has been openned.
    public onceOpened :Promise<void>;

    // Promise for when the data channel has been closed (only fulfilled after
    // the data channel has been openned).
    // NOTE: There exists a bug in Chrome prior to version 37 which prevents
    //       this promise from fulfilling on the remote peer.
    public onceClosed :Promise<void>;

    // Data from the peer. No data will be added to the queue after |onceClosed|
    // is fulfilled.
    public fromPeerDataQueue :Handler.Queue<Data, void>;

    // Send data; promise returns when all the data has been passed on to the
    // undertlying network layer for ending.
    public send :(data:Data) => Promise<void>;

    // Closes this data channel.
    // A channel cannot be re-opened once this has been called.<commit_msg>another typo<commit_after>/// <reference path="../handler/queue.ts" />
/// <reference path="../third_party/typings/es6-promise/es6-promise.d.ts" />
/// <reference path="../third_party/typings/webrtc/RTCPeerConnection.d.ts" />

declare module WebRtc {

  interface Data {
    // Only one of these should be specified.
    // TODO: use union type once it is supported in TypeScript.
    str    ?:string;
    buffer ?:Uint8Array;
  }

  class DataChannel {
    constructor(rtcDataChannel: RTCDataChannel);

    // Guarenteed to be invarient for the life of the data channel.
    public getLabel :() => string;
    public getState :() => string;  // 'connecting', 'open', 'closed'

    // Promise for when the data channel has been openned.
    public onceOpened :Promise<void>;

    // Promise for when the data channel has been closed (only fulfilled after
    // the data channel has been openned).
    // NOTE: There exists a bug in Chrome prior to version 37 which prevents
    //       this from fulfilling on the remote peer.
    public onceClosed :Promise<void>;

    // Data from the peer. No data will be added to the queue after |onceClosed|
    // is fulfilled.
    public fromPeerDataQueue :Handler.Queue<Data, void>;

    // Send data; promise returns when all the data has been passed on to the
    // undertlying network layer for ending.
    public send :(data:Data) => Promise<void>;

    // Closes this data channel.
    // A channel cannot be re-opened once this has been called.
{'fraction_non_alphanumeric': 0.10603534511503834, 'fraction_numerical': 0.003334444814938313, 'mean_word_length': 2.8314176245210727, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6178163', 'n_tokens_mistral': 860, 'n_tokens_neox': 816, 'n_words': 337}