Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

[Do not merge][Fivel] Keyboard interactions plugin #315

Closed
wants to merge 8 commits into from

Conversation

sedge
Copy link
Contributor

@sedge sedge commented Nov 13, 2013

sequences[ 2 ] = sequences[ 2 ] || [];

var container = _rootElement.querySelector( ".editor-options" ),
pluginOptions = {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's confusing to have both _pluginOptions (line 45) and pluginOptions in the same scope. Can one of these be renamed?

importMousetrap.type = "text/javascript";

document.head.appendChild( importMousetrap );
importMousetrap.onload = function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Let's not wrap this entire block into an onload script.

A better way to do this would be like our GoogleMaps plugin.

It first has checks to see if the script is loaded, like so https://github.com/mozilla/popcorn.webmaker.org/blob/master/public/templates/assets/plugins/googlemap/popcorn.googlemap.js?source=c#L207-L209. It waits for the document to have a <body> and then adds the maps api script.

Afterwards it uses a polling modules type system seen https://github.com/mozilla/popcorn.webmaker.org/blob/master/public/templates/assets/plugins/googlemap/popcorn.googlemap.js?source=c#L166-L191 to finish the setup once it knows the maps script is present.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You said, "It waits for the document to have a <body>..." and in the code you link to, it appears to be a googlemaps specific requirement to have the body loaded first. Is that a check I should be making?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Correct me if I'm wrong but this script probably puts something on window correct? Check there and against that value.

}

function bindAll( callback ) {
if ( !callback ){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't really need this check do you? You control how/when this function get's called. You only call it in one place and it passes a callback.

@mjschranz mjschranz closed this Jan 13, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants