flok 0.0.103 → 0.0.105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/drivers/chrome/config.yml +2 -0
  3. data/app/drivers/chrome/src/about.js +14 -0
  4. data/app/drivers/chrome/src/guid.js +9 -0
  5. data/app/drivers/chrome/src/net.js +25 -3
  6. data/app/kern/mod/about.js +19 -0
  7. data/app/kern/mod/hook.js +2 -2
  8. data/app/kern/mod/udid.js +9 -0
  9. data/app/kern/services/rest.rb +67 -8
  10. data/bin/flok +14 -0
  11. data/docs/mod/about.md +19 -0
  12. data/docs/mod/net.md +9 -4
  13. data/docs/mod/ui.md +1 -1
  14. data/docs/services/rest.md +24 -2
  15. data/docs/services/vm.md +4 -0
  16. data/docs/user_handbook/hooks.md +61 -5
  17. data/lib/flok/hooks_compiler.rb +6 -0
  18. data/lib/flok/user_compiler.rb +33 -5
  19. data/lib/flok/user_hook_generators/goto.rb +25 -3
  20. data/lib/flok/user_hook_generators/pop.rb +99 -0
  21. data/lib/flok/user_hook_generators/push.rb +119 -0
  22. data/lib/flok/version.rb +1 -1
  23. data/spec/iface/driver/about_spec.rb +14 -0
  24. data/spec/iface/driver/net_spec.rb +91 -2
  25. data/spec/iface/driver/ping_spec.rb +1 -0
  26. data/spec/kern/about_spec.rb +30 -0
  27. data/spec/kern/assets/hook_entry_points/controller0a_push.rb +31 -0
  28. data/spec/kern/assets/hook_entry_points/controller0b.rb +17 -0
  29. data/spec/kern/assets/hook_entry_points/controller0bc.rb +27 -0
  30. data/spec/kern/assets/hook_entry_points/controller_0b_pop.rb +18 -0
  31. data/spec/kern/assets/hook_entry_points/controller_0b_pop2.rb +66 -0
  32. data/spec/kern/assets/hook_entry_points/controller_0b_push.rb +15 -0
  33. data/spec/kern/assets/hook_entry_points/controller_0b_push2.rb +55 -0
  34. data/spec/kern/assets/rest_service/controller1b.rb +47 -0
  35. data/spec/kern/hook_entry_points_and_manifest_spec.rb +174 -0
  36. data/spec/kern/{hook_user_generators_spec.rb → hook_goto_user_generators_spec.rb} +145 -7
  37. data/spec/kern/hook_pop_user_generators_spec.rb +292 -0
  38. data/spec/kern/hook_push_user_generators_spec.rb +305 -0
  39. data/spec/kern/rest_service_spec.rb +97 -1
  40. data/spec/lib/helpers.rb +5 -3
  41. metadata +35 -5
  42. data/lib/flok/user_hook_generators/helpers.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d3dd5275337abe10712fa3347a698c60819ff78
4
- data.tar.gz: e126f18d24e069176e485f6db5327c407dafad71
3
+ metadata.gz: cfece198a3be15554aab6d41361b5b222120ee89
4
+ data.tar.gz: b569fe8e0348b521274f81fdbb4fa270552ff7f3
5
5
  SHA512:
6
- metadata.gz: baaa0fb3c2b68b3460e892d0f8d1c084e2d20eea45baaf29ff1ed8232bacd67cbd1aa0362a6fc725fd57be77519593c56021042c48d17a6b22c3b1d52ae2f1e3
7
- data.tar.gz: ee1f06e6d0210adf94dbb9a7780945a4f9a9c37a1b39ac15d1b85512c2cecb678fdb064f9248da5406e49ccf9f5071383e32b7c60ceda860d86705cd93adc42e
6
+ metadata.gz: 1bdedc72f399bfb4184e18fe6273a2553e4103121ad42d0e86ee883a015b96419e7439e71b5cc909aa67d749a25e0947a028a71a3d9838b53b92e70dd2900e1f
7
+ data.tar.gz: 4723773078ca280a6916a7c9f7e12e3273e571972da4edc3fb159bedb0e288bafa3f28d2363befe79c264e92e7e119b67bb0aa6f54fcc2781c35d0908805b56e
@@ -13,6 +13,7 @@ DEBUG:
13
13
  - rtc
14
14
  - hook
15
15
  - dlink
16
+ - about
16
17
  defines:
17
18
  - mem_pager
18
19
  - sockio_pager
@@ -29,6 +30,7 @@ RELEASE:
29
30
  - rtc
30
31
  - hook
31
32
  - dlink
33
+ - about
32
34
  defines:
33
35
  - mem_pager
34
36
  - sockio_pager
@@ -0,0 +1,14 @@
1
+
2
+ function if_about_poll() {
3
+ var udid = localStorage.getItem("__flok_udid");
4
+ if (udid === null) {
5
+ udid = __flok_chrome_guid()
6
+ localStorage.setItem("__flok_udid", udid);
7
+ }
8
+
9
+ int_dispatch([1, "int_about_poll_cb", {
10
+ "platform": navigator.userAgent,
11
+ "language": navigator.language,
12
+ "udid": udid,
13
+ }]);
14
+ }
@@ -0,0 +1,9 @@
1
+ function __flok_chrome_guid() {
2
+ function s4() {
3
+ return Math.floor((1 + Math.random()) * 0x10000)
4
+ .toString(16)
5
+ .substring(1);
6
+ }
7
+ return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
8
+ s4() + '-' + s4() + s4() + s4();
9
+ }
@@ -8,11 +8,33 @@ if_net_req = function(verb, url, params, tp_base) {
8
8
  method: verb,
9
9
  data: params,
10
10
  dataType: "json",
11
- success: function(data) {
12
- int_dispatch([3, "int_net_cb", tp_base, true, data]);
11
+ success: function(data, textStatus, xhr) {
12
+ int_dispatch([3, "int_net_cb", tp_base, xhr.status, data]);
13
13
  },
14
14
  error: function(xhr, textStatus, err) {
15
- int_dispatch([3, "int_net_cb", tp_base, false, textStatus]);
15
+ int_dispatch([3, "int_net_cb", tp_base, -1, textStatus]);
16
16
  }
17
17
  })
18
18
  }
19
+
20
+ //A basic get request that supports callbacks
21
+ if_net_req2 = function(verb, headers, url, params, tp_base) {
22
+ $.ajax({
23
+ url: url,
24
+ method: verb,
25
+ data: params,
26
+ beforeSend: function (xhr) {
27
+ for (var name in headers) {
28
+ var value = headers[name];
29
+ xhr.setRequestHeader(name, value);
30
+ }
31
+ },
32
+ success: function(data, textStatus, xhr) {
33
+ int_dispatch([3, "int_net_cb", tp_base, xhr.status, data]);
34
+ },
35
+ error: function(xhr, textStatus, err) {
36
+ int_dispatch([3, "int_net_cb", tp_base, -1, textStatus]);
37
+ }
38
+ })
39
+ }
40
+
@@ -0,0 +1,19 @@
1
+ __flok_platform = null;
2
+
3
+ function int_about_poll_cb(info) {
4
+ __flok_platform = info.platform;
5
+ __flok_language = info.language;
6
+ __flok_udid = info.udid;
7
+ }
8
+
9
+ function get_platform() {
10
+ return __flok_platform;
11
+ }
12
+
13
+ function get_udid() {
14
+ return __flok_udid;
15
+ }
16
+
17
+ function get_language() {
18
+ return __flok_language;
19
+ }
@@ -1,5 +1,5 @@
1
- //goto hook generator expects this callback to be received usually for completion
2
- function hook_goto_completion_cb(ep, ename, info) {
1
+ //goto hook generator expects this callback to be received usually for completion (goto & pop)
2
+ function hook_completion_cb(ep, ename, info) {
3
3
  var views_to_free_id = ep;
4
4
  var our_views_to_free = views_to_free[ep];
5
5
 
@@ -0,0 +1,9 @@
1
+ __flok_udid = "<no-udid-set>";
2
+
3
+ function int_udid_init(udid) {
4
+ __flok_udid = udid;
5
+ }
6
+
7
+ function get_udid() {
8
+ return __flok_udid;
9
+ }
@@ -1,19 +1,55 @@
1
1
  service :rest do
2
2
  global %{
3
- rest_in_flight = {}
4
-
5
- function rest_cb(tp, success, info) {
6
- var e = rest_in_flight[tp];
7
- var bp = e[0];
8
- var path = e[1];
3
+ function rest_cb(tp, code, info) {
4
+ var e = rest_pending_requests[tp];
5
+ var bp = e.bp;
6
+ var path = e.path;
9
7
 
10
8
  int_event(bp, "rest_res", {
11
9
  path: path,
10
+ code: code,
12
11
  res: info
13
12
  });
14
13
 
15
14
  tel_del(tp);
15
+
16
+ if (code > 0) {
17
+ delete rest_pending_requests[tp];
18
+ delete rest_bp_to_tps[bp][tp];
19
+ } else {
20
+ failed_requests_tp.push(tp);
21
+ }
22
+ }
23
+
24
+ function rest_retry_failed() {
25
+ for (var i = 0; i < failed_requests_tp.length; ++i) {
26
+ var old_tp = failed_requests_tp[i];
27
+ var info = rest_pending_requests[old_tp];
28
+
29
+ if (info != null) {
30
+ //Make a new telepointer as old is no longer valid to net driver
31
+ var tp = tel_reg(rest_cb);
32
+ SEND("net", "if_net_req", info.verb, info.url, info.params, tp);
33
+
34
+ //Swap them out
35
+ rest_pending_requests[tp] = info;
36
+ rest_bp_to_tps[info.bp][tp] = true;
37
+ delete rest_pending_requests[old_tp];
38
+ delete rest_bp_to_tps[info.bp][old_tp];
39
+ }
40
+ }
41
+
42
+ failed_requests_tp = [];
16
43
  }
44
+
45
+ //Maps tp into enough information to make a request
46
+ var rest_pending_requests = {};
47
+
48
+ //Maps base-pointer into listing of current tele-pointers (disguised as an always true set for easy lookup)
49
+ //for that controller [Int:[Int:Bool]]
50
+ var rest_bp_to_tps = {};
51
+
52
+ var failed_requests_tp = [];
17
53
  }
18
54
 
19
55
  on_wakeup %{
@@ -23,6 +59,7 @@ service :rest do
23
59
  }
24
60
 
25
61
  on_connect %{
62
+ rest_bp_to_tps[bp] = [];
26
63
  }
27
64
 
28
65
  on "get", %{
@@ -37,10 +74,32 @@ service :rest do
37
74
  <% end %>
38
75
 
39
76
  var tp = tel_reg(rest_cb);
40
- rest_in_flight[tp] = [bp, params.path];
41
- SEND("net", "if_net_req", "GET", "<%= @options[:base_url] %>"+params.path, params.params, tp);
77
+ rest_bp_to_tps[bp].push(tp);
78
+ var url = "<%= @options[:base_url] %>"+params.path;
79
+
80
+ SEND("net", "if_net_req", "GET", url, params.params, tp);
81
+
82
+ rest_pending_requests[tp] = {
83
+ verb: "GET",
84
+ url: url,
85
+ params: params.params,
86
+ path: params.path,
87
+ bp: bp,
88
+ }
42
89
  }
43
90
 
44
91
  on_disconnect %{
92
+ //Get all active tele-pointers for this view and destroy them
93
+ //so we don't retry network requests
94
+ var tps = Object.keys(rest_bp_to_tps[bp]);
95
+ for (var i = 0; i < tps.length; ++i) {
96
+ delete rest_pending_requests[tps[i]];
97
+ }
98
+ delete rest_bp_to_tps[bp];
99
+ }
100
+
101
+ every 2.seconds, %{
102
+ //Re-try failed requests
103
+ rest_retry_failed();
45
104
  }
46
105
  end
data/bin/flok CHANGED
@@ -36,6 +36,8 @@ class FlokCLI < Thor
36
36
  #1. Use the rake task
37
37
  system('rake build:world')
38
38
 
39
+ puts "a"
40
+
39
41
  #2. Copy everything in the gems ./flok/products/$PLATFORM -> $PROJECT/products/$PLATFORM and ./flok/app/kern/services/*.rb -> #$PROJECT/products/$PLATFORM/services
40
42
  FileUtils.cp_r "./products/#{platform}", local_products_path
41
43
 
@@ -47,15 +49,19 @@ class FlokCLI < Thor
47
49
  controller_glob_path = "#{local_products_path}/#{platform}/glob/controllers.rb"
48
50
  Flok.src_glob_r("rb", './app/controllers', controller_glob_path)
49
51
 
52
+ puts "b"
50
53
  user_compiler_js = Flok::UserCompiler.compile File.read(controller_glob_path)
51
54
  services_config_js = File.read "./config/services.rb"
52
55
  Flok.src_glob("rb", './app/services', File.join(local_products_path, platform, "./services/user_services.rb"))
53
56
 
57
+ puts "c"
54
58
  #4. Move ./app/scripts/*.js into `./products/$PLATFORM/./glob/scripts.js`
55
59
  Flok.src_glob("js", './app/scripts', File.join(local_products_path, platform, "./glob/scripts.js"))
56
60
 
61
+ puts "d"
57
62
  #Save the current local user's project directory to reference
58
63
  user_project_dir = Dir.pwd
64
+ puts "e"
59
65
 
60
66
  #We are now inside the platform folder
61
67
  Dir.chdir File.join(local_products_path, platform) do
@@ -64,6 +70,7 @@ class FlokCLI < Thor
64
70
 
65
71
  #4. The `./products/$PLATFORM/services/*.rb` file are globbed into `./products/$PLATFORM/services/combined_services.rb`
66
72
  Flok.src_glob("rb", "./services/", "./services/combined_services.rb")
73
+ puts "f"
67
74
 
68
75
  #5. The service configuration in `./config/services.rb` is read and run through `services_compiler` and files from `./products/$PLATFORM/services/combined_services.rb` and write to ./glob/services.js
69
76
  services_js = Flok::ServicesCompiler.compile(File.read("./services/combined_services.rb"), services_config_js)
@@ -72,6 +79,7 @@ class FlokCLI < Thor
72
79
  #6. Move application.js to the glob folder
73
80
  FileUtils.cp "application.js", "glob/application.js"
74
81
  FileUtils.rm "application.js"
82
+ puts "g"
75
83
 
76
84
  #7. The local project `./products/$PLATFORM/glob/application.js` and `./products/$PLATFORM/glob/user_compiler.js` and `./products/$PLATFORM/glob/services.js` and `./products/$PLATFORM/glob/scripts.js` are merged into `./products/$PLATFORM/glob/application_user.js.erb.hooks`.
77
85
  File.open "glob/application_user.js.erb.hooks", "w" do |f|
@@ -81,18 +89,24 @@ class FlokCLI < Thor
81
89
  f.puts File.read("glob/scripts.js")
82
90
  end
83
91
 
92
+ puts "h"
84
93
  #9. The `hooks` compiler then runs over the source injecting any necessary hook code into the special comments by going through `./config/hooks.rb` in the user's project.
85
94
  erb_hooks_src = File.read "glob/application_user.js.erb.hooks"
95
+ puts "hh"
86
96
  manifest = Flok::UserHooksToManifestOrchestrator.convert_hooks_to_manifest File.read("#{user_project_dir}/config/hooks.rb")
97
+ puts "hg"
87
98
  erb_src = Flok::HooksCompiler.compile erb_hooks_src, manifest
99
+ puts "hi"
88
100
  File.write "glob/application_user.js.erb", erb_src
89
101
 
102
+ puts "i"
90
103
  #9. The `erb` files is then sent to `./products/$PLATFORM/glob/application_user.js` with the below `ERB` variables allowable.
91
104
  erb_src = File.read "glob/application_user.js.erb"
92
105
  renderr = ERB.new(erb_src)
93
106
  context = ERBUserApplicationContext.new()
94
107
  new_src = renderr.result(context.get_binding)
95
108
  File.write "application_user.js", new_src
109
+ puts "j"
96
110
  end
97
111
  end
98
112
 
@@ -0,0 +1,19 @@
1
+ #About
2
+ The about module returns information such as the best identifier and platform-names in a standardized way. This is useful for things like analytics
3
+ tracking.
4
+
5
+ ###Driver messages
6
+ `if_about_pull()` - A message to the driver that it should send a complaint message back to the `int_about_pull_cb` endpoint. with one parameter of a dictionary.
7
+
8
+ ###Kernel messages
9
+ `int_about_pull_cb(info)` - `info` is a dictionary that contains the following values:
10
+
11
+ * `udid` - A string that represents, to the device's best capabilities, a unique application bound identifier.
12
+ * `platform` - A string that represents this platform, i.e. `iOS iPhone 4S 9.0`, `5.0 (Macintosh: Intem lMac...Safari)`
13
+ * `language` - A string that represents the locale, e.g. `en-us`
14
+
15
+ ###Kernel access
16
+ You may access the udid via the global functions:
17
+ * `get_udid` - Retrieves the udid
18
+ * `get_platform` - Retrieves the platform string
19
+ * `get_language` - Retrieves the language
@@ -3,15 +3,20 @@
3
3
  ###Functions
4
4
 
5
5
  **@telepathy[2]**
6
- `"if_net_req"(verb, url, params, tp_base)` - Perform an HTTP network request with the given VERB. Assign the network request with the correct telepathy pointer.
6
+ `"if_net_req(verb, url, params, tp_base)` - Perform an HTTP network request with the given VERB. Assign the network request with the correct telepathy pointer.
7
+ `"if_net_req2(verb, headers, url, params, tp_base)`" - Perform an HTTP network request, but accept some HTTP headers in the form of a dictionary. Useful for authentication or requesting content types.
7
8
 
8
9
  ###Interrupts
9
- `int_net_cb(tp, success, info)` - An interrupt that a network request has completed (or failed). `success` is a bool vealue. `info` is a JSON value, `tp` is the pointer that started it
10
+ `int_net_cb(tp, code, info)` - An interrupt that a network request has completed (or failed).
11
+
12
+ * `tp` - The original tele-pointer given for the request passed in for `if_net_req`
13
+ * `code` - an integer vealue that indicates whether the request could be completed or not. If it's greater than 0, it's an HTTP code response from the server. if it's -1, then it's a failed response.
14
+ * `info` - If the response was succesful, i.e. `code > 0` then the info here should be an arbitrary JSON dictionary containing the server's response. If the network request failed, then this contains a internal error message.
15
+
10
16
  `get_int_net_cb_spec()` - Sends [[0, 1, "get_int_net_cb_spec", int_net_cb_spec]]
11
17
 
12
- when successful and a string with an error message (string thats not false) when `success` is false. `tp` is the telepathy pointer passed in via `if_net_req`
13
18
 
14
- ###Behavior, when int_net_cb is called, it should make a function request to `tp` and pass `tp`, success` and `info` to this function. Additionally, the
19
+ ###Behavior, when int_net_cb is called, it should make a function request to `tp` and pass `tp`, code` and `info` to this function. Additionally, the
15
20
  kernel should set `function(tp, a, b) { int_net_cb_spec = [tp, a, b]; }` at address integer `-3209284741`.
16
21
 
17
22
  ------
@@ -7,7 +7,7 @@
7
7
  (main)>if_init_view('nav_container', {title: "Home"}, 333, ["root", "content"]);
8
8
  ```
9
9
 
10
- `if_free_view(vp)` - Destroy a view with a `view pointer`.
10
+ `if_free_view(vp)` - Destroy a view with a `view pointer`. This should be allowed to fail. There are certain circumstances, such as when a hooked transition takes pace, where a view may have a delayed destroy. If during this period the view's parent is destroyed, then the delayed destroy message will be received as a free andc we can safely ignore it. Flok shouldn't handle this internally because we don't keep track of the entire hierarchy for performance reasons.
11
11
 
12
12
  `if_attach_view(vp, p)` - A request to embed a view (`vp`) into the top of a view or spot located at `vp`|`sp` provided during `if_init_view`. If `p` is a `view pointer`, then `vp` is placed **ontop** of `p`. If `p` is a `spot pointer`, then `vp` is placed **inside** of `p`. If *p* is 0, then you should place this **inside** of the root view.
13
13
 
@@ -19,8 +19,30 @@ Request("<service name>", "get", info);
19
19
  You will then receive the event `rest_res`.
20
20
 
21
21
  For sucessful requests, `rest_res` will be sent as an event. This event
22
- will contain `path` and `res` where `path` is the `path` given in th
23
- request and `res` is the results of the request.
22
+ will look like one of two things, for a successful request it will look like:
23
+ ```ruby
24
+ {
25
+ path: "/original/path",
26
+ code: 200,
27
+ res: {
28
+ <<response from server>>
29
+ }
30
+ }
31
+ ```
32
+
33
+ For a failed request, e.g. network connection not available, not necessarily a succesful request, the parameters will look like:
34
+ ```
35
+ {
36
+ path: "/original/path",
37
+ code: -1,
38
+ res: "",
39
+ }
40
+ ```
41
+ > *This will be retried until the network request is succesful so be prepared to get multiple `rest_res` repsonses*
42
+
43
+
44
+ We say *not necessarily a succesful request* because even if the request goes through, if it's not
45
+ a `2XX` it may still not be succesful but that's a contract between you and your server.
24
46
 
25
47
  ###Globals
26
48
  * `rest_in_flight` - A hash that maps `rest_in_flight[tp_base] => bp` where `[bp, path]` is the requesting entity for the original request and
@@ -1,8 +1,12 @@
1
1
  #Virtual Memory (vm.js)
2
2
  Virtual memory provides something akin to operating system virtual memory systems with an emphasis on the paging infrastructure. Unlike an operating system, flok has the concept of a grand-unified namespaced address space that extends the concepts of caching and semantics across asynchronous and even networked systems. This vm systems is increadibly powerful because it allows you to create custom paging devices; this allows you to use one set of semantics to perform very complicated activities like pulling a news feed or list; having that news feed cached to disk automatically; etc.
3
3
 
4
+ This system has borrowed design concepts from `Git`'s distributed commit system for the synchronization mechanism, `FreeBSD's` layout of the `vm` paging-demand system, and Bell Lab's *Plan 9* operating system concept of networked files for communication.
5
+
4
6
  Additionally, flok introduces a notification system that works with the demand paging schemes and caching schemes that allow you to grab data *now* and then be notified whenever a fresh copy is available from the server.
5
7
 
8
+ Notifications also extend naturally to controllers; use pages to perform `'ipc'` across controllers. This alows you to push information around your application in ways that the hierarchy may not take kind to.
9
+
6
10
  Each pager belongs to a *namespace*; page faults hit a namespace and then the pager takes over. The pager can choose to service a request; or even throw an exception if a certain semantic is not supported in it's namespace; for example, you may want to disable write semantics for a network pager you called `net` because you expect people to make ordinary network requests.
7
11
 
8
12
  Fun aside; Because of the hashing schemantics; this paging system solves the age old problem of ... how do you show that data has changed *now* when to be assured that you have perferctly synchronized data with the server?;... you need to do a 3-way handshake with the updates. You could have a network server pager that supports writes but dosen't forward those to the network. That way, you can locally modify the page and then if the modifications were guessed correctly, the server would not even send back a page modification update! (Locally, the page would have been propogated as well). In the meantime, after modifying the local page, you would send a real network request to the server which would in turn update it's own paging system but at that point, the server would check in with you about your pages, but miraculously, because you gussed the updated page correctly, no modifications will need to be made. You could even purposefully put a 'not_synced' key in and actually show the user when the page was correctly synchronized.
@@ -68,11 +68,14 @@ handleHook("supports_back_clicked", function(hookInfo) {
68
68
 
69
69
  ## Hook generators
70
70
 
71
- * `goto` - Intercept `Goto` transitions and when a controller first loads (by virtue that a controller runs `Goto` when it first is initialized)
71
+ * `goto` - Intercept `Goto` transitions, unable to intercept first-load transition?
72
72
  * `DSL Selectors`
73
73
  * `to_action_responds_to? "event_name"` - Whenever a controller switches **to** an action that contains an `on "event_name", %{...}` handler
74
74
  * `from_action_responds_to? "event_name"` - Whenever a controller switches **from** an action that contains an `on "event_name", %{...}` handler
75
+ * `to_action "action_name"` - The name(s) of the action you are going to
76
+ * `from_action "action_name"` - The name(s) of the action you are coming from
75
77
  * `controller "controller_name"` - Only applies to controllers with the name `"controller_name"`
78
+ * `triggered_by "event_name"` - The event that caused this segue to occurr
76
79
  * `Completion`
77
80
  * The `completion` event is expected to be raised via `int_event` for all goto events. This is because the old view is not destroyed until the `completion` event is called
78
81
  to allow you to use the view in animations.
@@ -80,7 +83,29 @@ handleHook("supports_back_clicked", function(hookInfo) {
80
83
  * Unlike other semantics, `Goto` has issues with *cancellation* because the old views are destroyed. In order to work around this, you must call, after the completion
81
84
  event, the `back` segue that you have described checking whether or not a transition was in progress (interactive) based on the view-controller itself.
82
85
  * `info`:
83
- * `ctp` - Completion telepointer, you should raise an `int_event` with this base-pointer.
86
+ * `ctp` - Completion telepointer, you should raise an `int_event` with this base-pointer. Views will not be removed until this is called
87
+ * `views` - A `[String:Int]` mapping spider-selected view names to their base pointers
88
+ * `push` - Intercept `Push` transitions
89
+ * `DSL Selectors`
90
+ * `to_action_responds_to? "event_name"` - Whenever a controller switches **to** an action that contains an `on "event_name", %{...}` handler
91
+ * `from_action_responds_to? "event_name"` - Whenever a controller switches **from** an action that contains an `on "event_name", %{...}` handler
92
+ * `to_action "action_name"` - The name(s) of the action you are pushing to
93
+ * `from_action "action_name"` - The name(s) of the action you are pushing from
94
+ * `controller "controller_name"` - Only applies to controllers with the name `"controller_name"`
95
+ * `triggered_by "event_name"` - The event that caused this segue to occurr
96
+ * `info`:
97
+ * `views` - A `[String:Int]` mapping spider-selected view names to their base pointers
98
+ * `pop` - Intercept `Pop` transitions
99
+ * `DSL Selectors`
100
+ * `to_action_responds_to? "event_name"` - Whenever a controller switches **to** an action that contains an `on "event_name", %{...}` handler
101
+ * `from_action_responds_to? "event_name"` - Whenever a controller switches **from** an action that contains an `on "event_name", %{...}` handler
102
+ * `to_action "action_name"` - The name(s) of the action you are pushing to
103
+ * `from_action "action_name"` - The name(s) of the action you are pushing from
104
+ * `controller "controller_name"` - Only applies to controllers with the name `"controller_name"`
105
+ * `triggered_by "event_name"` - The event that caused this segue to occurr
106
+ * `info`:
107
+ * `views` - A `[String:Int]` mapping spider-selected view names to their base pointers
108
+ * `ctp` - Completion telepointer, you should raise an `int_event` with this base-pointer. Views will not be removed until this is called
84
109
 
85
110
  ## How the hook generators are defined & hooking internals
86
111
  See [Kernel Handbook | Hooks](../kernel_handbook/hooks.md)
@@ -104,17 +129,48 @@ The name is the hook name and the params is context specific inforamtion the com
104
129
 
105
130
  * `controller_will_goto` - The controller is about to invoke the Goto macro and switch actions or it has just entered the first action from choose_action (which is a Goto).
106
131
  * params (static generated in the hook info)
132
+ * `might_respond_to` - List of events this controller can respond to dependening on the action
107
133
  * `controller_name` - The controller name that this entry effects
108
134
  * `from_action` - The name of the action we are coming from
109
135
  * `to_action` - The name of the action we are going to
110
- * Useful (dynamic/local JS) variables
111
- * `old_action` - The previous action, equal to `from_action` but in dynamic form. If there is no action, this is set to `choose_action`. Not sure why you would use this
112
- * `__info__.action` - The name of the new action
136
+ * `handling_event_named` - The event name this originated from if applicable
113
137
  * `controller_did_goto` - The controller has completed the goto switch
114
138
  * params (static)
139
+ * `might_respond_to` - List of events this controller can respond to dependening on the action
115
140
  * `controller_name` - The controller name that this entry effects
116
141
  * `from_action` - The name of the action we are coming from
117
142
  * `to_action` - The name of the action we are going to
143
+ * `handling_event_named` - The event name this originated from if applicable
144
+ * `controller_will_push` - The controller is about to invoke the Push macro and switch actions
145
+ * params (static generated in the hook info)
146
+ * `controller_name` - The controller name that this entry effects
147
+ * `from_action` - The name of the action we are pushing from
148
+ * `to_action` - The name of the action we are pushing to
149
+ * `actions_respond_to` - Hash of action_name to array of events each action responds to
150
+ * `might_respond_to` - List of actions this controller can respond to (same info as of actions_respond_to)
151
+ * `handling_event_named` - The event name this originated from if applicable
152
+ * `controller_did_push` - The controller has completed the push
153
+ * params (static)
154
+ * `controller_name` - The controller name that this entry effects
155
+ * `from_action` - The name of the action we are pushing from
156
+ * `to_action` - The name of the action we are pushing to
157
+ * `actions_respond_to` - Hash of action_name to array of events each action responds to
158
+ * `might_respond_to` - List of actions this controller can respond to (same info as of actions_respond_to)
159
+ * `handling_event_named` - The event name this originated from if applicable
160
+ * `controller_will_pop` - The controller is about to invoke the Pop macro and switch actions
161
+ * params (static generated in the hook info)
162
+ * `controller_name` - The controller name that this entry effects
163
+ * `from_action` - The name of the action we are popping from
164
+ * `actions_respond_to` - Hash of action_name to array of events each action responds to
165
+ * `might_respond_to` - List of actions this controller can respond to (same info as of actions_respond_to)
166
+ * `handling_event_named` - The event name this originated from if applicable
167
+ * `controller_did_pop` - The controller has completed the pop
168
+ * params (static)
169
+ * `controller_name` - The controller name that this entry effects
170
+ * `from_action` - The name of the action we are popping from
171
+ * `actions_respond_to` - Hash of action_name to array of events each action responds to
172
+ * `might_respond_to` - List of actions this controller can respond to (same info as of actions_respond_to)
173
+ * `handling_event_named` - The event name this originated from if applicable
118
174
 
119
175
  ##Hooks Compiler
120
176
  The hooks compiler is able to take the hook entry points and inject code into them via a set of `HooksManifestEntries` which are bound togeather via a `HooksManifest`. The actual