src/filesystem/impls/appshell/node/FileWatcherDomain.js
function init(domainManager) {
    if (!domainManager.hasDomain("fileWatcher")) {
        domainManager.registerDomain("fileWatcher", {major: 0, minor: 1});
    }

    domainManager.registerCommand(
        "fileWatcher",
        "watchPath",
        watcherManager.watchPath,
        false,
        "Start watching a file or directory",
        [{
            name: "path",
            type: "string",
            description: "absolute filesystem path of the file or directory to watch"
        }, {
            name: "ignored",
            type: "array",
            description: "list of path to ignore"
        }]
    );
    domainManager.registerCommand(
        "fileWatcher",
        "unwatchPath",
        watcherManager.unwatchPath,
        false,
        "Stop watching a single file or a directory and it's descendants",
        [{
            name: "path",
            type: "string",
            description: "absolute filesystem path of the file or directory to unwatch"
        }]
    );
    domainManager.registerCommand(
        "fileWatcher",
        "unwatchAll",
        watcherManager.unwatchAll,
        false,
        "Stop watching all files and directories"
    );
    domainManager.registerEvent(
        "fileWatcher",
        "change",
        [
            {name: "event", type: "string"},
            {name: "parentDirPath", type: "string"},
            {name: "entryName", type: "string"},
            {name: "statsObj", type: "object"}
        ]
    );

    watcherManager.setDomainManager(domainManager);
    watcherManager.setWatcherImpl(watcherImpl);

}
function init(domainManager) {
    if (!domainManager.hasDomain("fileWatcher")) {
        domainManager.registerDomain("fileWatcher", {major: 0, minor: 1});
    }

    domainManager.registerCommand(
        "fileWatcher",
        "watchPath",
        watcherManager.watchPath,
        false,
        "Start watching a file or directory",
        [{
            name: "path",
            type: "string",
            description: "absolute filesystem path of the file or directory to watch"
        }, {
            name: "ignored",
            type: "array",
            description: "list of path to ignore"
        }]
    );
    domainManager.registerCommand(
        "fileWatcher",
        "unwatchPath",
        watcherManager.unwatchPath,
        false,
        "Stop watching a single file or a directory and it's descendants",
        [{
            name: "path",
            type: "string",
            description: "absolute filesystem path of the file or directory to unwatch"
        }]
    );
    domainManager.registerCommand(
        "fileWatcher",
        "unwatchAll",
        watcherManager.unwatchAll,
        false,
        "Stop watching all files and directories"
    );
    domainManager.registerEvent(
        "fileWatcher",
        "change",
        [
            {name: "event", type: "string"},
            {name: "parentDirPath", type: "string"},
            {name: "entryName", type: "string"},
            {name: "statsObj", type: "object"}
        ]
    );

    watcherManager.setDomainManager(domainManager);
    watcherManager.setWatcherImpl(watcherImpl);

}
function init ( domainManager ) { if ( ! domainManager . hasDomain ( "fileWatcher" ) ) { domainManager . registerDomain ( "fileWatcher" , { major : 0 , minor : 1 } ) ; } domainManager . registerCommand ( "fileWatcher" , "watchPath" , watcherManager . watchPath , false , "Start watching a file or directory" , [ { name : "path" , type : "string" , description : "absolute filesystem path of the file or directory to watch" } , { name : "ignored" , type : "array" , description : "list of path to ignore" } ] ) ; domainManager . registerCommand ( "fileWatcher" , "unwatchPath" , watcherManager . unwatchPath , false , "Stop watching a single file or a directory and it's descendants" , [ { name : "path" , type : "string" , description : "absolute filesystem path of the file or directory to unwatch" } ] ) ; domainManager . registerCommand ( "fileWatcher" , "unwatchAll" , watcherManager . unwatchAll , false , "Stop watching all files and directories" ) ; domainManager . registerEvent ( "fileWatcher" , "change" , [ { name : "event" , type : "string" } , { name : "parentDirPath" , type : "string" } , { name : "entryName" , type : "string" } , { name : "statsObj" , type : "object" } ] ) ; watcherManager . setDomainManager ( domainManager ) ; watcherManager . setWatcherImpl ( watcherImpl ) ; }
Initialize the "fileWatcher" domain.
The fileWatcher domain handles watching and un-watching directories.
Initialize the fileWatcher domain . The fileWatcher domain handles watching and un - watching directories .