1.2.5 • Published 1 month ago

pp-events v1.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Getting Started

In the web project include pp-events.js with:

<script src="https://cdn.jsdelivr.net/npm/pp-is@latest/pp-is.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/pp-events@latest/pp-events.min.js" ></script>

Or

Install

npm i pp-events --save

Initialize

Nodejs

var ppEvents = require("pp-events")

var Event = ppEvents() // Or new ppEvents()

RequireJS

// in data-main script file
requirejs.config({    
    baseUrl:"node_modules/",
    paths: {
        "pp-is": "pp-is/pp-is.min",
        "pp-events":"pp-events/pp-events"
    }
});
// in your main js file
require(["config"],function(){
	require(["pp-events"],function(ppEvents){
		const Event = ppEvents(); // or new events();
	});
})

Browser Javascript

var Event = ppEvents() // Or new ppEvents()

//say hello function for execute
var sayHello = function( msg ){
	console.log(msg)
}

Event.on("sayHello",sayHello)

Event.emit("sayHello","Hi everyone !!!!!")

// remove Events if will be necesary

Event.removeListener("sayHello",sayHello);

Methods

on

Event.on("eventName",myFunction);

emit

Event.emit("eventName",{
	mydata:"myvalue",
	otherData:"otherValue"
});

checkOn

Event.checkOn("eventName");

removeListener

Event.removeListener("eventName",myFunction);
1.2.5

1 month ago

1.2.4

2 months ago

1.2.3

8 months ago

1.2.2

8 months ago

1.2.1

3 years ago

1.2.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago