Documentation
¶
Index ¶
- Constants
- func APIAndHTMLMustBeConsistent(origins []string)
- func Adler32(s []byte) int32
- func CSRFTokenRefreshed(origins []string)
- func CantDrawFirstStrokeOnSomeoneElsesRoom(origins []string)
- func CheckStaticFiles(origins []string)
- func DrawOnRandomRoom(origins []string)
- func LoadIndexPage(origins []string) bool
- func LoadIndexPageWithSession(s *session.Session) bool
- func Matsuri(origins []string, timeout int)
- func RoomWithoutStrokeNotShownAtTop(origins []string)
- func StrokeReflectedToTop(origins []string)
- func TopPageContent(origins []string)
- func WatcherCountIncreases(origins []string)
- type Point
- type Response
- type Room
- type RoomWatcher
- type StaticFile
- type Stroke
- type StrokeLog
- type WatcherCountLog
Constants ¶
View Source
const (
StrokeReceiveScore int64 = 1
)
Variables ¶
This section is empty.
Functions ¶
func APIAndHTMLMustBeConsistent ¶
func APIAndHTMLMustBeConsistent(origins []string)
APIとHTMLの整合性が取れているかをチェック
func Adler32 ¶
copied from react's src/renderers/shared/utils/adler32.js BSD License
For React software ¶
Copyright (c) 2013-present, Facebook, Inc. All rights reserved.
func CantDrawFirstStrokeOnSomeoneElsesRoom ¶
func CantDrawFirstStrokeOnSomeoneElsesRoom(origins []string)
他人の作った部屋に最初の線を描けない
func DrawOnRandomRoom ¶
func DrawOnRandomRoom(origins []string)
/api/rooms にリクエストして、その中の一つの部屋を開いてstrokeをPOST
func RoomWithoutStrokeNotShownAtTop ¶
func RoomWithoutStrokeNotShownAtTop(origins []string)
線の描かれてない部屋はトップページに並ばない
func StrokeReflectedToTop ¶
func StrokeReflectedToTop(origins []string)
部屋を作って線を描くとトップページに出てくる & 線がSVGに反映される
func WatcherCountIncreases ¶
func WatcherCountIncreases(origins []string)
入室するとWatcherCountが増える 退室すると減るほうは、時間がたたないと正しい値に落ち着かないのでチェックしない
Types ¶
type Response ¶
type Response struct { Error string `json:"error,omitempty"` Room *Room `json:"room,omitempty"` Rooms []Room `json:"rooms,omitempty"` Stroke *Stroke `json:"stroke,omitempty"` Token string `json:"token,omitempty"` // /api/csrf_tokenはこっち CSRFToken string `json:"csrfToken,omitempty"` // HTMLの__ASYNC_PROPS__はこっち }
type Room ¶
type Room struct { ID int64 `json:"id" db:"id"` Name string `json:"name" db:"name"` CanvasWidth int `json:"canvas_width" db:"canvas_width"` CanvasHeight int `json:"canvas_height" db:"canvas_height"` CreatedAt time.Time `json:"created_at" db:"created_at"` Strokes []Stroke `json:"strokes"` StrokeCount int `json:"stroke_count"` WatcherCount int `json:"watcher_count"` }
type RoomWatcher ¶
type RoomWatcher struct { EndCh chan struct{} StrokeLogs []StrokeLog WatcherCountLogs []WatcherCountLog // contains filtered or unexported fields }
func NewRoomWatcher ¶
func NewRoomWatcher(target string, roomID int64) *RoomWatcher
func (*RoomWatcher) Leave ¶
func (w *RoomWatcher) Leave()
Watcherを部屋から退出させるために呼ぶ。Leaveを呼ばれたらWatcher内部でクリーンアップ処理などをし、EndChに通知が行く
type StaticFile ¶
type Stroke ¶
type Stroke struct { ID int64 `json:"id" db:"id"` RoomID int64 `json:"room_id" db:"room_id"` Width int `json:"width" db:"width"` Red int `json:"red" db:"red"` Green int `json:"green" db:"green"` Blue int `json:"blue" db:"blue"` Alpha float64 `json:"alpha" db:"alpha"` CreatedAt time.Time `json:"created_at" db:"created_at"` Points []Point `json:"points" db:"points"` }
type WatcherCountLog ¶
Click to show internal directories.
Click to hide internal directories.