scripts/hook_durian.js
/*
    Create a custom task.
    Requires creating a CLDurianCommand with a custom data (byte array) first, and then using this
    to initialize a new CLDurianTask.

    The -[CLDurianCommand initWithData:] will split NSData into opcode (first byte) and payload.
    */
Create a custom task.
Requires creating a CLDurianCommand with a custom data (byte array) first, and then using this
to initialize a new CLDurianTask.

[CLDurianCommand initWithData:] will split NSData into opcode (first byte) and payload.
Create a custom task . Requires creating a CLDurianCommand with a custom data ( byte array ) first and then using this to initialize a new CLDurianTask . [ CLDurianCommand initWithData : ] will split NSData into opcode ( first byte ) and payload .
performTaskWithCommand(data) {
        var self = this;
        var {CLDurianCommand} = ObjC.classes;
        var command = CLDurianCommand.alloc().initWithData_(self.allocNSData(data));
        var {CLDurianTask} = ObjC.classes;
        var task = CLDurianTask.alloc().initWithCommand_desiredLatency_expectsResponse_completeOnPreemption_requiresMutex_(command, 1, 0, 0, 1);
        self.runTask(task);
    }
performTaskWithCommand ( data ) { var self = this ; var { CLDurianCommand } = ObjC . classes ; var command = CLDurianCommand . alloc ( ) . initWithData_ ( self . allocNSData ( data ) ) ; var { CLDurianTask } = ObjC . classes ; var task = CLDurianTask . alloc ( ) . initWithCommand_desiredLatency_expectsResponse_completeOnPreemption_requiresMutex_ ( command , 1 , 0 , 0 , 1 ) ; self . runTask ( task ) ; }
Create a custom task.
Create a custom task .
// create custom command // create and run task // TODO if needed, adjust latency, response, complete, mutex params here... depends a lot on the use case