UNPKG

@deepkit/framework

Version:

36 lines 1.26 kB
/* * Deepkit Framework * Copyright (C) 2021 Deepkit UG, Marc J. Schmidt * * This program is free software: you can redistribute it and/or modify * it under the terms of the MIT License. * * You should have received a copy of the MIT License along with this program. */ import { EventEmitter } from 'events'; class ImportedFiles extends EventEmitter { constructor() { super(...arguments); this.files = []; } on(event, listener) { return super.on(event, listener); } add(path) { this.files.push(path); this.emit('file'); } } ImportedFiles.__type = [() => EventEmitter, 'files', function () { return []; }, "file", 'event', 'args', '', 'listener', 'on', 'path', 'add', 'ImportedFiles', 'P7!&F3">#P.$2%P"@2&$/\'2(!0)P&2*"0+5w,']; export const importedFiles = new ImportedFiles(); /** * Watch files in importedFiles and trigger the callback when change detected */ export function watch(callback) { //todo: Watch for changes and callback when detected. // make sure that files added after this watch function has been called are handled as well importedFiles.on('file', () => { }); } watch.__type = ['', 'callback', 'watch', 'PP$/!2""/#']; //# sourceMappingURL=watch.js.map