Namespace: NativeAdsQueue

NativeAdsQueue

This implements the Script Mode NATIVEADS_QUEUE interface. This obviates the need to have an onReady callback. Client code must initialize the queue to an empty array if it does not exist already:

window.NATIVEADS_QUEUE = window.NATIVEADS_QUEUE || [];

Queue up API functions by calling the push function with an array argument. The first item in the array is the name of the API function. Subsequent items are the arguments for the function call:

window.NATIVEADS_QUEUE.push(["setPropertyID", "NA-TEST-11235814"]);
window.NATIVEADS_QUEUE.push(["logging.enable"]);

You can push multiple commands at once:

window.NATIVEADS_QUEUE.push(["setPropertyID", "NA-TEST-11235814"],
                            ["logging.enable"]);

You can also push functions:

window.NATIVEADS_QUEUE.push(function() {
  do_something();
});

When the plugin loads, it reads the queue and executes it; if the plugin has already loaded, then calling the push function will execute the command immediately. Client code may be written in such a way that it doesn't matter if the native ads plugin has loaded yet or not. Do not assume that NATIVEADS_QUEUE is always an array; only call the push function and nothing else.

Methods

push(command)

Parameters:
Name Type Description
command array | function

Execute one or more plugin commands. If the plugin has not yet loaded, then it will run your commands later.

Each command may be either an array or a function.

An array command will run a plugin API method. The first item in the array must be a string whose name is a method in the API. The remaining array items will be the arguments passed to the method.

A function command will simply be called. Do not assume any particular context (this).

Copyright © 2013–2017 Polar Mobile Group Inc.
Documentation generated by JSDoc 3.6.6 on Fri Sep 20 2024 16:46:55 GMT-0400 (Eastern Daylight Time) using the DocStrap template.