Check out the latest documentation.

Manual and automatic data updates

Manual data file updates

The following snippet manually calls the update method of the Parser object:

										
										var
										
									 Parser 
										
										=
										
									 require(
										
										'51degrees'
										
									).Parser; 

										
										var
										
									 properties 
										
										=
										
									 require(
										
										'51degrees'
										
									).ALL_PROPERTIES; 

										
										var
										
									 psr3 
										
										=
										
										
										new
										
									 Parser(
										
										'51Degrees-Lite'
										
									, properties);
psr3.update(
										
										'51Degrees-Lite.dat'
										
									, properties, 
										
										'YOUR_LICENSE_KEY'
										
									, 
										
										function
										
									 onupdated () {
  
										
										// todo: updated
										
									
});

									

Automatic updates

The following snippet demonstrates how to enable automatic updates:

										
										var
										
									 Parser 
										
										=
										
									 require(
										
										'51degrees'
										
									).Parser; 

										
										var
										
									 properties 
										
										=
										
									 require(
										
										'51degrees'
										
									).ALL_PROPERTIES; 

										
										var
										
									 psr2 
										
										=
										
										
										new
										
									 Parser(
										
										'51Degrees-Lite'
										
									, properties, {
  autoUpdate
										
										:
										
										
										true
										
									,
  key
										
										:
										
										
										'YOUR_LICENSE_KEY'
										
									
});