Permalink
Browse files

Initial commit

  • Loading branch information...
Chris Sainty Chris Sainty
Chris Sainty authored and Chris Sainty committed Jan 10, 2012
0 parents commit b7ba92c9a193e34c8a39958c349a07433f4ca7a5
7 app.js
@@ -0,0 +1,7 @@
+var nwebkit = require('node-webkit');
+
+nwebkit.init({
+ 'url' : 'index.html',
+ 'width' : 800,
+ 'height' : 600
+});
@@ -0,0 +1,22 @@
+<html>
+<head>
+ <title>node-webkit-twitter</title>
+ <script src="jquery-1.7.1.min.js"></script>
+ <script src="knockout-2.1.0pre.js"></script>
+ <script src="index.js"></script>
+</head>
+<body>
+
+<h1>node-webkit-twitter</h1>
+
+<div>
+ Enter a search term <input type="text" data-bind="value: searchTerm" />.<br/>
+ <button data-bind="click: search">Search</button>
+</div>
+
+<ul data-bind="foreach: results">
+ <li><span data-bind="text: text"></span></li>
+</ul>
+
+</body>
+</html>
@@ -0,0 +1,22 @@
+var request = require('request');
+
+$(function() {
+ function IndexViewModel() {
+ this.searchTerm = ko.observable();
+ this.results = ko.observableArray();
+
+ this.search = function() {
+ var vm = this;
+ request.get('http://search.twitter.com/search.json?q=' + this.searchTerm(), function (error, response, body) {
+ if (!error && response.statusCode === 200) {
+ var tweets = JSON.parse(body);
+
+ $.each(tweets.results, function (index, item) {
+ vm.results.push(item);
+ })
+ }
+ });
+ };
+ }
+ ko.applyBindings(new IndexViewModel());
+});

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
Submodule node-webkit added at 211b12

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit b7ba92c

Please sign in to comment.