{"size": 3623, "ext": "js", "max_stars_repo_path": "pageDocumentation/._files/event.js", "max_stars_repo_name": "FedeHerrera10/FCC-Responsive-Web-Design-Projects", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "pageDocumentation/._files/event.js", "max_issues_repo_name": "FedeHerrera10/FCC-Responsive-Web-Design-Projects", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "pageDocumentation/._files/event.js", "max_forks_repo_name": "FedeHerrera10/FCC-Responsive-Web-Design-Projects", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 1811.5, "max_line_length": 3622, "alphanum_fraction": 0.8454319625}
"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var AppEvent=function(){function AppEvent(){_classCallCheck(this,AppEvent)}_createClass(AppEvent,null,[{key:"dispatchStringChange",value:function dispatchStringChange(){this.dispatch(this.STRING_CHANGE,crowdin.apps.getString())}},{key:"dispatchLanguageChange",value:function dispatchLanguageChange(){this.dispatch(this.LANGUAGE_CHANGE,crowdin.apps.getContext())}},{key:"dispatchFileChange",value:function dispatchFileChange(){this.dispatch(this.FILE_CHANGE,crowdin.apps.getContext())}},{key:"dispatchSuggestTranslation",value:function dispatchSuggestTranslation(suggestion){this.dispatch(this.TRANSLATION_ADDED,crowdin.apps.formatTranslationResponse(suggestion))}},{key:"dispatchApproveTranslation",value:function dispatchApproveTranslation(suggestionId,translationId,pluralId){var _this=this;this.waitUntil((function(){return crowdin.editor.view.state.suggestionsLoaded&&!crowdin.editor.view.state.updatePhrases}),(function(){return _this.dispatch(_this.TRANSLATION_APPROVE,crowdin.apps.getTranslation(suggestionId,translationId,pluralId))}))}},{key:"dispatchDisapproveTranslation",value:function dispatchDisapproveTranslation(suggestionId,translationId,pluralId){var _this2=this;this.waitUntil((function(){return crowdin.editor.view.state.suggestionsLoaded&&!crowdin.editor.view.state.updatePhrases}),(function(){return _this2.dispatch(_this2.TRANSLATION_DISAPPROVE,crowdin.apps.getTranslation(suggestionId,translationId,pluralId))}))}},{key:"dispatchSuggestionDeleted",value:function dispatchSuggestionDeleted(suggestionId,transationId){this.dispatch(this.TRANSLATION_DELETED,{id:suggestionId,string_id:transationId})}},{key:"dispatchSuggestionRestored",value:function dispatchSuggestionRestored(suggestionId,translationId,pluralId){this.dispatch(this.TRANSLATION_RESTORED,crowdin.apps.getTranslation(suggestionId,translationId,pluralId))}},{key:"dispatchTranslationVote",value:function dispatchTranslationVote(suggestionId,translationId,pluralId){var _this3=this;this.waitUntil((function(){return crowdin.editor.view.state.suggestionsLoaded&&!crowdin.editor.view.state.updatePhrases}),(function(){return _this3.dispatch(_this3.TRANSLATION_VOTE,crowdin.apps.getTranslation(suggestionId,translationId,pluralId))}))}},{key:"waitUntil",value:function waitUntil(condition,action){var _this4=this;if(!condition()){return setTimeout((function(){return _this4.waitUntil(condition,action)}),200)}action()}},{key:"dispatch",value:function dispatch(eventName,eventData){window.host.broadcast(eventName,{},eventData||{})}}]);return AppEvent}();AppEvent.STRING_CHANGE="string.change";AppEvent.TRANSLATION_ADDED="translation.added";AppEvent.TRANSLATION_DELETED="translation.deleted";AppEvent.TRANSLATION_RESTORED="translation.restored";AppEvent.TRANSLATION_VOTE="translation.vote";AppEvent.TRANSLATION_APPROVE="translation.approve";AppEvent.TRANSLATION_DISAPPROVE="translation.disapprove";AppEvent.LANGUAGE_CHANGE="language.change";AppEvent.FILE_CHANGE="file.change";Object.freeze(AppEvent);
