Wanikani Open Framework [developer thread]

New version of Open Framework (v1.2.4):

  • Added try-catch blocks around pageload callbacks to stop errors in one script from affecting other scripts.
  • Added support for unload_handler parameter to wkof.on_pageload:

Example1:

wkof.on_pageload(
   [ // The dashboard has two possible URLs
      '/',
      '/dashboard'
   ],
   load_ultimate_timeline,
   unload_ultimate_timeline //(optional)
);

Suppose you start on /dashboard. wkof will call:

load_ultimate_timeline("/dashboard", 1);
// The "1" means that the second URL pattern was matched.

Then if you click on the WaniKani logo in the upper left, which navigates to “/”, wkof will call:

load_ultimate_timeline("/", 0);
// Again, the "0" means that the first URL pattern was matched.

If you then click on the Reviews button, wkof will call:

unload_ultimate_timeline("/", 0);
2 Likes