{"id":64552,"student_id":1652,"content":"var comments = []\nvar users = {\n\n 101: {\n id: 101, name: 110011\n },\n 202: {\n id: 202, name: 220022\n },\n}\nvar name = prompt(\"給我說出你的名字😡😡😡😡😡\") || '無名氏'\nvar id = Math.floor(Math.random()*1000000)\nusers[id] = {\n id: id,\n name: name,\n time: Date.now()\n\n}\nconsole.log(users)\ncomments.unshift(`${name}加入聊天室`)\n\nforever(function() {\n users[id].time = Date.now();\n DB.broadcast('update', users[id]);\n for (var i = 0; i \u003c comments.length; i++) {\n print(comments[i], 150, 30+20*i, 'black', 25)\n }\n print('===再現使用者===')\n var i = 0\n for (var _ in users) {\n i++;\n print(users[_].name, 30, 30+20*i, \"black\", 20)\n if (Date.now() \u003e users[_].time + 10000) {\n delete users[_]\n comments.unshift(`${name}離開聊天室`)\n }\n\n } \n\n //console.log(users)\n\n}) \n\n var msg;\n\n when('click', function() {\n msg = prompt('type in your message');\n var time = new Date();\n time = time.toLocaleTimeString();\n comments.unshift(`[${time}] ${name}:${msg}`)\n DB.broadcast(\"message\", `${name}:${msg}`)\n })\n DB.onMessage('message', function (data) {\n comments.push(data)\n })\n DB.onMessage(\"update\", function (data) {\n users[data.id] = data;\n })","created_at":"2019-04-27T13:54:57.580+08:00","updated_at":"2019-10-02T11:52:33.181+08:00","name":"聊天室 副本","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/64552/89edcce60b8890776f43b51e69f48ea4.jpg"},"parent_id":34007,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":62,"hashid":"npmsrm52","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦