Wanikani Open Framework Turbo Events

Adds helpful methods for dealing with Turbo Events to WaniKani Open Framework

These are versions of this script where the code was updated. Show all versions.

  • v4.1.1 2024-08-12

    #### Added `add_event_listeners`. Deprecated `wkof.turbo.on.common.eventList`. Bumped version.

    Added `wkof.turbo.add_event_listeners(eventList, listener, options)`, replacing `wkof.turbo.on.common.eventList`.
    Updated the README to match.
    Also added wkof.turbo prefixes to links as appropriate in the README

    #### Reverted inlining of `eventMap`.

  • v4.1.0 2024-08-12

    Commit ALL THE THINGS

    Many updates to README.md, including significant formatting updates and internal linking. Added actual support for the AbortSignal (internally). Updated the removeExistingTurboVersion method to hopefully have more consistent behavior with older versions. Added additional checks, fixes, and optimizations.

    Added type indicators to README.md

    Added indicators for the type on each of the properties in README.md

    Updated headings in README.md

    Made all the wkof.turbo headings a Heading 2 (i.e., ####) now, and removed their "code" markdown syntax from their names.

    Updated blank lines in README.md

    Made sure there is at least one blank line before and after a heading.

    Updated indents in README.md

    Made indents four spaces throughout for consistency

    Updated some doc links in README.md. Updates to JSDoc info to match.

    Added correct parameter types to the docs.

    Fixed removeListener.

    Had the findIndex call in the wrong method. Moved removeListener so that it's less confusing

    Added remove_event_listeners

    Can now more easily remove multiple event listeners with a single call.

    Updated the docs with remove_event_listeners

    Updated the example in README.md

    Updated the example to match the object in version 4. Added some more detail and adjusted things to better illustrate how certain thing will and will not function.

    Updated the README.md for compatibility.

    Escaped underscores not in code segments/blocks, and substituted bars "|" in the table for the full-width version "|" so it does not break.

  • v4.0.0 2024-08-09

    Added more effective null/undefined checking. Improved "load" custom event.

    Added better checking for null variables or properties, and made getListenerOptions() return much more explicitly defined. Reverted change to addTypicalPageListener(), so it once again calls the custom "load" event. The custom "load" event, when triggered, now provides the same structure of callback as provided to the Turbo event callbacks. Displays a console warning if attempting to add a listener after the page has already finished loaded. This warning can be silenced with wkof.turbo.silenceWarnings = true, which is automatically done temporarily when calling addTypicalPageListener()

    Fixed the reference to silenceWarnings being on the wrong object

    Refactor to using a new TurboEvents class to handle all the event handlers.

    Each listener is wrapped with a single handler before being added as a separate listener to the page rather than trying to handle them all at the same time.

  • v3.0.4 2024-08-08

    Updated the method of removing the internal listeners to the new structure.

  • v3.0.3 2024-08-08

    Fix to return early when appropriate. Take 2

    Bump the version in the script.

  • v3.0.2 2024-08-08

    Fix to return early when appropriate.

  • v3.0.1 2024-08-08

    Removed persistent from the options.

    This option is no longer being used, and instead, a separate (non-propagating) listener is added at the start.

  • v3.0.0 2024-08-08

    Fixed oversight in old version handling.

    Now forcefully continues to remove the existing version, including versions prior to adding the "_.internal" property to the public object, and display a warning that can be silenced to the user. Also updated isNewerThan to return properly when the provided value is nonexistent.

    Added/modified JSDoc comments. Sorted functions and variables. Added more error checking and optimizations. Added table to README.md.

    Added or modified many JSDoc comments, including defining some interface types. Sorted some functions alphabetically and rearranged some variables. Also added some additional error checks, such as for undefined/null arguments or properties. Made some other optimizations. Added functionality to start supporting using standard AddEventListenerOptions options. Added a table to README.md describing the options object.

  • v2.2.4 2024-08-06

    #### Fix for verifyOptions using the wrong url

    #### Added system for embedded version control

  • v2.2.3 2024-08-06

    Fixed an edge-case for the RegExp tester

    Fixed an issue that could arise if using RegExp objects with the global flag set.

    Added an option for filtering by id. Optimized other areas.

    It is now possible to set targetIds in the options parameter to a list of ids to be matched against the event.target.id property.

    Trying a new option for emitting the handlers. Bumping version.

  • v2.2.2 2024-08-06

    Use Object.definedProperties instead of Object.definedProperty cause it just works.

  • v2.2.1 2024-08-06

    Made locations non-writable as well.

  • v2.2.0 2024-08-06

    Added listeners. Added url parameter. Fixed wrong handler being added internally.

    Added listeners for the remaining unhandled events. Added url parameter to callback arguments. Fixed the problem causing handleEvent() to be used as the callback for internal events instead of the custom handler made in the startup.

    Added deepFreeze method. Sorted various methods. Updated README.md. Bumped version.

    Properly froze or set properties non-writable for the output interface. Added notes, definitions, and explanations to README.md and sorted the property names for event. Finally updated addEventListener to return false for the "load" event if it does not run the callback.

    Fixed a scenario where an event could be called twice with "once:true".

    If "once" was set to true, it was possible that a listener could be called twice before it was actually removed. This attempts to fix that condition.

  • v2.1.0 2024-08-05

    Fixed for URL sometimes not getting set in time. Bump version to 2.1.0.

    Previously, there were times when someone could register a listener and it would trigger before turbo:load had run at least once, thus causing the passed URL not to match. Added additional logic for fetch URLs. Reduced a decent amount of semi-duplicate code in addTurboEvents().

  • v2.0.4 2024-08-05

    Bug fixes and content updates (see GitHub)

  • v2.0.3 2024-07-31

    Fixed removeEventListener behavior in respect to the options parameter

    options no longer needs to be a reference to the same object, but simply must contain the same options.
    The listener still must be a reference to the same listener, however. E.g., if a defined function passed was redefined before being passed to the removal function, it will not match and thus will not be removed.
    The function also no longer returns a false positive in the scenario that at least one handler exists for that event and undefined was passed for the options

  • v2.0.2 2024-07-30
    • Changed wkof.turbo.on.turbo to wkof.turbo.on.event
    • Added noTimeout boolean to the options parameter. Updated/optimized the handleEvent logic.
      • Setting that to true allows the user to have the event fire immediately instead of waiting for it to resolve via the built-in setTimeout call.
  • v2.0.1 2024-07-29

    Complete refactor of the general logic and the structure of the wkof.turbo object

    Also updated the README to match the changes.

  • v1.1.2 2024-07-28
  • v1.1.1 2024-07-28

    Removed some stuff that was added for testing.

  • v1.1.0 2024-07-28

    Updated a variety of areas to allow for more flexibility and added a bunch more examples and explanation to the additional info

  • v1.0.0 2024-07-28