dotcloudJS 是一个 JavaScript 的客户端库,可让你通过简单的 API 访问强大的云服务。
示例代码:
// Start synchronizing the "people" collection var people = dotcloud.sync.synchronize('people'); // Add an observer to be notified of changes in people. people.observe(function(type, change) { console.log(people); }); // Add an item to the people collection people.push({ firstname: 'John', lastname: 'Doe' }); // You can use other methods from the Array prototype people.splice(0, 1, { firstname: 'Jane', lastname: 'Doe' }); // Update the person object at the given index people.at(0, { age: 25 }); // Iterate over the people collection people.forEach(function(item, idx, people) { console.log(idx, item); });