12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- function getProfile() {
- liff
- .getProfile()
- .then(profile => {
- console.log(JSON.stringify(profile));
- window.alert(JSON.stringify(profile));
- })
- .catch(e => {
- console.log(e);
- window.alert(e);
- });
- }
- function getAccessToken() {
- window.alert(liff.getAccessToken());
- }
- function getContext() {
- window.alert(JSON.stringify(liff.getContext()));
- }
- function sendMessage() {
- liff
- .sendMessages([{ type: "text", text: "中文測試 Hello from LIFF2.0" }])
- .then(() => {
- window.alert("Message has been sent");
- })
- .catch(e => {
- window.alert(e);
- });
- }
- function login() {
- liff.login();
- }
- function scanCode() {
- liff
- .scanCode()
- .then(result => {
- window.alert(JSON.stringify(result));
- })
- .catch(e => {
- window.alert(e);
- });
- }
- function openWindow() {
- liff.openWindow({
- url: "https://sirateek.me",
- external: true
- });
- }
- function closeWindow() {
- liff.closeWindow();
- }
- function logout() {
- if (liff.isLoggedIn()) {
- liff.logout();
- window.alert("Successfully to Logout");
- location.reload();
- }
- }
- function shareTargetPicker() {
- liff
- .shareTargetPicker([
- {
- type: "text",
- text: "Hello from LIFF2.0!"
- }
- ])
- .then(() => {
- alert("Shared to the friend(s) you picked");
- })
- .catch(function(res) {
- alert(res);
- });
- }
|