LCProcess

@interface LCProcess : NSObject

A node.js process instance

  • The real path of the /home/module alias for this process.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *modulePath;

    Swift

    var modulePath: String! { get }
  • The real path of the /home/node_modules path for this process.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *node_modulesPath;

    Swift

    var node_modulesPath: String! { get }
  • Creates a node.js process and attaches a delegate

    Declaration

    Objective-C

    - (id)initWithDelegate:(id<LCProcessDelegate>)delegate
                        id:(NSString *)uniqueID
           mediaAccessMask:(MediaAccessMask)mediaAccessMask;

    Swift

    init!(delegate: LCProcessDelegate!, id uniqueID: String!, mediaAccessMask: MediaAccessMask)

    Parameters

    delegate

    The process delegate.

    uniqueID

    A unique ID to identify the process namespace across runs. The file system will be preserved and reused for all processes using the same ID.

    mediaAccessMask

    Permission mask for read/write access to external media.

  • Adds an LCProcessDelegate to this process

    Declaration

    Objective-C

    - (void)addDelegate:(id<LCProcessDelegate>)delegate;

    Swift

    func add(_ delegate: LCProcessDelegate!)

    Parameters

    delegate

    the new delegate

  • Removes a delegate from this process

    Declaration

    Objective-C

    - (void)removeDelegate:(id<LCProcessDelegate>)delegate;

    Swift

    func remove(_ delegate: LCProcessDelegate!)

    Parameters

    delegate

    the delegate to remove

  • Determines if the process is currently active. If it is inactive, either it hasn’t yet been started, or the process completed. Use an LCProcessDelegate to determine the state.

    Declaration

    Objective-C

    - (_Bool)isActive;

    Swift

    func isActive() -> Bool

    Return Value

    true if active, false otherwise

  • Schedules a callback to be called on the process thread and blocks the current thread until completed.

    Declaration

    Objective-C

    - (void)sync:(ProcessThreadBlock)block;

    Swift

    func sync(_ block: ProcessThreadBlock!)

    Parameters

    block

    the callback to execute on the Node process theead.

  • Schedules a callback to be called on the process thread asynchronously.

    Declaration

    Objective-C

    - (void)async:(ProcessThreadBlock)block;

    Swift

    func async(_ block: ProcessThreadBlock!)

    Parameters

    block

    the callback to execute on the Node process theead.

  • Instructs the VM to halt execution as quickly as possible

    Declaration

    Objective-C

    - (void)exit:(int)code;

    Swift

    func exit(_ code: Int32)

    Parameters

    exitc

    The exit code

  • Instructs the VM not to shutdown the process when no more callbacks are pending. In effect, this method indefinitely leaves a callback pending until the resulting LoopPreserver is released. The loop preserver must eventually be released or the process will remain active indefinitely.

    Declaration

    Objective-C

    - (id<LoopPreserver>)keepAlive;

    Swift

    func keepAlive() -> LoopPreserver!

    Return Value

    A preserver object

  • Uninstalls a given process class identified by its uniqueID

    Declaration

    Objective-C

    + (void)uninstall:(NSString *)uniqueID scope:(UninstallScope)scope;

    Swift

    class func uninstall(_ uniqueID: String!, scope: UninstallScope)

    Parameters

    uniqueID

    The id of the process class

    scope

    scope in which to uninstall the process class