bowline 0.4.6 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/TODO +11 -0
- data/VERSION +1 -1
- data/assets/bowline.js +194 -0
- data/assets/json2.js +479 -0
- data/assets/osx/Info.plist.erb +45 -0
- data/assets/osx/bowline.png +0 -0
- data/assets/osx/makeicns +0 -0
- data/bowline.gemspec +47 -11
- data/lib/bowline.rb +35 -15
- data/lib/bowline/binders.rb +168 -131
- data/lib/bowline/commands/build.rb +3 -0
- data/lib/bowline/commands/generate.rb +3 -1
- data/lib/bowline/commands/run.rb +7 -4
- data/lib/bowline/desktop.rb +26 -0
- data/lib/bowline/desktop/app.rb +9 -0
- data/lib/bowline/desktop/bridge.rb +97 -0
- data/lib/bowline/desktop/clipboard.rb +9 -0
- data/lib/bowline/desktop/dialog.rb +28 -0
- data/lib/bowline/desktop/dock.rb +9 -0
- data/lib/bowline/desktop/host.rb +10 -0
- data/lib/bowline/desktop/js.rb +92 -0
- data/lib/bowline/desktop/misc.rb +9 -0
- data/lib/bowline/desktop/network.rb +7 -0
- data/lib/bowline/desktop/proxy.rb +94 -0
- data/lib/bowline/desktop/sound.rb +8 -0
- data/lib/bowline/desktop/window.rb +31 -0
- data/lib/bowline/desktop/window_manager.rb +72 -0
- data/lib/bowline/desktop/window_methods.rb +70 -0
- data/lib/bowline/generators.rb +3 -2
- data/lib/bowline/generators/application.rb +8 -5
- data/lib/bowline/generators/binder.rb +10 -6
- data/lib/bowline/generators/model.rb +9 -0
- data/lib/bowline/generators/window.rb +28 -0
- data/lib/bowline/helpers.rb +0 -3
- data/lib/bowline/initializer.rb +65 -11
- data/lib/bowline/library.rb +31 -0
- data/lib/bowline/local_model.rb +116 -0
- data/lib/bowline/logging.rb +23 -0
- data/lib/bowline/platform.rb +73 -0
- data/lib/bowline/tasks/app.rake +80 -148
- data/lib/bowline/tasks/libs.rake +59 -0
- data/lib/bowline/version.rb +2 -2
- data/lib/bowline/watcher.rb +91 -0
- data/templates/binder.rb +2 -8
- data/templates/config/environment.rb +3 -2
- data/templates/main_window.rb +7 -0
- data/templates/model.rb +1 -1
- data/templates/public/index.html +2 -1
- data/templates/script/build +3 -0
- data/templates/script/generate +3 -0
- data/templates/script/init +0 -16
- data/templates/window.rb +3 -0
- data/vendor/pathname.rb +1099 -0
- data/vendor/progressbar.rb +236 -0
- metadata +48 -9
- data/assets/jquery.bowline.js +0 -156
- data/lib/bowline/async.rb +0 -29
- data/lib/bowline/binders/collection.rb +0 -59
- data/lib/bowline/binders/singleton.rb +0 -31
- data/lib/bowline/jquery.rb +0 -31
- data/lib/bowline/observer.rb +0 -66
- data/lib/bowline/window.rb +0 -19
@@ -0,0 +1,236 @@
|
|
1
|
+
#
|
2
|
+
# Ruby/ProgressBar - a text progress bar library
|
3
|
+
#
|
4
|
+
# Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org>
|
5
|
+
# All rights reserved.
|
6
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
7
|
+
#
|
8
|
+
# You can redistribute it and/or modify it under the terms
|
9
|
+
# of Ruby's license.
|
10
|
+
#
|
11
|
+
|
12
|
+
class ProgressBar
|
13
|
+
VERSION = "0.9"
|
14
|
+
|
15
|
+
def initialize (title, total, out = STDERR)
|
16
|
+
@title = title
|
17
|
+
@total = total
|
18
|
+
@out = out
|
19
|
+
@terminal_width = 80
|
20
|
+
@bar_mark = "o"
|
21
|
+
@current = 0
|
22
|
+
@previous = 0
|
23
|
+
@finished_p = false
|
24
|
+
@start_time = Time.now
|
25
|
+
@previous_time = @start_time
|
26
|
+
@title_width = 14
|
27
|
+
@format = "%-#{@title_width}s %3d%% %s %s"
|
28
|
+
@format_arguments = [:title, :percentage, :bar, :stat]
|
29
|
+
clear
|
30
|
+
show
|
31
|
+
end
|
32
|
+
attr_reader :title
|
33
|
+
attr_reader :current
|
34
|
+
attr_reader :total
|
35
|
+
attr_accessor :start_time
|
36
|
+
attr_writer :bar_mark
|
37
|
+
|
38
|
+
private
|
39
|
+
def fmt_bar
|
40
|
+
bar_width = do_percentage * @terminal_width / 100
|
41
|
+
sprintf("|%s%s|",
|
42
|
+
@bar_mark * bar_width,
|
43
|
+
" " * (@terminal_width - bar_width))
|
44
|
+
end
|
45
|
+
|
46
|
+
def fmt_percentage
|
47
|
+
do_percentage
|
48
|
+
end
|
49
|
+
|
50
|
+
def fmt_stat
|
51
|
+
if @finished_p then elapsed else eta end
|
52
|
+
end
|
53
|
+
|
54
|
+
def fmt_stat_for_file_transfer
|
55
|
+
if @finished_p then
|
56
|
+
sprintf("%s %s %s", bytes, transfer_rate, elapsed)
|
57
|
+
else
|
58
|
+
sprintf("%s %s %s", bytes, transfer_rate, eta)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def fmt_title
|
63
|
+
@title[0,(@title_width - 1)] + ":"
|
64
|
+
end
|
65
|
+
|
66
|
+
def convert_bytes (bytes)
|
67
|
+
if bytes < 1024
|
68
|
+
sprintf("%6dB", bytes)
|
69
|
+
elsif bytes < 1024 * 1000 # 1000kb
|
70
|
+
sprintf("%5.1fKB", bytes.to_f / 1024)
|
71
|
+
elsif bytes < 1024 * 1024 * 1000 # 1000mb
|
72
|
+
sprintf("%5.1fMB", bytes.to_f / 1024 / 1024)
|
73
|
+
else
|
74
|
+
sprintf("%5.1fGB", bytes.to_f / 1024 / 1024 / 1024)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def transfer_rate
|
79
|
+
bytes_per_second = @current.to_f / (Time.now - @start_time)
|
80
|
+
sprintf("%s/s", convert_bytes(bytes_per_second))
|
81
|
+
end
|
82
|
+
|
83
|
+
def bytes
|
84
|
+
convert_bytes(@current)
|
85
|
+
end
|
86
|
+
|
87
|
+
def format_time (t)
|
88
|
+
t = t.to_i
|
89
|
+
sec = t % 60
|
90
|
+
min = (t / 60) % 60
|
91
|
+
hour = t / 3600
|
92
|
+
sprintf("%02d:%02d:%02d", hour, min, sec);
|
93
|
+
end
|
94
|
+
|
95
|
+
# ETA stands for Estimated Time of Arrival.
|
96
|
+
def eta
|
97
|
+
if @current == 0
|
98
|
+
"ETA: --:--:--"
|
99
|
+
else
|
100
|
+
elapsed = Time.now - @start_time
|
101
|
+
eta = elapsed * @total / @current - elapsed;
|
102
|
+
sprintf("ETA: %s", format_time(eta))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def elapsed
|
107
|
+
elapsed = Time.now - @start_time
|
108
|
+
sprintf("Time: %s", format_time(elapsed))
|
109
|
+
end
|
110
|
+
|
111
|
+
def eol
|
112
|
+
if @finished_p then "\n" else "\r" end
|
113
|
+
end
|
114
|
+
|
115
|
+
def do_percentage
|
116
|
+
if @total.zero?
|
117
|
+
100
|
118
|
+
else
|
119
|
+
@current * 100 / @total
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def get_width
|
124
|
+
# FIXME: I don't know how portable it is.
|
125
|
+
default_width = 80
|
126
|
+
begin
|
127
|
+
tiocgwinsz = 0x5413
|
128
|
+
data = [0, 0, 0, 0].pack("SSSS")
|
129
|
+
if @out.ioctl(tiocgwinsz, data) >= 0 then
|
130
|
+
rows, cols, xpixels, ypixels = data.unpack("SSSS")
|
131
|
+
if cols >= 0 then cols else default_width end
|
132
|
+
else
|
133
|
+
default_width
|
134
|
+
end
|
135
|
+
rescue Exception
|
136
|
+
default_width
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def show
|
141
|
+
arguments = @format_arguments.map {|method|
|
142
|
+
method = sprintf("fmt_%s", method)
|
143
|
+
send(method)
|
144
|
+
}
|
145
|
+
line = sprintf(@format, *arguments)
|
146
|
+
|
147
|
+
width = get_width
|
148
|
+
if line.length == width - 1
|
149
|
+
@out.print(line + eol)
|
150
|
+
@out.flush
|
151
|
+
elsif line.length >= width
|
152
|
+
@terminal_width = [@terminal_width - (line.length - width + 1), 0].max
|
153
|
+
if @terminal_width == 0 then @out.print(line + eol) else show end
|
154
|
+
else # line.length < width - 1
|
155
|
+
@terminal_width += width - line.length + 1
|
156
|
+
show
|
157
|
+
end
|
158
|
+
@previous_time = Time.now
|
159
|
+
end
|
160
|
+
|
161
|
+
def show_if_needed
|
162
|
+
if @total.zero?
|
163
|
+
cur_percentage = 100
|
164
|
+
prev_percentage = 0
|
165
|
+
else
|
166
|
+
cur_percentage = (@current * 100 / @total).to_i
|
167
|
+
prev_percentage = (@previous * 100 / @total).to_i
|
168
|
+
end
|
169
|
+
|
170
|
+
# Use "!=" instead of ">" to support negative changes
|
171
|
+
if cur_percentage != prev_percentage ||
|
172
|
+
Time.now - @previous_time >= 1 || @finished_p
|
173
|
+
show
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
public
|
178
|
+
def clear
|
179
|
+
@out.print "\r"
|
180
|
+
@out.print(" " * (get_width - 1))
|
181
|
+
@out.print "\r"
|
182
|
+
end
|
183
|
+
|
184
|
+
def finish
|
185
|
+
@current = @total
|
186
|
+
@finished_p = true
|
187
|
+
show
|
188
|
+
end
|
189
|
+
|
190
|
+
def finished?
|
191
|
+
@finished_p
|
192
|
+
end
|
193
|
+
|
194
|
+
def file_transfer_mode
|
195
|
+
@format_arguments = [:title, :percentage, :bar, :stat_for_file_transfer]
|
196
|
+
end
|
197
|
+
|
198
|
+
def format= (format)
|
199
|
+
@format = format
|
200
|
+
end
|
201
|
+
|
202
|
+
def format_arguments= (arguments)
|
203
|
+
@format_arguments = arguments
|
204
|
+
end
|
205
|
+
|
206
|
+
def halt
|
207
|
+
@finished_p = true
|
208
|
+
show
|
209
|
+
end
|
210
|
+
|
211
|
+
def inc (step = 1)
|
212
|
+
@current += step
|
213
|
+
@current = @total if @current > @total
|
214
|
+
show_if_needed
|
215
|
+
@previous = @current
|
216
|
+
end
|
217
|
+
|
218
|
+
def set (count)
|
219
|
+
if count < 0 || count > @total
|
220
|
+
raise "invalid count: #{count} (total: #{@total})"
|
221
|
+
end
|
222
|
+
@current = count
|
223
|
+
show_if_needed
|
224
|
+
@previous = @current
|
225
|
+
end
|
226
|
+
|
227
|
+
def inspect
|
228
|
+
"#<ProgressBar:#{@current}/#{@total}>"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
class ReversedProgressBar < ProgressBar
|
233
|
+
def do_percentage
|
234
|
+
100 - super
|
235
|
+
end
|
236
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bowline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex MacCaw
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-20 00:00:00 +00:00
|
13
13
|
default_executable: bowline-gen
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +32,16 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.3.2
|
34
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rubyzip2
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.0.1
|
44
|
+
version:
|
35
45
|
description: Ruby/JS GUI framework
|
36
46
|
email: alex@leadthinking.com
|
37
47
|
executables:
|
@@ -40,16 +50,22 @@ extensions: []
|
|
40
50
|
|
41
51
|
extra_rdoc_files:
|
42
52
|
- README.txt
|
53
|
+
- TODO
|
43
54
|
files:
|
44
55
|
- .gitignore
|
45
56
|
- History.txt
|
46
57
|
- MIT-LICENSE
|
47
58
|
- README.txt
|
48
59
|
- Rakefile
|
60
|
+
- TODO
|
49
61
|
- VERSION
|
50
|
-
- assets/
|
62
|
+
- assets/bowline.js
|
51
63
|
- assets/jquery.chain.js
|
52
64
|
- assets/jquery.js
|
65
|
+
- assets/json2.js
|
66
|
+
- assets/osx/Info.plist.erb
|
67
|
+
- assets/osx/bowline.png
|
68
|
+
- assets/osx/makeicns
|
53
69
|
- bin/bowline-gen
|
54
70
|
- bowline.gemspec
|
55
71
|
- examples/account.rb
|
@@ -58,10 +74,8 @@ files:
|
|
58
74
|
- examples/twitter.html
|
59
75
|
- examples/users.rb
|
60
76
|
- lib/bowline.rb
|
61
|
-
- lib/bowline/async.rb
|
62
77
|
- lib/bowline/binders.rb
|
63
|
-
- lib/bowline/
|
64
|
-
- lib/bowline/binders/singleton.rb
|
78
|
+
- lib/bowline/commands/build.rb
|
65
79
|
- lib/bowline/commands/console.rb
|
66
80
|
- lib/bowline/commands/generate.rb
|
67
81
|
- lib/bowline/commands/run.rb
|
@@ -73,6 +87,21 @@ files:
|
|
73
87
|
- lib/bowline/dependencies/lib/dependencies/dependency.rb
|
74
88
|
- lib/bowline/dependencies/lib/dependencies/repository.rb
|
75
89
|
- lib/bowline/dependencies/lib/ext/rubygems.rb
|
90
|
+
- lib/bowline/desktop.rb
|
91
|
+
- lib/bowline/desktop/app.rb
|
92
|
+
- lib/bowline/desktop/bridge.rb
|
93
|
+
- lib/bowline/desktop/clipboard.rb
|
94
|
+
- lib/bowline/desktop/dialog.rb
|
95
|
+
- lib/bowline/desktop/dock.rb
|
96
|
+
- lib/bowline/desktop/host.rb
|
97
|
+
- lib/bowline/desktop/js.rb
|
98
|
+
- lib/bowline/desktop/misc.rb
|
99
|
+
- lib/bowline/desktop/network.rb
|
100
|
+
- lib/bowline/desktop/proxy.rb
|
101
|
+
- lib/bowline/desktop/sound.rb
|
102
|
+
- lib/bowline/desktop/window.rb
|
103
|
+
- lib/bowline/desktop/window_manager.rb
|
104
|
+
- lib/bowline/desktop/window_methods.rb
|
76
105
|
- lib/bowline/ext/array.rb
|
77
106
|
- lib/bowline/ext/class.rb
|
78
107
|
- lib/bowline/ext/object.rb
|
@@ -83,18 +112,22 @@ files:
|
|
83
112
|
- lib/bowline/generators/helper.rb
|
84
113
|
- lib/bowline/generators/migration.rb
|
85
114
|
- lib/bowline/generators/model.rb
|
115
|
+
- lib/bowline/generators/window.rb
|
86
116
|
- lib/bowline/helpers.rb
|
87
117
|
- lib/bowline/initializer.rb
|
88
|
-
- lib/bowline/
|
89
|
-
- lib/bowline/
|
118
|
+
- lib/bowline/library.rb
|
119
|
+
- lib/bowline/local_model.rb
|
120
|
+
- lib/bowline/logging.rb
|
121
|
+
- lib/bowline/platform.rb
|
90
122
|
- lib/bowline/tasks/app.rake
|
91
123
|
- lib/bowline/tasks/bowline.rb
|
92
124
|
- lib/bowline/tasks/database.rake
|
93
125
|
- lib/bowline/tasks/gems.rake
|
126
|
+
- lib/bowline/tasks/libs.rake
|
94
127
|
- lib/bowline/tasks/log.rake
|
95
128
|
- lib/bowline/tasks/misc.rake
|
96
129
|
- lib/bowline/version.rb
|
97
|
-
- lib/bowline/
|
130
|
+
- lib/bowline/watcher.rb
|
98
131
|
- templates/Rakefile
|
99
132
|
- templates/binder.rb
|
100
133
|
- templates/config/application.yml
|
@@ -103,15 +136,21 @@ files:
|
|
103
136
|
- templates/config/environment.rb
|
104
137
|
- templates/gitignore
|
105
138
|
- templates/helper.rb
|
139
|
+
- templates/main_window.rb
|
106
140
|
- templates/migration.rb
|
107
141
|
- templates/model.rb
|
108
142
|
- templates/public/icon.png
|
109
143
|
- templates/public/index.html
|
110
144
|
- templates/public/javascripts/application.js
|
111
145
|
- templates/public/stylesheets/application.css
|
146
|
+
- templates/script/build
|
112
147
|
- templates/script/console
|
148
|
+
- templates/script/generate
|
113
149
|
- templates/script/init
|
114
150
|
- templates/script/run
|
151
|
+
- templates/window.rb
|
152
|
+
- vendor/pathname.rb
|
153
|
+
- vendor/progressbar.rb
|
115
154
|
has_rdoc: true
|
116
155
|
homepage: http://github.com/maccman/bowline
|
117
156
|
licenses: []
|
data/assets/jquery.bowline.js
DELETED
@@ -1,156 +0,0 @@
|
|
1
|
-
(function($){
|
2
|
-
var init = false;
|
3
|
-
var TI = Titanium;
|
4
|
-
var UI = TI.UI;
|
5
|
-
var mainWin = UI.mainWindow.window;
|
6
|
-
|
7
|
-
$.bowline = {
|
8
|
-
setup: function(name, el){
|
9
|
-
var rb = mainWin.eval("bowline_" + name + "_setup");
|
10
|
-
if(!rb) throw 'Unknown class';
|
11
|
-
rb(el);
|
12
|
-
},
|
13
|
-
|
14
|
-
klass: function(name){
|
15
|
-
var rb = mainWin.eval("bowline_" + name);
|
16
|
-
if(!rb) throw 'Unknown class';
|
17
|
-
return rb;
|
18
|
-
},
|
19
|
-
|
20
|
-
instance: function(name, el){
|
21
|
-
var rb = mainWin.eval("bowline_" + name + "_instance");
|
22
|
-
if(!rb) throw 'Unknown class';
|
23
|
-
return rb(el);
|
24
|
-
},
|
25
|
-
|
26
|
-
helper: function(){
|
27
|
-
return(
|
28
|
-
bowline_helper.apply(
|
29
|
-
bowline_helper,
|
30
|
-
arguments
|
31
|
-
)
|
32
|
-
);
|
33
|
-
},
|
34
|
-
|
35
|
-
load: function(){
|
36
|
-
$(function(){
|
37
|
-
setTimeout(function(){
|
38
|
-
$(document.body).trigger('loading.bowline');
|
39
|
-
var script = $("<script />");
|
40
|
-
script.attr('type', 'text/ruby');
|
41
|
-
script.attr('src', '../script/init');
|
42
|
-
$('head').append(script);
|
43
|
-
}, 100);
|
44
|
-
});
|
45
|
-
},
|
46
|
-
|
47
|
-
ready: function(func){
|
48
|
-
if(init) return func();
|
49
|
-
$(document).bind('loaded.bowline', func);
|
50
|
-
},
|
51
|
-
|
52
|
-
dialog: function(name, options, callback){
|
53
|
-
if(!callback && typeof(options) == 'function') {
|
54
|
-
callback = options;
|
55
|
-
options = {};
|
56
|
-
}
|
57
|
-
$.extend(options, {
|
58
|
-
'url': 'app://public/' + name + '.html',
|
59
|
-
'height': 200,
|
60
|
-
'width': 350,
|
61
|
-
'transparency': 0.9,
|
62
|
-
'resizable': false,
|
63
|
-
'usingChrome': false,
|
64
|
-
'onclose': function(res){
|
65
|
-
if(callback) callback(res);
|
66
|
-
}
|
67
|
-
});
|
68
|
-
return Titanium.UI.showDialog(options);
|
69
|
-
},
|
70
|
-
|
71
|
-
setupForms: function(){
|
72
|
-
// $('form').bind('submit', function(e){
|
73
|
-
// var src = $(this).attr('src').split('.');
|
74
|
-
// var rb = $.bowline.klass[src[0]];
|
75
|
-
// rb.params = $(this).serialize();
|
76
|
-
// rb.send(src[1]);
|
77
|
-
// return false;
|
78
|
-
// });
|
79
|
-
},
|
80
|
-
|
81
|
-
// A lot of JS libs require hashes
|
82
|
-
// without any functions in them
|
83
|
-
_rubyHash: function( hsh ) {
|
84
|
-
res = {};
|
85
|
-
var key;
|
86
|
-
for(key in hsh){
|
87
|
-
var value = hsh[key];
|
88
|
-
if(typeof(value) != 'function'){
|
89
|
-
res[key] = value;
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return res;
|
93
|
-
}
|
94
|
-
},
|
95
|
-
|
96
|
-
window.bowline_loaded = function(){
|
97
|
-
init = true;
|
98
|
-
$(document.body).trigger('loaded.bowline');
|
99
|
-
}
|
100
|
-
|
101
|
-
$.fn.bowline = function(name, options){
|
102
|
-
var self = $(this);
|
103
|
-
$.bowline.ready(function(){
|
104
|
-
self.chain(options);
|
105
|
-
$.bowline.setup(name, self);
|
106
|
-
self.data('bowline', name);
|
107
|
-
self.trigger('setup.bowline');
|
108
|
-
});
|
109
|
-
return self;
|
110
|
-
};
|
111
|
-
|
112
|
-
$.fn.invoke = function(){
|
113
|
-
if($(this).chain('active')){
|
114
|
-
if($(this).data('bowline')){
|
115
|
-
// Class method
|
116
|
-
var name = $(this).data('bowline');
|
117
|
-
var func = $.bowline.klass(name);
|
118
|
-
} else {
|
119
|
-
// Instance method
|
120
|
-
var name = $(this).item('root').data('bowline');
|
121
|
-
var func = $.bowline.instance(name, $(this));
|
122
|
-
}
|
123
|
-
var args = $.makeArray(arguments);
|
124
|
-
var opts = args.pop();
|
125
|
-
if(typeof(opts) == "object" && opts.async){
|
126
|
-
setTimeout(function(){
|
127
|
-
func.apply(func, args);
|
128
|
-
}, 100);
|
129
|
-
} else {
|
130
|
-
args.push(opts);
|
131
|
-
func.apply(func, args);
|
132
|
-
}
|
133
|
-
} else {
|
134
|
-
throw 'Chain not active';
|
135
|
-
}
|
136
|
-
};
|
137
|
-
|
138
|
-
$.fn.updateCollection = function( items ){
|
139
|
-
items = $.map(items, function(n){
|
140
|
-
return $.bowline._rubyHash(n);
|
141
|
-
});
|
142
|
-
$(this).items('replace', items);
|
143
|
-
$(this).trigger('update.bowline');
|
144
|
-
};
|
145
|
-
|
146
|
-
$.fn.updateSingleton = function( item ){
|
147
|
-
item = $.bowline._rubyHash(item);
|
148
|
-
$(this).item('replace', item);
|
149
|
-
$(this).trigger('update.bowline');
|
150
|
-
};
|
151
|
-
|
152
|
-
// main window
|
153
|
-
if(UI.currentWindow.equals(UI.mainWindow)){
|
154
|
-
$.bowline.load();
|
155
|
-
}
|
156
|
-
})(jQuery)
|