server.unlock()

NES2+Syntax

server.unlock()

Description

The unlock() method of the server object unlocks the code that you have locked. This method returns true if the unlocking was successful and false if otherwise.

Example

Listing 8.138 sets a server object with a counter property, totalHits. Because you only want to increment the counter with each new user request, it must be locked. Once the counter has been incremented, the project is unlocked.

Listing 8.138 Using the unlock() Method to Unlock Your Code
<SERVER>

// Lock the code and increment a server counter
server.lock();
server.hitCount += 1;

// Unlock the code
server.unlock();

</SERVER>
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.