.noConflict(): this#Methods
#Subscribe
#noConflict
If a
Subscribe object already exists in the global object of the current
page, the Subscribe.js library will be renamed to PooolSubscribe and the original
Subscribe object will be restored.#init
.init(appId: String): ElementsFactoryCreates a new Subscribe instance (required to display any elements) using your app ID.
#ElementsFactory
#createAuthElement
.createAuthElement(name: String, options: Object): Promise<AuthElement>Create a new auth element instance.
#name
- Type: string
- Accepted values: 'signin-button', 'signin-with-subscribe-button'
The name of the auth element you want to create.
Available elements:
signin-button: Displays a signin button that redirects to your Subscribe platformsignin-with-subscribe-button: Displays the same signin button assignin-button, but also adds aSubscribe from X/mobutton that displays any offer price of your choice.
#Options
#target
- Type: String|Element
- Default: 'body'
CSS selector or DOM element that will contain the auth element.
#offer
- Type: String
- Default: null
Slug of the offer you want to highlight inside the
signin-with-subscribe-button element
(will display Subscribe from *price of the selected offer*)#styles
- Type: Object
- Default: null
Allows you to add custom styles to your auth elements.
#config
.config(optionName: String, optionValue: Any, readOnly?: Boolean): this.config(options: Object, readOnly?: Boolean): thisAllows to set some configuration options. See the
configuration options documentation.
#getUser
.getUser(): Promise<UserModel>Retrieve the currently-authenticated user information. Returns
undefined if no
user is authenticated.This methods returns a
UserModel object, which looks like this:#signout
.signout(): Promise<this>Disconnect the current user.
#on
.on(name: String, callback: Function): thisAllows to set a callback to be called when a specific event is triggered. See
the events documentation.
#once
.once(name: String, callback: Function): thisSame as
.on() but the callback will be called only once and removed afterwards.#off
.off(name: String, callback: Function): thisAllows to remove an event callback previously set with
.on() or .once().#AuthElement
#destroy
.destroy(): Promise<null>Destroys the element.