class goog.plus.Stream

2011-07-02 11:32:48 +08:00
 chone
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();
};
3440 次点击
所在节点    随想
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/15225

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX