Move common command logic to own file

This commit is contained in:
Matt Bierner
2018-03-05 10:59:35 -08:00
parent 3c4002f850
commit 0a68f769f4
4 changed files with 29 additions and 35 deletions

View File

@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { getSettings } from './settings';
import { postCommand } from './messaging';
const unloadedStyles: string[] = [];
@@ -25,12 +26,5 @@ window.addEventListener('load', () => {
if (!unloadedStyles.length) {
return;
}
window.parent.postMessage({
type: 'command',
source: settings.source,
body: {
command: '_markdown.onPreviewStyleLoadError',
args: [unloadedStyles]
}
}, '*');
postCommand('_markdown.onPreviewStyleLoadError', [unloadedStyles]);
});