V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
chone
V2EX  ›  随想

class goog.plus.Stream

  •  
  •   chone · 2011-07-02 11:32:48 +08:00 · 3354 次点击
    这是一个创建于 4689 天前的主题,其中的信息可能已经有所发展或是发生改变。
    goog.provide('goog.plus.Stream');

    goog.require('facebook.Stream');

    /**
    * A stream of google+.
    *@param{string} content The content
    *@param{google.plus.User} user A user of google+
    *@param{array<google.plus.Circle>} circles List of circle
    *@constructor
    *@extends facebook.Stream
    */
    goog.plus.Stream = function(content, user, circles) {
    facebook.Stream.call(this, content, user);
    goog.plus.Stream.superClass_.clearGames();
    this.circles_ = circles;
    };
    goog.inherits(goog.plus.Stream, facebook.Stream);

    /**
    * Circles of Stream
    *@type{Array<goog.plus.Circle>}
    *@private
    */
    goog.plus.Stream.prototype.circles_ = [];

    /**
    * Returns list of circles.
    *@return{Array<goog.plus.Circle>}
    */
    goog.plus.Stream.prototype.getCircles = function() {
    return this.circles_;
    };

    /**
    * Set circles
    *@param{Array<goog.plus.Circle>} circles
    */
    goog.plus.Stream.prototype.SetCircles = function(circles) {
    this.circles_ = circles;
    };

    /**
    * Add a circle
    *@param{goog.plus.Circle} circle
    */
    goog.plus.Stream.prototype.addCircle = function(circle) {
    this.circles_.push(circle);
    };

    /**
    * Remove a circle
    *@param{goog.plus.Circle} circle
    *@return{goog.plus.Circle|null} circle removed
    */
    goog.plus.Stream.prototype.removeCircle = function(circle) {
    var index = this.circles_.indexOf(circle);
    return index > -1 ? this.circles_.splice(index,1)[0] : null;
    };

    /**
    *@override
    */
    goog.plus.Stream.prototype.post = function() {
    if (this.circles_.length <= 0) {
    throw 'a circle needed!';
    }
    goog.plus.Stream.superClass_.post();
    };
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2219 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 05:59 · PVG 13:59 · LAX 22:59 · JFK 01:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.