Shortcuts

Implement shortcuts mentioned in #55 
This is arguable. Having explicit parameters will help making caller easier, especially in IDE environment (you can get hint on individual param's name and know what you need to pass in). Having an object as param you lose that. Plus you will need to specify keys {defaultKey: someKey, callback: callbackFunc ...}. It may become longer. I layout the params in descending order of usage. So most of the time, caller just need to ignore the rest of the params. 

----- Original Message -----

> From: "David Mason" <notifications@github.com>
> To: "zanata/zanata-spa" <zanata-spa@noreply.github.com>
> Cc: "Patrick Huang" <pahuang@redhat.com>
> Sent: Thursday, November 6, 2014 3:12:36 PM
> Subject: Re: [zanata-spa] Shortcuts (#85)

> In app/editor/EditorShortcuts.js:
> > +
> > +    };
> > +
> > +    /**
> > +     *
> > +     * @param {string} defaultKey default key combo for a shortcut
> > +     * @param {function} callback callback to execute
> > +     * @param {string} [description]
> > +     *  optional. If not empty will apply to default key (shows in
> > cheatsheet)
> > +     * @param {(string|string[])} [otherKeys]
> > +     *  optional other keys that will do the same (won't show in
> > cheatsheet)
> > +     * @param {string} [action] optional event to listen to. i.e. 'keyup'
> > +     * @returns {EditorShortcuts.ShortcutInfo}
> > +     * @constructor
> > +     */
> > +    function ShortcutInfo(defaultKey, callback, description, otherKeys,
> > action)

> With this many parameters, it is enough that we should consider using an
> object to pass in the optional parameters so they can be referred to by
> name, rather than having calls like ShortcutInfo('ctrl+a', myCallback, null,
> null, myOtherCallback) .

> —
> Reply to this email directly or view it on GitHub .